/* Material 3 Light Theme Styling for IAS Account Switcher */

:root {
    --md-sys-color-primary: #6750A4;
    --md-sys-color-on-primary: #FFFFFF;
    --md-sys-color-primary-container: #EADDFF;
    --md-sys-color-on-primary-container: #21005D;
    --md-sys-color-surface: #FEF7FF;
    --md-sys-color-on-surface: #1D1B20;
    --md-sys-color-surface-container-low: #F7F2FA;
    --md-sys-color-surface-container: #F3EDF7;
    --md-sys-color-surface-container-high: #ECE6F0;
    --md-sys-color-on-surface-variant: #49454F;
    --md-sys-color-outline: #79747E;
    --md-sys-color-outline-variant: #CAC4D0;
    --md-sys-color-error: #B3261E;
    --md-sys-color-error-container: #F9DEDC;
    --md-sys-color-on-error-container: #410E0B;
    
    --md-sys-color-offline: #0061A4;
    --md-sys-color-offline-container: #D1E4FF;
    --md-sys-color-offline-on-container: #001D36;
    
    --md-sys-color-microsoft: #606000;
    --md-sys-color-microsoft-container: #E6E696;
    
    --md-sys-color-encrypted: #8B5000;
    --md-sys-color-encrypted-container: #FFDCBE;
    
    --md-elevation-1: 0px 1px 3px 1px rgba(0, 0, 0, 0.15), 0px 1px 2px 0px rgba(0, 0, 0, 0.30);
    --md-elevation-2: 0px 2px 6px 2px rgba(0, 0, 0, 0.15), 0px 1px 2px 0px rgba(0, 0, 0, 0.30);
    
    --font-family: 'Roboto', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: #F8F9FA;
    color: var(--md-sys-color-on-surface);
    font-family: var(--font-family);
    line-height: 1.5;
    padding-bottom: 2rem;
}

/* Main Title */
.main-title {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 500;
    margin: 1.5rem 0 0.5rem 0;
    color: var(--md-sys-color-on-surface);
}

/* Content Container */
.container {
    max-width: 1000px;
    margin: 1.5rem auto;
    padding: 0 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Cards */
.card {
    background-color: #FFFFFF;
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 12px;
    padding: 1.25rem;
    transition: box-shadow 0.2s ease;
}

.card:hover {
    box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.05);
}

/* Upload zone */
.drop-zone {
    border: 1px dashed var(--md-sys-color-outline);
    border-radius: 8px;
    padding: 2rem 1.5rem;
    text-align: center;
    cursor: pointer;
    background-color: var(--md-sys-color-surface-container-low);
    transition: background-color 0.2s;
}

.drop-zone:hover {
    background-color: var(--md-sys-color-surface-container);
}

.drop-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    color: var(--md-sys-color-on-surface-variant);
}

.drop-zone-text {
    font-size: 0.95rem;
}

.drop-zone-text code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    background-color: rgba(0,0,0,0.05);
    padding: 0.1rem 0.25rem;
    border-radius: 4px;
}

.file-info-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.75rem;
    padding: 0.5rem 1rem;
    background-color: var(--md-sys-color-surface-container-low);
    border-radius: 6px;
    border: 1px solid var(--md-sys-color-outline-variant);
}

.file-info-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    color: var(--md-sys-color-on-surface-variant);
}

/* Warning Banner */
.warning-banner {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background-color: var(--md-sys-color-error-container);
    color: var(--md-sys-color-on-error-container);
    border-radius: 8px;
    font-size: 0.9rem;
}

.warning-banner svg {
    color: var(--md-sys-color-error);
    flex-shrink: 0;
}

/* Viewer Panel */
.viewer-section {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.search-field {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background-color: var(--md-sys-color-surface-container-low);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 8px;
    padding: 0 0.75rem;
    height: 36px;
    min-width: 200px;
    transition: all 0.2s;
}

.search-field:focus-within {
    border-color: var(--md-sys-color-primary);
    background-color: #FFFFFF;
    box-shadow: 0 0 0 1px var(--md-sys-color-primary);
}

.search-field svg {
    color: var(--md-sys-color-on-surface-variant);
    flex-shrink: 0;
}

.search-field input {
    border: none;
    background: transparent;
    outline: none;
    font-size: 0.85rem;
    color: var(--md-sys-color-on-surface);
    width: 100%;
    font-family: var(--font-family);
}

.stats-pills {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.stat-badge {
    background-color: var(--md-sys-color-surface-container-high);
    border: 1px solid transparent;
    padding: 0.35rem 0.75rem;
    border-radius: 8px;
    font-size: 0.85rem;
    color: var(--md-sys-color-on-surface-variant);
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    font-family: var(--font-family);
}

.stat-badge:hover {
    background-color: var(--md-sys-color-surface-container);
    border-color: var(--md-sys-color-outline-variant);
}

.stat-badge.active {
    border-color: var(--md-sys-color-primary);
    background-color: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
}

.stat-badge.offline:hover {
    background-color: rgba(0, 97, 164, 0.08);
}

.stat-badge.offline.active {
    border-color: var(--md-sys-color-offline);
    background-color: var(--md-sys-color-offline-container);
    color: var(--md-sys-color-offline-on-container);
}

.stat-badge.microsoft:hover {
    background-color: rgba(139, 80, 0, 0.08);
}

.stat-badge.microsoft.active {
    border-color: #D97706;
    background-color: var(--md-sys-color-encrypted-container);
    color: #451a03;
}

/* Accounts Grid */
.accounts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 0.85rem;
}

/* Account Cards */
.account-card {
    background-color: #FFFFFF;
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 8px;
    padding: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    position: relative;
}

.account-card:hover {
    box-shadow: 0px 1px 2px rgba(0,0,0,0.1);
}

.card-actions-top {
    position: absolute;
    top: 0.4rem;
    right: 0.4rem;
    display: flex;
    gap: 0.15rem;
    opacity: 0.5;
    transition: opacity 0.2s;
}

.account-card:hover .card-actions-top {
    opacity: 1;
}

.card-action-btn {
    background: none;
    border: none;
    color: var(--md-sys-color-on-surface-variant);
    cursor: pointer;
    padding: 3px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, color 0.2s;
}

.card-action-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
    color: var(--md-sys-color-primary);
}

.card-action-btn.remove-btn:hover {
    background-color: rgba(179, 38, 30, 0.08);
    color: var(--md-sys-color-error);
}

.copy-nick-btn {
    background: transparent;
    border: none;
    color: var(--md-sys-color-on-surface-variant);
    cursor: pointer;
    padding: 2px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    vertical-align: middle;
    margin-left: 0.25rem;
    transition: color 0.2s, background-color 0.2s;
}

.copy-nick-btn:hover {
    color: var(--md-sys-color-primary);
    background-color: rgba(103, 80, 164, 0.08);
}

.account-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.avatar-wrapper {
    width: 36px;
    height: 36px;
    border-radius: 4px;
    background-color: var(--md-sys-color-surface-container);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar-img {
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
}

.account-meta {
    display: flex;
    flex-direction: column;
    max-width: calc(100% - 48px);
}

.account-name {
    font-weight: 500;
    font-size: 0.95rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-type-label {
    font-size: 0.75rem;
    color: var(--md-sys-color-on-surface-variant);
}

.account-details {
    font-size: 0.75rem;
    color: var(--md-sys-color-on-surface-variant);
    font-family: 'JetBrains Mono', monospace;
    word-break: break-all;
}

.btn-decrypt {
    width: 100%;
    padding: 0.4rem;
    border-radius: 4px;
    font-size: 0.8rem;
    background-color: var(--md-sys-color-surface-container-high);
    border: 1px solid var(--md-sys-color-outline-variant);
    color: var(--md-sys-color-primary);
    cursor: pointer;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

.btn-decrypt:hover {
    background-color: var(--md-sys-color-surface-container);
}

/* Save/Export Card */
.export-card {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.card-title {
    font-size: 1.15rem;
    font-weight: 500;
}

.card-desc {
    font-size: 0.85rem;
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: 0.5rem;
}

.export-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal-card {
    background-color: var(--md-sys-color-surface-container-high);
    border-radius: 28px;
    width: calc(100% - 2rem);
    max-width: 400px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    box-shadow: var(--md-elevation-2);
}

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 500;
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.modal-body p {
    font-size: 0.9rem;
    color: var(--md-sys-color-on-surface-variant);
}

/* M3 Outlined Text Field */
.input-field {
    position: relative;
    width: 100%;
}

.input-field input {
    width: 100%;
    height: 56px;
    padding: 0 1rem;
    background: transparent;
    border: 1px solid var(--md-sys-color-outline);
    border-radius: 4px;
    font-size: 1rem;
    color: var(--md-sys-color-on-surface);
    outline: none;
    font-family: var(--font-family);
    transition: border-color 0.2s;
}

.input-field input:focus {
    border-color: var(--md-sys-color-primary);
    border-width: 2px;
    padding: 0 15px; /* adjust for border thickness increase */
}

.input-field label {
    position: absolute;
    left: 1rem;
    top: 18px;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 1rem;
    pointer-events: none;
    transition: all 0.2s ease;
    background-color: var(--md-sys-color-surface-container-high);
    padding: 0 4px;
}

/* Label behavior when floating */
.input-field input:focus ~ label,
.input-field input:not(:placeholder-shown) ~ label {
    top: -8px;
    left: 0.75rem;
    font-size: 0.75rem;
    color: var(--md-sys-color-primary);
}

.checkbox-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.m3-checkbox {
    width: 18px;
    height: 18px;
    accent-color: var(--md-sys-color-primary);
}

.error-message {
    font-size: 0.8rem;
    color: var(--md-sys-color-error);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* M3 Buttons */
.btn {
    font-family: var(--font-family);
    font-weight: 500;
    font-size: 0.875rem;
    border-radius: 100px;
    height: 40px;
    padding: 0 1.5rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: none;
    transition: all 0.2s;
}

.btn-filled {
    background-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
}

.btn-filled:hover {
    background-shadow: var(--md-elevation-1);
    opacity: 0.9;
}

.btn-outlined {
    background-color: transparent;
    border: 1px solid var(--md-sys-color-outline);
    color: var(--md-sys-color-primary);
}

.btn-outlined:hover {
    background-color: rgba(103, 80, 164, 0.08);
}

.btn-text {
    background-color: transparent;
    color: var(--md-sys-color-primary);
    padding: 0 0.75rem;
}

.btn-text:hover {
    background-color: rgba(103, 80, 164, 0.08);
}

.btn-danger {
    color: var(--md-sys-color-error);
}

.btn-danger:hover {
    background-color: rgba(179, 38, 30, 0.08);
}

/* Footer Section */
.app-footer {
    border-top: 1px solid var(--md-sys-color-outline-variant);
    padding-top: 1rem;
    margin-top: 2rem;
}

.path-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--md-sys-color-on-surface-variant);
    flex-wrap: wrap;
    gap: 0.5rem;
}

.path-warning {
    margin-top: 0.75rem;
    font-size: 0.8rem;
    color: #854d0e; /* dark amber warning text */
    text-align: right;
    line-height: 1.4;
}

.path-warning code {
    font-family: 'JetBrains Mono', monospace;
    background-color: var(--md-sys-color-encrypted-container);
    padding: 0.1rem 0.25rem;
    border-radius: 4px;
    color: #451a03;
}

.path-box {
    display: flex;
    align-items: center;
    background-color: var(--md-sys-color-surface-container);
    border-radius: 6px;
    padding: 0.35rem 0.5rem;
    gap: 0.5rem;
}

.path-box code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: var(--md-sys-color-primary);
    overflow-x: auto;
    white-space: nowrap;
}

.copy-btn {
    background: transparent;
    border: none;
    color: var(--md-sys-color-on-surface-variant);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.copy-btn:hover {
    background-color: rgba(0,0,0,0.05);
}

/* Simple Spinner */
.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.4);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Account Cards Borders */
.account-card.offline {
    border-left: 4px solid var(--md-sys-color-offline);
}
.account-card.decrypted {
    border-left: 4px solid var(--md-sys-color-primary);
}
.account-card.encrypted {
    border-left: 4px solid #D97706; /* Darker amber */
}

/* Account Badges styling */
.account-badge {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    text-transform: uppercase;
    display: inline-block;
    width: max-content;
    margin-top: 0.15rem;
}

.badge-offline {
    background-color: var(--md-sys-color-offline-container);
    color: var(--md-sys-color-offline-on-container);
}

.badge-microsoft {
    background-color: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
}

.badge-encrypted {
    background-color: var(--md-sys-color-encrypted-container);
    color: #451a03;
}

/* Top Export Card styling */
.top-export-card {
    padding: 0.65rem 1rem;
    margin-bottom: -0.25rem;
}

.top-export-card .export-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.top-export-card .btn {
    height: 32px;
    padding: 0 1rem;
    font-size: 0.8rem;
}

/* Toast Notification Stack (Left Side, ~1s duration) */
.toast-container {
    position: fixed;
    bottom: 24px;
    left: 24px;
    display: flex;
    flex-direction: column-reverse; /* newer toasts at the bottom, pushing older toasts up */
    gap: 8px;
    z-index: 1000;
    pointer-events: none;
}

.toast-notification {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 12px;
    background-color: #313033;
    color: #F5F0F7;
    padding: 8px 12px 8px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    box-shadow: var(--md-elevation-1);
    opacity: 0;
    transform: translateX(-30px);
    transition: opacity 0.25s cubic-bezier(0, 0, 0.2, 1), transform 0.25s cubic-bezier(0, 0, 0.2, 1);
    min-width: 200px;
    max-width: 320px;
}

.toast-notification.show {
    opacity: 1;
    transform: translateX(0);
}

.toast-close-btn {
    background: transparent;
    border: none;
    color: #C4C4C4;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    transition: background-color 0.2s, color 0.2s;
}

.toast-close-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #FFFFFF;
}

/* Global Drag and Drop Overlay */
.global-drag-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(103, 80, 164, 0.95);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s, visibility 0.25s;
    color: #FFFFFF;
}

.global-drag-overlay.active {
    opacity: 1;
    visibility: visible;
}

.global-drag-content {
    border: 2px dashed rgba(255, 255, 255, 0.5);
    border-radius: 16px;
    padding: 3rem 4rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    text-align: center;
}

.global-drag-content h2 {
    font-size: 1.5rem;
    font-weight: 500;
    margin: 0;
}

.global-drag-content p {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    margin: 0;
}

/* Adjust page content margin to prevent overlap if screen is wide enough */
@media (min-width: 1280px) {
    .container {
        padding-left: 140px;
        padding-right: 140px;
    }
}

/* Account Details Modal styles */
.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    padding-bottom: 0.5rem;
}

.detail-label {
    font-weight: 500;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 0.85rem;
}

.detail-value {
    color: var(--md-sys-color-on-surface);
    font-size: 0.9rem;
}

.detail-value code {
    font-family: 'JetBrains Mono', monospace;
    background-color: var(--md-sys-color-surface-container-high);
    padding: 0.15rem 0.35rem;
    border-radius: 4px;
}

.detail-token-section {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-top: 0.85rem;
}

.detail-token-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.token-textarea {
    width: 100%;
    height: 80px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    background-color: var(--md-sys-color-surface-container-low);
    color: var(--md-sys-color-on-surface);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 8px;
    padding: 0.5rem;
    resize: none;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s;
}

.token-textarea:focus {
    border-color: var(--md-sys-color-primary);
}

.btn-details {
    background-color: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-on-surface-variant);
    border: 1px solid var(--md-sys-color-outline-variant);
}

.btn-details:hover {
    background-color: var(--md-sys-color-surface-container-highest);
}
