/**
 * End-to-End Encryption Styles
 */

/* Encryption Setup Wizard */
.encryption-setup-wizard {
    padding: 20px;
}

.setup-step {
    min-height: 400px;
}

.setup-step.hidden {
    display: none;
}

.setup-intro {
    text-align: center;
}

.security-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.setup-intro h4 {
    font-size: 24px;
    margin-bottom: 15px;
    color: #333;
}

.info-box {
    border-radius: 8px;
    padding: 15px;
    margin: 20px 0;
    text-align: left;
}

.info-box-success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
}

.info-box-warning {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
}

.info-box ul {
    margin: 10px 0 0 0;
    padding-left: 25px;
}

.info-box li {
    margin: 5px 0;
}

.setup-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #dee2e6;
}

/* Passphrase Requirements */
.passphrase-requirements {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 15px;
    margin-bottom: 20px;
}

.passphrase-requirements ul {
    list-style: none;
    padding: 0;
    margin: 10px 0 0 0;
}

.passphrase-requirements li {
    padding: 5px 0;
    padding-left: 25px;
    position: relative;
}

.passphrase-requirements li:before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border-radius: 50%;
}

.req-unmet:before {
    content: '○';
    color: #dc3545;
    font-size: 20px;
}

.req-met:before {
    content: '✓';
    color: #28a745;
    font-size: 16px;
    font-weight: bold;
}

.req-unmet {
    color: #6c757d;
}

.req-met {
    color: #28a745;
    font-weight: 500;
}

/* Passphrase Strength Bar */
.passphrase-strength {
    margin-top: 10px;
}

.strength-bar {
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 5px;
}

.strength-bar-fill {
    height: 100%;
    transition: width 0.3s, background-color 0.3s;
    border-radius: 4px;
}

.strength-weak {
    background: #dc3545;
}

.strength-medium {
    background: #ffc107;
}

.strength-strong {
    background: #28a745;
}

.strength-text {
    font-size: 12px;
    display: block;
}

/* Recovery Keys Display */
.recovery-keys-display {
    text-align: center;
}

.success-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.recovery-keys-list {
    background: #f8f9fa;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    max-height: 300px;
    overflow-y: auto;
}

.recovery-key-item {
    display: flex;
    align-items: center;
    padding: 12px;
    margin: 8px 0;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 6px;
}

.key-number {
    font-weight: bold;
    color: #495057;
    margin-right: 15px;
    min-width: 30px;
}

.recovery-key-code {
    font-family: 'Courier New', monospace;
    font-size: 16px;
    font-weight: bold;
    color: #0056b3;
    background: #e7f1ff;
    padding: 8px 12px;
    border-radius: 4px;
    flex-grow: 1;
    user-select: all;
}

.recovery-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin: 20px 0;
}

/* Unlock Modal */
.unlock-form {
    padding: 20px;
}

.unlock-mode-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #dee2e6;
}

.unlock-tab {
    flex: 1;
    padding: 12px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-weight: 500;
    color: #6c757d;
    transition: all 0.2s;
}

.unlock-tab:hover {
    color: #495057;
    background: #f8f9fa;
}

.unlock-tab.active {
    color: #0056b3;
    border-bottom-color: #0056b3;
}

.unlock-panel {
    padding: 20px 0;
}

.unlock-panel.hidden {
    display: none;
}

.unlock-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.recovery-key-input {
    font-family: 'Courier New', monospace;
    font-size: 18px;
    letter-spacing: 2px;
    text-align: center;
}

/* Locked Banner */
.encryption-locked-banner {
    position: sticky;
    top: 0;
    z-index: 1000;
}

.encryption-alert {
    margin: 0;
    border-radius: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
}

.alert-icon {
    font-size: 20px;
}

/* Secret Field Styles */
.secret-field-wrapper {
    position: relative;
    display: flex;
    gap: 5px;
}

.secret-field {
    flex-grow: 1;
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
}

.secret-field.locked {
    background: #f8f9fa;
    cursor: not-allowed;
}

.btn-toggle-visibility {
    padding: 6px 12px;
    border: 1px solid #ced4da;
    background: white;
    cursor: pointer;
    border-radius: 4px;
}

.btn-toggle-visibility:hover {
    background: #f8f9fa;
}

.btn-copy-secret {
    padding: 6px 12px;
    border: 1px solid #ced4da;
    background: white;
    cursor: pointer;
    border-radius: 4px;
}

.btn-copy-secret:hover {
    background: #f8f9fa;
}

.btn-unlock-field {
    padding: 6px 12px;
    border: 1px solid #ced4da;
    background: white;
    cursor: pointer;
    border-radius: 4px;
}

.btn-unlock-field:hover {
    background: #fff3cd;
}

.field-hint {
    display: block;
    margin-top: 5px;
    color: #6c757d;
    font-size: 12px;
}

.lock-indicator {
    display: inline-block;
    margin-left: 10px;
    font-size: 12px;
    color: #28a745;
}

/* Notifications */
.encryption-notification {
    position: relative;
    margin-bottom: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Modal Base Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 99999 !important;
    display: none;
    width: 100%;
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    outline: 0;
}

.modal.show {
    display: block !important;
}

.modal.fade {
    transition: opacity 0.15s linear;
}

.modal-dialog {
    position: relative;
    width: auto;
    margin: 1.75rem auto;
    max-width: 500px;
    pointer-events: none;
}

.modal-dialog-centered {
    display: flex;
    align-items: center;
    min-height: calc(100% - 3.5rem);
}

.modal-content {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    pointer-events: auto;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 0.3rem;
    outline: 0;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.5);
}

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 99998 !important;
    width: 100vw;
    height: 100vh;
    background-color: #000;
}

.modal-backdrop.show {
    opacity: 0.5;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid #dee2e6;
}

.modal-title {
    margin: 0;
    line-height: 1.5;
    font-size: 1.25rem;
    font-weight: 500;
}

.modal-body {
    position: relative;
    flex: 1 1 auto;
    padding: 1rem;
}

.btn-close {
    padding: 0.25rem;
    background: transparent;
    border: 0;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
    color: #000;
    opacity: 0.5;
    cursor: pointer;
}

.btn-close:hover {
    opacity: 0.75;
}

.modal-open {
    overflow: hidden;
}

/* Modal Sizes */
.modal-large {
    max-width: 700px;
}

.modal-medium {
    max-width: 500px;
}

/* Security Notice for Settings */
.secret-field-notice {
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 6px;
    padding: 15px;
    margin: 15px 0;
}

.secret-field-notice strong {
    display: block;
    margin-bottom: 10px;
    color: #856404;
}

.secret-field-notice p {
    margin: 5px 0;
    color: #856404;
}

/* Form group spacing */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.input-group {
    display: flex;
    gap: 5px;
}

.input-group input {
    flex: 1;
}

/* Responsive */
@media (max-width: 768px) {
    .recovery-actions {
        flex-direction: column;
    }

    .setup-actions {
        flex-direction: column;
        gap: 10px;
    }

    .unlock-actions {
        flex-direction: column;
    }
}

/* Print Styles for Recovery Keys */
@media print {
    body * {
        visibility: hidden;
    }

    .recovery-keys-list,
    .recovery-keys-list * {
        visibility: visible;
    }

    .recovery-keys-list {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
    }

    .btn-close,
    .recovery-actions,
    .setup-actions {
        display: none !important;
    }
}
