/**
 * Encrypted Folder Styles
 * Styling for encrypted folder setup page, lock overlays, and unlock prompts
 */

/* ==================== Encrypted Folder Icon Overlay ==================== */

.desktop-icon.encrypted-folder .folder-lock-overlay,
.fe-item.encrypted-folder .folder-lock-overlay {
    position: absolute;
    bottom: 22px;
    right: 8px;
    width: 18px;
    height: 18px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    pointer-events: none;
    z-index: 5;
}

.desktop-icon.encrypted-folder.locked .folder-lock-overlay {
    background: rgba(220, 53, 69, 0.9);
}

.desktop-icon.encrypted-folder.unlocked .folder-lock-overlay {
    background: rgba(40, 167, 69, 0.85);
}

/* Encrypted folder icon tint */
.desktop-icon.encrypted-folder svg path[fill="#FFD700"],
.fe-item.encrypted-folder svg path[fill="#FFD700"] {
    fill: #DAA520; /* Darker gold for encrypted folders */
}

/* ==================== Setup Page (inside File Explorer) ==================== */

.ef-setup-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 20px;
    background: var(--window-bg, #1e1e1e);
    overflow-y: auto;
}

.ef-setup-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.ef-setup-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 500;
    color: var(--text-color, #fff);
}

.ef-setup-back-btn {
    background: none;
    border: none;
    color: var(--text-color, #fff);
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ef-setup-back-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Warning Section */
.ef-setup-warning {
    background: rgba(220, 53, 69, 0.15);
    border: 1px solid rgba(220, 53, 69, 0.4);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 24px;
}

.ef-setup-warning h3 {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 600;
    color: #f8d7da;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ef-setup-warning ul {
    margin: 0;
    padding-left: 20px;
    color: #f5c6cb;
    font-size: 13px;
    line-height: 1.6;
}

.ef-setup-warning li {
    margin-bottom: 4px;
}

/* Password Section */
.ef-setup-section {
    margin-bottom: 24px;
}

.ef-setup-section h4 {
    margin: 0 0 12px 0;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-color, #fff);
}

.ef-password-group {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
}

.ef-password-group.additional-branch {
    border-color: rgba(218, 165, 32, 0.4);
    background: rgba(218, 165, 32, 0.1);
}

.ef-password-group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.ef-password-group-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted, #aaa);
}

.ef-remove-branch-btn {
    background: none;
    border: none;
    color: #dc3545;
    cursor: pointer;
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 4px;
}

.ef-remove-branch-btn:hover {
    background: rgba(220, 53, 69, 0.2);
}

.ef-password-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.ef-password-input-wrapper {
    flex: 1;
    position: relative;
}

.ef-password-input {
    width: 100%;
    padding: 10px 40px 10px 12px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-color, #fff);
    font-size: 14px;
    box-sizing: border-box;
}

.ef-password-input:focus {
    outline: none;
    border-color: #4a90d9;
}

.ef-password-toggle {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted, #888);
    cursor: pointer;
    padding: 4px;
    font-size: 16px;
}

.ef-password-toggle:hover {
    color: var(--text-color, #fff);
}

/* Password Mismatch Error */
.ef-password-mismatch-error {
    display: none;
    color: #dc3545;
    font-size: 12px;
    margin-top: 4px;
    padding-left: 4px;
}

.ef-password-input.error {
    border-color: #dc3545 !important;
    background: rgba(220, 53, 69, 0.1) !important;
}

/* Password Strength Indicator */
.ef-password-strength {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.ef-strength-bar {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

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

.ef-strength-label {
    font-size: 12px;
    color: var(--text-muted, #888);
    min-width: 60px;
}

/* Split Folder Section */
.ef-split-section {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    margin-bottom: 24px;
}

.ef-add-branch-btn {
    width: 36px;
    height: 36px;
    border: 2px solid rgba(218, 165, 32, 0.5);
    border-radius: 8px;
    background: rgba(218, 165, 32, 0.1);
    color: #DAA520;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}

.ef-add-branch-btn:hover {
    background: rgba(218, 165, 32, 0.2);
    border-color: #DAA520;
}

.ef-add-branch-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.ef-split-info {
    font-size: 12px;
    color: var(--text-muted, #888);
    line-height: 1.5;
}

.ef-split-info strong {
    color: #DAA520;
}

/* Actions */
.ef-setup-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.ef-setup-btn {
    padding: 10px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.ef-setup-btn.cancel {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-color, #fff);
}

.ef-setup-btn.cancel:hover {
    background: rgba(255, 255, 255, 0.15);
}

.ef-setup-btn.primary {
    background: #4a90d9;
    color: #fff;
}

.ef-setup-btn.primary:hover {
    background: #3a7bc8;
}

.ef-setup-btn.primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ==================== Unlock Prompt ==================== */

.ef-unlock-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 40px;
    text-align: center;
}

.ef-unlock-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.8;
}

.ef-unlock-title {
    font-size: 20px;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-color, #fff);
}

.ef-unlock-subtitle {
    font-size: 14px;
    color: var(--text-muted, #888);
    margin-bottom: 24px;
}

.ef-unlock-form {
    width: 100%;
    max-width: 300px;
}

.ef-unlock-input-wrapper {
    position: relative;
    margin-bottom: 16px;
}

.ef-unlock-input {
    width: 100%;
    padding: 12px 44px 12px 16px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-color, #fff);
    font-size: 15px;
    text-align: center;
    box-sizing: border-box;
}

.ef-unlock-input:focus {
    outline: none;
    border-color: #4a90d9;
}

.ef-unlock-input.error {
    border-color: #dc3545;
    animation: shake 0.4s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    75% { transform: translateX(8px); }
}

.ef-unlock-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted, #888);
    cursor: pointer;
    padding: 4px;
    font-size: 18px;
}

.ef-unlock-btn {
    width: 100%;
    padding: 12px;
    background: #4a90d9;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    cursor: pointer;
    transition: background 0.2s;
}

.ef-unlock-btn:hover {
    background: #3a7bc8;
}

.ef-unlock-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.ef-unlock-error {
    color: #dc3545;
    font-size: 13px;
    margin-top: 12px;
    min-height: 20px;
}

/* ==================== Lock Button in Toolbar ==================== */

.fe-btn.fe-lock-btn {
    position: relative;
}

.fe-btn.fe-lock-btn.locked {
    color: #dc3545;
}

.fe-btn.fe-lock-btn.unlocked {
    color: #28a745;
}

/* ==================== Responsive ==================== */

@media (max-width: 480px) {
    .ef-setup-container {
        padding: 16px;
    }

    .ef-setup-warning {
        padding: 12px;
    }

    .ef-password-row {
        flex-direction: column;
    }

    .ef-setup-actions {
        flex-direction: column-reverse;
    }

    .ef-setup-btn {
        width: 100%;
    }
}

/* ==================== Loading Overlay (Encryption/Decryption) ==================== */

.ef-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.ef-loading-content {
    text-align: center;
    padding: 32px;
    max-width: 300px;
}

.ef-loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: #4a90d9;
    border-radius: 50%;
    margin: 0 auto 20px;
    animation: ef-spin 1s linear infinite;
}

@keyframes ef-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.ef-loading-message {
    color: #fff;
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 16px;
}

.ef-loading-progress {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 12px;
}

.ef-loading-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #4a90d9, #67b8f7);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.ef-loading-detail {
    color: rgba(255, 255, 255, 0.6);
    font-size: 13px;
    font-family: monospace;
    word-break: break-all;
    max-height: 60px;
    overflow: hidden;
}

/* ==================== Confirmation Dialog ==================== */

.ef-confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    backdrop-filter: blur(4px);
}

.ef-confirm-dialog {
    background: var(--window-bg, #2d2d2d);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 24px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.ef-confirm-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-color, #fff);
    margin-bottom: 12px;
}

.ef-confirm-message {
    font-size: 14px;
    color: var(--text-muted, #aaa);
    line-height: 1.5;
    margin-bottom: 24px;
}

.ef-confirm-buttons {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.ef-confirm-btn {
    padding: 10px 20px;
    border-radius: 6px;
    border: none;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.ef-confirm-btn.cancel {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-color, #fff);
}

.ef-confirm-btn.cancel:hover {
    background: rgba(255, 255, 255, 0.15);
}

.ef-confirm-btn.confirm {
    background: #4a90d9;
    color: #fff;
}

.ef-confirm-btn.confirm:hover {
    background: #3a7bc8;
}
