/* Flight Buddy Admin Interface Styles */

/* CSS Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Typography */
    --font-display: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;

    /* Colors - refined, deeper palette */
    --primary-color: #1e40af;
    --primary-hover: #1e3a8a;
    --primary-light: #3b82f6;
    --secondary-color: #64748b;
    --success-color: #059669;
    --warning-color: #d97706;
    --error-color: #dc2626;
    --background: #f1f5f9;
    --surface: #ffffff;
    --border: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;

    /* Category Colors */
    --category-hr-bg: #fef3c7;
    --category-hr-text: #92400e;
    --category-admin-bg: #ddd6fe;
    --category-admin-text: #6d28d9;
    --category-dispatch-bg: #dcfce7;
    --category-dispatch-text: #166534;

    /* Status Colors */
    --status-active-bg: #dcfce7;
    --status-active-text: #166534;
    --status-inactive-bg: #fee2e2;
    --status-inactive-text: #991b1b;
    --status-warning-bg: #fef3c7;
    --status-warning-text: #92400e;

    /* Spacing Scale (4px base) */
    --space-1: 0.25rem;   /* 4px */
    --space-2: 0.5rem;    /* 8px */
    --space-3: 0.75rem;   /* 12px */
    --space-4: 1rem;      /* 16px */
    --space-5: 1.25rem;   /* 20px */
    --space-6: 1.5rem;    /* 24px */
    --space-8: 2rem;      /* 32px */
    --space-10: 2.5rem;   /* 40px */
    --space-12: 3rem;     /* 48px */

    /* Typography Scale */
    --text-xs: 0.75rem;    /* 12px */
    --text-sm: 0.875rem;   /* 14px */
    --text-base: 1rem;     /* 16px */
    --text-lg: 1.125rem;   /* 18px */
    --text-xl: 1.25rem;    /* 20px */
    --text-2xl: 1.5rem;    /* 24px */
    --text-3xl: 1.875rem;  /* 30px */
    --text-4xl: 2.25rem;   /* 36px */

    /* Border Radius */
    --radius-sm: 0.25rem;  /* 4px */
    --radius-md: 0.375rem; /* 6px */
    --radius-lg: 0.5rem;   /* 8px */
    --radius-xl: 0.75rem;  /* 12px */
    --radius-2xl: 1rem;    /* 16px */
    --radius-pill: 1.25rem; /* 20px */
    --radius-full: 50%;
    --border-radius: var(--radius-lg); /* Legacy support */

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

    /* Z-Index Scale */
    --z-base: 1;
    --z-dropdown: 1000;
    --z-sticky: 100;
    --z-overlay: 1000;
    --z-modal: 1050;
    --z-popover: 1100;
    --z-tooltip: 1200;
    --z-top: 10000;

    /* Transitions */
    --transition: all 0.2s ease-in-out;
    --transition-fast: all 0.15s ease-in-out;
    --transition-slow: all 0.3s ease-in-out;
}

/* PDF Template Editor Styles */
.modal-large {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    max-width: none !important;
    width: 100vw !important;
    height: 100vh !important;
    margin: 0 !important;
    padding: 10px !important;
    z-index: 1050 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.modal-large .modal-content {
    max-height: calc(100vh - 20px) !important;
    height: calc(100vh - 20px) !important;
    width: calc(100vw - 20px) !important;
    max-width: none !important;
    display: flex;
    flex-direction: column;
    margin: 0 !important;
    border-radius: 8px;
    overflow: hidden;
}

.modal-large .modal-body {
    flex: 1 !important;
    overflow: hidden !important;
    padding: 16px !important;
}

.pdf-template-editor {
    display: flex;
    gap: 20px;
    height: 100%;
    min-height: 0;
    overflow: hidden;
}

.template-editor-sidebar {
    width: 250px;
    flex-shrink: 0;
    background: var(--background);
    border-radius: var(--border-radius);
    padding: 16px;
    overflow-y: auto;
}

.template-editor-sidebar h4 {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    margin-top: 20px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
}

.template-editor-sidebar h4:first-child {
    margin-top: 0;
}

.variable-list {
    margin-bottom: 12px;
}

/* System Variables - Pill-shaped buttons like form fields */
#system-variables {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

#system-variables .variable-item {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 20px;
    margin-bottom: 0;
    cursor: pointer;
    background: var(--background);
    border: 1px solid var(--border);
    transition: var(--transition);
    font-size: 11px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
}

#system-variables .variable-item:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

#system-variables .variable-item strong,
#system-variables .variable-item span {
    display: none; /* Hide the extra content, show only the variable name */
}

/* Form Fields - Pill-shaped buttons */
#form-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

#form-fields .variable-item {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 20px;
    margin-bottom: 0;
    cursor: pointer;
    background: var(--background);
    border: 1px solid var(--border);
    transition: var(--transition);
    font-size: 11px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
}

#form-fields .variable-item:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

#form-fields .variable-item strong,
#form-fields .variable-item span {
    display: none; /* Hide the extra content, show only the field name */
}

/* Subject Variables Dropdown */
.subject-variables-container {
    margin-top: 8px;
}

.subject-variables-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-primary);
    transition: var(--transition);
    width: 100%;
    text-align: left;
}

.subject-variables-toggle:hover {
    background: var(--background);
    border-color: var(--primary-color);
}

.subject-variables-toggle .toggle-arrow {
    transition: transform 0.2s ease;
    font-size: 10px;
}

.subject-variables-toggle.expanded .toggle-arrow {
    transform: rotate(180deg);
}

.subject-variables-dropdown {
    margin-top: 8px;
    padding: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    animation: slideDown 0.2s ease-out;
}

.subject-variables-dropdown.hidden {
    display: none !important;
}

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

.variables-section {
    margin-bottom: 16px;
}

.variables-section:last-child {
    margin-bottom: 0;
}

.variables-section h5 {
    margin: 0 0 8px 0;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.variables-section .variable-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.variables-section .variable-item {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 16px;
    margin-bottom: 0;
    cursor: pointer;
    background: var(--background);
    border: 1px solid var(--border);
    transition: var(--transition);
    font-size: 10px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
}

.variables-section .variable-item:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

/* Template Variables Dropdown (for Categories) */
.template-variables-container {
    margin-top: 8px;
}

.template-variables-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-primary);
    transition: var(--transition);
    width: 100%;
    text-align: left;
}

.template-variables-toggle:hover {
    background: var(--background);
    border-color: var(--primary-color);
}

.template-variables-toggle .toggle-arrow {
    transition: transform 0.2s ease;
    font-size: 10px;
}

.template-variables-toggle.expanded .toggle-arrow {
    transform: rotate(180deg);
}

.template-variables-dropdown {
    margin-top: 8px;
    padding: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    animation: slideDown 0.2s ease-out;
}

.template-variables-dropdown.hidden {
    display: none !important;
}

.no-fields-message {
    padding: 12px;
    text-align: center;
    font-style: italic;
    border: 1px dashed var(--border);
    border-radius: 4px;
    background: var(--surface);
}

.template-actions {
    border-top: 1px solid var(--border);
    padding-top: 16px;
}

/* AI Button Styling */
.ai-button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.ai-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    opacity: 0.9;
}

.ai-button:hover .ai-icon {
    opacity: 1;
}

.template-actions .btn {
    width: 100%;
    margin-bottom: 8px;
}

.template-editor-main {
    flex: 1;
    overflow: hidden;
}

.template-editor-main textarea {
    width: 100%;
    height: 100%;
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    padding: 12px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 12px;
    line-height: 1.4;
    resize: none;
    outline: none;
}

/* Form Section Divider Styles */
.form-section-divider {
    border-top: 2px solid var(--border);
    margin: 24px 0 20px 0;
    padding-top: 20px;
}

.form-section-divider h4 {
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.section-description {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 16px;
}

.form-help {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
    line-height: 1.3;
}

/* Checkbox Label Improvements */
.checkbox-label {
    display: flex;
    align-items: center;
    padding: 6px 0;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-primary);
}

.checkbox-label input[type="checkbox"] {
    margin-right: 8px;
    margin-top: 0;
}

/* TinyMCE Editor Customizations */
.tox-tinymce {
    border: 1px solid var(--border) !important;
    border-radius: var(--border-radius) !important;
}

.tox .tox-toolbar__primary {
    background: var(--background) !important;
    border-bottom: 1px solid var(--border) !important;
}

/* Ensure PDF template modal can be properly hidden */
#pdf-template-modal[style*="display: none"] {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

#pdf-template-modal.hidden {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

body {
    font-family: var(--font-body);
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--background);
    min-height: 100vh;
}

/* Edit Form Properties Modal and all Bootstrap modals - Clean compact layout */
.modal-dialog {
    max-width: 500px !important;
}

/* Target modals containing "Edit Form Properties" or similar forms */
.modal .modal-content,
.modal-content {
    border: 1px solid var(--border) !important;
    border-radius: var(--border-radius) !important;
    box-shadow: var(--shadow-lg) !important;
}

.modal .modal-header,
.modal-header {
    background: var(--surface) !important;
    color: var(--text-primary) !important;
    border-radius: var(--border-radius) var(--border-radius) 0 0 !important;
    padding: 1rem 1.5rem !important;
    border-bottom: 1px solid var(--border) !important;
}

.modal .modal-title,
.modal-title {
    font-size: 1.125rem !important;
    font-weight: 600 !important;
    color: var(--text-primary) !important;
}

.modal .modal-header .close,
.modal .modal-header .btn-close,
.modal-header .close,
.modal-header .btn-close {
    color: var(--text-secondary) !important;
    opacity: 0.7 !important;
    text-shadow: none !important;
    background: none !important;
    border: none !important;
    font-size: 1.5rem !important;
}

.modal .modal-header .close:hover,
.modal .modal-header .btn-close:hover,
.modal-header .close:hover,
.modal-header .btn-close:hover {
    opacity: 1 !important;
    color: var(--text-primary) !important;
}

.modal .modal-body,
.modal-body {
    padding: 1.5rem !important;
}

/* Settings modal - half-width layout */
.retention-modal {
    align-items: flex-start;
    padding-top: 4vh;
}

.retention-modal .modal-content {
    width: 100%;
    max-width: 560px;
    margin: 0 auto;
}

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

/* Compact form layout for all modals */
.modal .form-group,
.modal .mb-3,
.form-group,
.mb-3 {
    margin-bottom: 0.75rem !important;
}

.modal label,
label {
    font-size: 0.875rem !important;
    font-weight: 600 !important;
    color: var(--text-primary) !important;
    margin-bottom: 0.25rem !important;
}

.modal .form-control,
.modal .form-select,
.modal input,
.modal select {
    font-size: 0.9375rem !important;
    padding: 0.5rem 0.75rem !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 6px !important;
    transition: all 0.2s !important;
}

.modal .form-control:focus,
.modal .form-select:focus,
.modal input:focus,
.modal select:focus {
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1) !important;
    outline: none !important;
}

/* Permissions section - more compact */
.modal h6 {
    font-size: 0.875rem !important;
    font-weight: 600 !important;
    color: var(--text-primary) !important;
    margin-top: 0.75rem !important;
    margin-bottom: 0.5rem !important;
}

/* Specific targeting for form properties modal checkbox layout */
#form-properties-modal .checkbox-group {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 0.5rem !important;
    margin-top: 0.5rem !important;
}

#form-properties-modal .checkbox-group .checkbox-label {
    display: flex !important;
    align-items: center !important;
    padding: 0.375rem 0.5rem !important;
    margin: 0 !important;
    cursor: pointer !important;
    border-radius: 4px !important;
    transition: background-color 0.2s !important;
}

#form-properties-modal .checkbox-group .checkbox-label:hover {
    background-color: #f8fafc !important;
}

#form-properties-modal .checkbox-group input[type="checkbox"] {
    width: 1rem !important;
    height: 1rem !important;
    margin: 0 !important;
    margin-right: 0.5rem !important;
    border: 2px solid #e2e8f0 !important;
    cursor: pointer !important;
    flex-shrink: 0 !important;
    border-radius: 3px !important;
}

#form-properties-modal .checkbox-group input[type="checkbox"]:checked {
    background-color: var(--primary-color) !important;
    border-color: var(--primary-color) !important;
}

#form-properties-modal .checkbox-group input[type="checkbox"]:focus {
    outline: 2px solid rgba(37, 99, 235, 0.3) !important;
    outline-offset: 2px !important;
}

/* Make sure the checkbox labels are properly styled */
#form-properties-modal .checkbox-label {
    font-size: 0.875rem !important;
    font-weight: 500 !important;
    color: var(--text-primary) !important;
    user-select: none !important;
    line-height: 1.2 !important;
}

/* Modal footer */
.modal .modal-footer,
.modal-footer {
    border-top: 1px solid var(--border) !important;
    padding: 1rem 1.5rem !important;
    background-color: var(--background) !important;
    border-radius: 0 0 var(--border-radius) var(--border-radius) !important;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Button styling for all modals - match site style */
.modal .btn {
    padding: 0.5rem 1.25rem !important;
    font-size: 0.875rem !important;
    font-weight: 500 !important;
    border-radius: var(--border-radius) !important;
    transition: var(--transition) !important;
    cursor: pointer !important;
}

.modal .btn-secondary {
    background-color: var(--surface) !important;
    border: 1px solid var(--border) !important;
    color: var(--text-secondary) !important;
}

.modal .btn-secondary:hover {
    background-color: var(--background) !important;
    border-color: var(--text-secondary) !important;
    color: var(--text-primary) !important;
}

.modal .btn-primary {
    background-color: var(--primary-color) !important;
    border: 1px solid var(--primary-color) !important;
    color: white !important;
}

.modal .btn-primary:hover {
    background-color: var(--primary-hover) !important;
    border-color: var(--primary-hover) !important;
    transform: none !important;
    box-shadow: var(--shadow) !important;
}

/* General Modal Improvements */
.modal-backdrop {
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal.fade .modal-dialog {
    transition: transform 0.3s ease-out;
    transform: translate(0, -30px);
}

.modal.show .modal-dialog {
    transform: translate(0, 0);
}

/* Ensure modals are centered vertically */
.modal-dialog-centered {
    min-height: calc(100% - 3.5rem);
}

/* Loading Screen */
.loading-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: var(--surface);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border);
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Login Screen */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: url('../images/fb_login_background.png') center center no-repeat;
    background-size: cover;
    padding: 20px;
    position: relative;
}

.login-card {
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    padding: 28px;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3), 0 0 1px rgba(255, 255, 255, 0.5) inset;
    text-align: center;
    max-width: 340px;
    width: 100%;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.logo h1 {
    font-size: 1.75rem;
    margin-bottom: 16px;
    color: var(--text-primary);
    font-weight: 600;
}

.logo p {
    color: var(--text-secondary);
    margin-bottom: 30px;
}

.login-content p {
    margin-bottom: 24px;
    color: var(--text-secondary);
}

.captcha-container {
    margin-top: 16px;
    text-align: left;
}

.captcha-container label {
    display: block;
    font-weight: 500;
    margin-bottom: 6px;
}

.captcha-content {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(17, 24, 39, 0.12);
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 8px;
    font-family: 'Courier New', monospace;
    letter-spacing: 2px;
    font-size: 18px;
    color: var(--text-primary);
}

#captcha-challenge {
    flex: 1;
    user-select: none;
}

#captcha-refresh {
    background: var(--primary-color);
    border: none;
    color: #fff;
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
    transition: var(--transition);
}

#captcha-refresh:hover {
    background: var(--primary-hover);
}

/* Buttons - Unified System */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    border: none;
    border-radius: var(--radius-xl);
    font-size: var(--text-sm);
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    box-shadow: var(--shadow-sm);
}

/* Button Sizes */
.btn-sm,
.btn-small {
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-xs);
    border-radius: var(--radius-md);
    min-height: 36px;
}

.btn-lg {
    padding: var(--space-4) var(--space-8);
    font-size: var(--text-base);
    min-height: 44px;
}

/* Button Variants */
.btn-primary {
    background: var(--primary-color);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(30, 64, 175, 0.25);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.btn-outline {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-outline:hover {
    background: var(--background);
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-success {
    background: var(--success-color);
    color: white;
    border: 1px solid var(--success-color);
}

.btn-success:hover {
    background: #047857;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-warning {
    background: var(--warning-color);
    color: white;
    border: 1px solid var(--warning-color);
}

.btn-warning:hover {
    background: #b45309;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-error,
.btn-danger {
    background: var(--error-color);
    color: white;
    border: 1px solid var(--error-color);
}

.btn-error:hover,
.btn-danger:hover {
    background: #b91c1c;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.btn-full-width {
    width: 100%;
    justify-content: center;
}

/* Button icons (Lucide) */
.btn svg {
    width: 16px;
    height: 16px;
    stroke-width: 2;
    flex-shrink: 0;
}

.google-icon {
    width: 18px;
    height: 18px;
}

/* Email Authentication Styles */
.email-auth-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
}

.email-auth-form .form-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    font-size: 14px;
    transition: var(--transition);
    background: var(--surface);
}

.email-auth-form .form-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.email-auth-form .btn {
    width: 100%;
}

.email-icon {
    width: 20px;
    height: 20px;
}

.forgot-password-link {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 13px;
    margin-top: 4px;
    display: inline-block;
    transition: var(--transition);
}

.forgot-password-link:hover {
    text-decoration: underline;
}

.auth-divider {
    position: relative;
    text-align: center;
    margin: 16px 0;
}

.auth-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border);
}

.auth-divider span {
    position: relative;
    padding: 0 16px;
    background: var(--surface);
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
}

/* Password Strength Indicator */
.password-strength {
    margin-top: 8px;
}

.strength-bar {
    width: 100%;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
}

.strength-fill {
    height: 100%;
    transition: var(--transition);
    border-radius: 2px;
}

.strength-text {
    margin-top: 4px;
    font-size: 12px;
    font-weight: 500;
}

/* Account Lockout Messages */
.lockout-message {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: 12px 16px;
    border-radius: var(--border-radius);
    margin: 16px 0;
    font-size: 14px;
}

.lockout-message .lockout-icon {
    display: inline-block;
    margin-right: 8px;
}

/* User Status Icons */
.user-status {
    display: flex;
    align-items: center;
    gap: 4px;
}

.lock-status, .password-change-status {
    font-size: 14px;
    cursor: help;
}

.btn-warning {
    background: var(--warning-color);
    color: white;
}

.btn-warning:hover {
    background: #b45309;
}

/* Form Improvements */
.form-group label + input[type="password"] {
    margin-top: 8px;
}

.form-group input[type="password"] + label {
    margin-top: 16px;
    margin-bottom: 4px;
}

#password-group {
    padding: 16px;
    background: var(--background);
    border-radius: var(--border-radius);
    border: 1px solid var(--border);
}

#password-group label:first-child {
    margin-top: 0;
}

#password-group .text-muted {
    margin-top: 12px;
    display: block;
    font-style: italic;
}

/* Reset Button States */
#reset-password-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: var(--text-muted) !important;
}

#reset-password-btn:disabled:hover {
    background: var(--text-muted) !important;
}

/* Navigation */
.nav-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
}

.nav-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    height: 64px;
}

.nav-brand h1 {
    font-size: 1.25rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-brand .brand-icon {
    width: 24px;
    height: 24px;
    color: var(--primary-color);
}

.nav-menu {
    display: flex;
    gap: 8px;
}

.nav-item {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.nav-item .nav-icon {
    width: 18px;
    height: 18px;
    stroke-width: 2;
}

.nav-item:hover:not(.active) {
    background: rgba(0, 0, 0, 0.04);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(30, 64, 175, 0.1);
    color: var(--primary-color);
    font-weight: 600;
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 16px;
}

.version-info {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    padding: 4px 8px;
    background: var(--background);
    border-radius: 4px;
    border: 1px solid var(--border);
}

/* Account Dropdown */
.account-dropdown {
    position: relative;
}

.account-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--background);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
}

.account-btn:hover {
    background: var(--surface);
    border-color: var(--primary-color);
}

.account-icon {
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.account-icon-svg {
    width: 20px;
    height: 20px;
    stroke-width: 2;
    color: var(--text-secondary);
}

.account-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 280px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    z-index: var(--z-dropdown);
    overflow: hidden;
}

.account-menu-header {
    padding: 12px 16px;
    background: var(--background);
    border-bottom: 1px solid var(--border);
}

.account-email {
    display: block;
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 4px;
}

.account-menu-divider {
    height: 1px;
    background: var(--border);
}

.account-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    background: none;
    border: none;
    text-align: left;
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
}

.account-menu-item:hover {
    background: var(--background);
    color: var(--primary-color);
}

.menu-item-icon {
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
}

.menu-item-icon svg {
    width: 16px;
    height: 16px;
    stroke-width: 2;
}

.mobile-account-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 0;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.mobile-account-email {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
}

/* Hybrid Editor Tabs Styles */
.editor-tabs {
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 8px;
    margin-bottom: 12px;
}

.editor-tab {
    padding: 8px 16px;
    border: 1px solid var(--border);
    background: var(--background);
    color: var(--text-secondary);
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}

.editor-tab:hover {
    background: var(--surface);
    color: var(--text-primary);
}

.editor-tab.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.visual-edit-controls {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
}

.visual-edit-status {
    font-size: 12px;
    color: var(--text-muted);
    font-style: italic;
}

.editor-content {
    height: calc(100% - 60px);
}

.editor-content.active {
    display: block;
}

.editor-content:not(.active) {
    display: none;
}

/* CodeMirror container styling */
#pdf-code-editor {
    width: 100%;
    height: 100%;
    border: 1px solid var(--border);
    border-radius: 6px;
}

.CodeMirror {
    height: 100% !important;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-family: 'Monaco', 'Consolas', 'Courier New', monospace;
    font-size: 13px;
}

/* Split-pane editor layout */
.editor-split-pane {
    display: flex;
    height: 100%;
    gap: 16px;
}

.editor-pane,
.preview-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0; /* Allow flex shrinking */
}

.pane-header {
    padding: 8px 12px;
    background: var(--background);
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: 6px 6px 0 0;
}

.pane-header h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.pane-content {
    flex: 1;
    border: 1px solid var(--border);
    border-radius: 0 0 6px 6px;
    overflow: hidden;
}

.editor-pane .pane-content textarea {
    width: 100%;
    height: 100%;
    border: none;
    padding: 12px;
    font-family: 'Monaco', 'Consolas', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.4;
    resize: none;
    outline: none;
    background: var(--surface);
    color: var(--text-primary);
}

.preview-pane .pane-content iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
    display: block;
}

/* Mobile responsive for split-pane */
@media (max-width: 768px) {
    .editor-split-pane {
        flex-direction: column;
        gap: 12px;
    }

    .editor-pane,
    .preview-pane {
        height: 300px; /* Fixed height for mobile stacked layout */
    }
}

/* Legacy iframe preview styling (for backwards compatibility) */
#pdf-preview-frame {
    width: 100%;
    height: 100%;
    border: none;
    background: white;
    display: block;
}

#preview-editor-content {
    height: 100%;
    padding: 0;
}

.user-info {
    color: var(--text-secondary);
    font-size: 14px;
}

/* Main Content */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px 20px;
}

.content-section {
    display: none;
}

.content-section.active {
    display: block;
}

.section-header {
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.section-header h2 {
    font-size: 1.875rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.section-header p {
    color: var(--text-secondary);
}

.section-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--surface);
    padding: 24px;
    border-radius: 16px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
}

.stat-icon {
    font-size: 2rem;
    width: 56px;
    height: 56px;
    background: rgba(30, 64, 175, 0.1);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
}

.stat-icon svg {
    width: 28px;
    height: 28px;
    stroke-width: 1.75;
}

.stat-content h3 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.stat-content p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* CAT TV Clickable Icon */
.cat-tv-card .stat-content h3 {
    font-size: 1.4rem;
    margin-bottom: 0;
    line-height: 1.3;
}

.stat-icon.clickable {
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.stat-icon.clickable:hover {
    transform: scale(1.1);
    background: var(--primary-light, #e0e7ff);
}

.stat-icon.clickable:active {
    transform: scale(0.95);
}

.stat-icon.syncing {
    animation: spin 1s linear infinite;
}

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

/* Activity Preview */
.activity-preview {
    background: var(--surface);
    padding: 24px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.activity-preview h3 {
    margin-bottom: 16px;
    font-size: 1.25rem;
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.activity-item {
    padding: 12px;
    background: var(--background);
    border-radius: var(--border-radius);
    font-size: 14px;
}

.activity-item.loading {
    text-align: center;
    color: var(--text-muted);
}

.view-all-link {
    display: inline-block;
    margin-top: 16px;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.view-all-link:hover {
    text-decoration: underline;
}

/* Filters Bar */
.filters-bar {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-input,
.filter-select {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    font-size: 14px;
    background: var(--surface);
    color: var(--text-primary);
    min-width: 200px;
}

.search-input:focus,
.filter-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgb(37 99 235 / 0.1);
}

/* Tables */
.table-container {
    background: var(--surface);
    border-radius: var(--border-radius);
    overflow: visible;
    box-shadow: var(--shadow);
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.data-table th {
    background: var(--background);
    padding: 16px;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    overflow: visible;
    position: relative;
}

.data-table tbody tr:hover {
    background: var(--background);
}

.loading-row {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
}

/* Compress user table spacing on larger screens */
#users-table th,
#users-table td {
    padding: 12px 10px;
}

/* Action Buttons in Tables */
.action-buttons {
    display: flex;
    gap: 8px;
}

/* Ensure actions column allows overflow for dropdowns */
.data-table td:last-child {
    overflow: visible;
    position: relative;
}

/* Row Actions Dropdown */
.row-actions-dropdown {
    position: relative;
    display: inline-block;
}

.row-actions-btn {
    min-width: 44px;
    min-height: 44px;
    padding: var(--space-1) var(--space-2) !important;
    font-size: 18px;
    line-height: 1;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.row-actions-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 180px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    z-index: var(--z-dropdown);
    overflow: hidden;
}

.row-actions-dropdown.active .row-actions-menu {
    display: block;
}

.row-actions-menu-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    width: 100%;
    padding: var(--space-4) var(--space-4);
    background: none;
    border: none;
    text-align: left;
    font-size: var(--text-sm);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
}

.row-actions-menu-item:hover {
    background: var(--background);
    color: var(--primary-color);
}

.row-actions-menu-item.danger {
    color: var(--error-color);
}

.row-actions-menu-item.danger:hover {
    background: var(--status-inactive-bg);
    color: var(--error-color);
}

.menu-divider {
    height: 1px;
    background: var(--border);
    margin: var(--space-1) 0;
}

.row-actions-menu-item .menu-item-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

/* Removed - consolidated below */

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal.active {
    display: flex !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: -1;
}

.modal-container {
    position: relative;
    z-index: 1;
    background: var(--surface);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    max-width: 90vw;
    max-height: 90vh;
    overflow: auto;
}

.modal-content {
    background: var(--surface);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow: auto;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-secondary);
    line-height: 1;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
    padding: 0 20px 12px 20px;
}

.modal-actions.sticky-footer {
    position: sticky;
    bottom: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    margin-top: 0;
    padding: 0.75rem 1.5rem !important;
    z-index: 2;
}

.sticky-footer {
    position: sticky;
    bottom: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 0.75rem 1.5rem !important;
    z-index: 2;
}

/* Row Actions Modal - Compact centered menu */
.row-actions-modal .modal-content {
    max-width: 300px;
    padding: 0;
}

/* Desktop: Position modal 20% from right instead of centered */
@media (min-width: 768px) {
    .row-actions-modal {
        justify-content: flex-end;
        padding-right: 20%;
    }
}

.row-actions-modal .modal-body {
    padding: 8px;
}

.row-actions-modal-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    width: 100%;
    padding: var(--space-3) var(--space-4);
    background: none;
    border: none;
    text-align: left;
    font-size: var(--text-sm);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
    border-radius: var(--radius-md);
}

.row-actions-modal-item:hover {
    background: var(--background);
    color: var(--primary-color);
}

.row-actions-modal-item.danger {
    color: #dc2626;
}

/* ====================
   STANDARDIZED MODAL SYSTEM
   ==================== */

/* Modal Size Variants */
.modal-sm .modal-content {
    max-width: 500px;
}

.modal-md .modal-content {
    max-width: 700px;
}

.modal-lg .modal-content {
    max-width: 900px;
}

.modal-xl .modal-content {
    max-width: 90vw;
}

.modal-fullscreen .modal-content {
    max-width: 100vw;
    width: 100vw;
    height: 100vh;
    margin: 0;
    border-radius: 0;
}

/* ====================
   OFFLINE BANNER
   ==================== */

/* Full-width warning banner displayed when offline */
.offline-banner {
    position: sticky;
    top: 64px; /* Below header */
    left: 0;
    right: 0;
    background-color: #f59e0b; /* Amber/warning color */
    color: #78350f; /* Dark amber text */
    padding: var(--space-3) var(--space-4);
    z-index: 90; /* Below modals, above content */
    box-shadow: var(--shadow-sm);
    animation: slideDown 0.3s ease-out;
}

.offline-banner-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    font-weight: 500;
}

.offline-icon {
    font-size: var(--text-lg);
    display: flex;
    align-items: center;
}

.offline-icon svg {
    width: 20px;
    height: 20px;
    stroke-width: 2;
}

.offline-message {
    text-align: center;
}

/* Slide-up animation for hiding banner */
@keyframes slideUp {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(-100%);
        opacity: 0;
    }
}

/* Mobile responsive */
@media (max-width: 768px) {
    .offline-banner {
        top: 60px; /* Mobile header height */
        padding: var(--space-2) var(--space-3);
    }

    .offline-banner-content {
        font-size: var(--text-xs);
        flex-direction: column;
        gap: var(--space-1);
    }
}

/* Ensure all modals have consistent overlay styling */
.modal .modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: -1;
    opacity: 0;
    transition: opacity 150ms ease-in-out;
}

.modal.active .modal-overlay {
    opacity: 1;
}

/* Modal Content Animation */
.modal .modal-content {
    transform: scale(0.9);
    opacity: 0;
    transition: transform 200ms cubic-bezier(0.34, 1.56, 0.64, 1), opacity 200ms ease-out;
}

.modal.active .modal-content {
    transform: scale(1);
    opacity: 1;
}

/* Standardize Footer Styling */
.modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding: 0.75rem 1.5rem;
    margin: 0;
}

.modal-footer.sticky-footer {
    position: sticky;
    bottom: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    z-index: 2;
}

/* Ensure modal content has proper border */
.modal .modal-content {
    border: 1px solid var(--border);
}

/* Mobile Responsiveness for Modals */
@media (max-width: 768px) {
    .modal-sm .modal-content,
    .modal-md .modal-content,
    .modal-lg .modal-content {
        max-width: calc(100vw - 40px);
    }

    .modal-xl .modal-content {
        max-width: calc(100vw - 20px);
    }

    .modal {
        padding: 10px;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 1rem;
    }
}

.row-actions-modal-item.danger:hover {
    background: #fef2f2;
    color: #b91c1c;
}

.row-actions-modal-item .menu-item-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.row-actions-modal-divider {
    height: 1px;
    background: var(--border);
    margin: var(--space-2) 0;
}

/* Template Update Confirmation Modal - Fix button spacing */
.template-update-confirm-modal .modal-actions {
    margin-bottom: 20px;
    padding-right: 20px;
}

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

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    font-size: 14px;
    background: var(--surface);
    color: var(--text-primary);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgb(37 99 235 / 0.1);
}

/* Checkbox Label Alignment */
.form-group label[for="user-authorised"],
.form-group label[for="user-admin"],
.form-group label[for="user-type-b"] {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 500;
}

.form-group label[for="user-authorised"] input[type="checkbox"],
.form-group label[for="user-admin"] input[type="checkbox"],
.form-group label[for="user-type-b"] input[type="checkbox"],
.form-group label[for="data-list-active"] input[type="checkbox"] {
    width: auto;
    margin: 0;
    margin-right: 0.5rem;
    cursor: pointer;
}

.twofa-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.twofa-actions .status-badge {
    margin: 0;
}

#delegated-password-modal .modal-content {
    max-width: 400px;
    padding-bottom: 20px;
}

#delegated-password-modal .form-input {
    width: 100%;
}

#delegated-password-modal .password-input-wrapper {
    display: flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    background: var(--surface);
    padding-right: 8px;
}

#delegated-password-modal .password-input-wrapper input {
    border: none;
    box-shadow: none;
    flex: 1;
    padding: 10px 12px;
    background: transparent;
}

#delegated-password-modal .password-input-wrapper input:focus {
    outline: none;
}

#delegated-password-modal .password-toggle-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: var(--text-secondary);
    padding: 6px;
}

#delegated-password-modal .password-toggle-btn:hover {
    color: var(--text-primary);
}

#delegated-2fa-modal .modal-content,
#delegated-password-modal .modal-content,
#totp-enroll-modal .modal-content {
    max-width: 520px;
}

#delegated-2fa-modal .modal-body,
#totp-enroll-modal .modal-body {
    max-height: 70vh;
    overflow-y: auto;
    padding-bottom: 80px;
}


#totp-enroll-modal .modal-actions,
#totp-enroll-modal .totp-modal-actions,
#delegated-2fa-modal .modal-actions,
#delegated-2fa-modal .delegated-modal-actions,
#delegated-password-modal .modal-actions {
    padding: 16px 24px 24px;
    gap: 12px;
    justify-content: flex-end;
}

#delegated-password-modal .modal-actions {
    gap: 12px;
}

/* Placeholder Content */
.placeholder-content {
    background: var(--surface);
    padding: 40px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    text-align: center;
}

.placeholder-content p {
    color: var(--text-muted);
    font-size: 16px;
}

/* Mobile Navigation Styles */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    border-radius: 4px;
    transition: var(--transition);
}

.mobile-menu-btn:hover {
    background: var(--background);
}

.hamburger-line {
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    transition: var(--transition);
}

.mobile-menu-btn.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-btn.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.mobile-menu-btn.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

.mobile-nav {
    position: fixed;
    top: 0;
    left: -300px;
    width: 300px;
    height: 100vh;
    background: var(--surface);
    box-shadow: var(--shadow-lg);
    z-index: var(--z-popover);
    transition: left 0.3s ease-in-out;
    overflow-y: auto;
}

.mobile-nav.active {
    left: 0;
}

.mobile-nav-content {
    padding: 20px;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.mobile-nav-user {
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 20px;
}

.mobile-user-info {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.mobile-nav-menu {
    flex: 1;
}

.mobile-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 0;
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
}

.mobile-nav-item:hover,
.mobile-nav-item.active {
    color: var(--primary-color);
}

.mobile-nav-icon {
    font-size: 20px;
    width: 24px;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-nav-icon svg {
    width: 20px;
    height: 20px;
    stroke-width: 2;
}

.mobile-nav-footer {
    margin-top: auto;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.mobile-nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: var(--z-overlay);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease-in-out;
}

.mobile-nav-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.btn-full-width {
    width: 100%;
    justify-content: center;
}

/* Hide desktop navigation on mobile */
.desktop-nav {
    display: flex;
}

/* Table Responsiveness */
.table-responsive {
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
}

.table-responsive::-webkit-scrollbar {
    height: 8px;
}

.table-responsive::-webkit-scrollbar-track {
    background: var(--background);
}

.table-responsive::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

/* Enhanced Mobile Styles */

/* Tablet tweaks (portrait iPad widths) */
@media (max-width: 1100px) {
    .nav-content,
    .main-content {
        max-width: 1100px;
        padding: 12px 16px;
    }

    .nav-brand h1 {
        font-size: 1.1rem;
    }

    .nav-menu {
        gap: 20px;
    }

    .desktop-nav {
        display: none;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .nav-user {
        gap: 12px;
    }

    .section-actions {
        flex-wrap: wrap;
    }
}

/* Extra small devices (phones, 576px and down) */
@media (max-width: 576px) {
    .main-content {
        padding: 16px 12px;
    }

    .section-header h2 {
        font-size: 1.5rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .stat-card {
        padding: 16px;
        flex-direction: column;
        text-align: center;
        gap: 12px;
    }

    .stat-icon {
        width: 48px;
        height: 48px;
        font-size: 1.5rem;
    }

    .filters-bar {
        gap: 12px;
    }

    .search-input,
    .filter-select {
        font-size: 16px; /* Prevents zoom on iOS */
        min-width: 0;
    }

    .btn {
        padding: 14px 16px;
        font-size: 16px;
        min-height: 44px; /* Touch target size */
    }

    .btn-small {
        padding: 8px 12px;
        font-size: 14px;
        min-height: 36px;
    }

    .data-table {
        font-size: 13px;
    }

    .data-table th,
    .data-table td {
        padding: 8px 6px;
        white-space: nowrap;
    }

    .modal-content {
        margin: 10px;
        max-height: calc(100vh - 20px);
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 12px;
        min-height: 44px;
    }
}

/* Small devices (landscape phones, 576px and up) */
@media (min-width: 576px) and (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .section-actions {
        display: flex;
        gap: 12px;
        flex-wrap: wrap;
    }

    .filters-bar {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
}

/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) and (max-width: 992px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .filters-bar {
        display: flex;
        flex-wrap: wrap;
        gap: 16px;
    }

    .search-input,
    .filter-select {
        flex: 1;
        min-width: 200px;
    }
}

/* Mobile-specific responsive design */
@media (max-width: 768px) {
    /* Navigation */
    .nav-content {
        justify-content: space-between;
        padding: 12px 16px;
        height: 60px;
    }

    .nav-brand h1 {
        font-size: 1.1rem;
    }

    .desktop-nav {
        display: none;
    }

    .mobile-menu-btn {
        display: flex;
    }

    /* Main content adjustments */
    .main-content {
        padding-top: 16px;
    }

    .section-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .section-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .filters-bar {
        flex-direction: column;
        gap: 12px;
    }

    .search-input,
    .filter-select {
        width: 100%;
        min-width: 0;
    }

    /* Table improvements */
    .table-container {
        margin: 0 -16px;
        border-radius: 0;
    }

    .table-responsive {
        padding: 0 16px;
    }

    .data-table {
        font-size: 14px;
        min-width: 600px; /* Force horizontal scroll for wide tables */
    }

    .data-table th,
    .data-table td {
        padding: 10px 8px;
        min-width: 100px;
    }

    .data-table th:first-child,
    .data-table td:first-child {
        position: sticky;
        left: 0;
        background: var(--surface);
        z-index: 1;
        box-shadow: 2px 0 4px rgba(0, 0, 0, 0.1);
    }

    .data-table th {
        background: var(--background);
    }

    /* Action buttons in tables */
    .action-buttons {
        flex-direction: column;
        gap: 4px;
        min-width: 80px;
    }

    .action-buttons .btn-small {
        font-size: 11px;
        padding: 6px 8px;
        white-space: nowrap;
    }

    /* Pagination */
    .pagination-controls {
        flex-direction: column;
        gap: 16px;
        align-items: center;
        padding: 16px;
    }

    .pagination-buttons {
        flex-wrap: wrap;
        justify-content: center;
    }

    .page-number {
        min-width: 40px;
        min-height: 40px;
    }

    /* Modal improvements */
    .modal {
        padding: 8px;
        align-items: flex-start;
        padding-top: 20px;
    }

    .modal-content {
        width: 100%;
        max-width: none;
        max-height: calc(100vh - 40px);
        margin: 0;
    }

    .modal-header {
        padding: 16px;
    }

    .modal-body {
        padding: 16px;
    }

    .modal-actions {
        flex-direction: column-reverse;
        gap: 8px;
    }

    .modal-actions .btn {
        width: 100%;
    }

    /* Activity preview */
    .activity-preview {
        margin: 0 -16px;
        border-radius: 0;
    }

    .activity-item {
        padding: 12px 16px;
    }
}

/* Large mobile devices and small tablets */
@media (min-width: 576px) and (max-width: 768px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .modal-actions {
        flex-direction: row;
    }

    .modal-actions .btn {
        width: auto;
        flex: 1;
    }
}

/* Touch device improvements */
@media (hover: none) and (pointer: coarse) {
    .btn {
        min-height: 44px;
    }

    .btn-small {
        min-height: 36px;
    }

    .nav-item {
        padding: 12px 0;
    }

    .mobile-nav-item {
        padding: 20px 0;
    }
}

/* Utility Classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.mb-16 { margin-bottom: 16px; }
.mt-16 { margin-top: 16px; }
.hidden { display: none !important; }

/* Modal force hide - specifically for modals that need to override other !important declarations */
.modal-force-hide {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}
.flex { display: flex; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-16 { gap: 16px; }

/* Status and Badge Styles */
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 0.375rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.badge-primary { background: #dbeafe; color: #1e40af; }
.badge-secondary { background: #f1f5f9; color: #475569; }
.badge-success { background: #dcfce7; color: #166534; }
.badge-danger { background: #fecaca; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-info { background: #e0f2fe; color: #0369a1; }

/* Unified Status Badge System */
.status-badge {
    display: inline-block;
    padding: var(--space-1) var(--space-2);
    font-size: var(--text-xs);
    font-weight: 500;
    border-radius: var(--radius-xl);
    text-transform: capitalize;
}

.status-active { background: #dcfce7; color: #166534; }
.status-recent { background: #fef3c7; color: #92400e; }
.status-inactive { background: #f1f5f9; color: #475569; }
.status-enabled { background: #dcfce7; color: #166534; }
.status-disabled { background: #fecaca; color: #991b1b; }

.status-badge-toggle {
    border: none;
    background: transparent;
    padding: var(--space-1) var(--space-2);
    cursor: pointer;
    outline: none;
}

.status-badge-toggle.active {
    background: var(--status-active-bg);
    color: var(--status-active-text);
}

.status-badge-toggle.inactive {
    background: var(--status-inactive-bg);
    color: var(--status-inactive-text);
}
.status-pending { background: #fef3c7; color: #92400e; }
.status-delivered { background: #dcfce7; color: #166534; }
.status-sent { background: #e0f2fe; color: #0369a1; }
.status-failed { background: #fecaca; color: #991b1b; }

/* Activity Items */
.activity-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.activity-details {
    flex: 1;
}

.details-inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.activity-text {
    font-size: 0.875rem;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.activity-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.activity-item.loading {
    justify-content: center;
    color: var(--text-muted);
    font-style: italic;
}

.activity-item.error {
    color: var(--error-color);
}

/* Device and User Info Styles */
.user-info, .device-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.user-name, .device-name {
    font-weight: 500;
    color: var(--text-primary);
}

.user-email, .device-model {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.token-cell {
    font-family: monospace;
    font-size: 0.75rem;
    color: var(--text-secondary);
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.message-content {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: help;
}

/* Loading and Error States */
.loading-row, .error-row, .empty-row {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-style: italic;
}

.error-row {
    color: var(--error-color);
}

/* Pagination Styles */
.table-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0.75rem 0;
}

.entries-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.entries-select {
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    background: var(--surface);
    font-size: 0.875rem;
}

.pagination-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 1rem;
    padding: 1rem 0;
    border-top: 1px solid var(--border);
}

.pagination-info {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.pagination-buttons {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.page-numbers {
    display: flex;
    gap: 0.25rem;
}

.page-number {
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    background: var(--surface);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.875rem;
    text-decoration: none;
    transition: var(--transition);
}

.page-number:hover {
    background: var(--background);
    border-color: var(--primary-color);
}

.page-number.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.page-number.active:hover {
    background: var(--primary-hover);
}

/* Removed - consolidated in main button system above */

/* Load More Button Styles (kept for backward compatibility) */
.load-more-btn {
    margin-top: 1rem;
    width: 100%;
    padding: 0.75rem;
    font-size: 0.875rem;
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    background: var(--surface);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
}

.load-more-btn:hover:not(:disabled) {
    background: var(--background);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.load-more-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.load-more-btn:disabled:hover {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text-primary);
}

/* Mobile responsive updates for new components */
@media (max-width: 768px) {
    .message-content {
        max-width: 120px;
    }

    .token-cell {
        max-width: 80px;
    }

    .user-info, .device-info {
        gap: 0.125rem;
    }
    
    .activity-item {
        padding: 0.5rem;
        gap: 0.5rem;
    }
    
    .activity-icon {
        font-size: 1rem;
    }
    
    .load-more-btn {
        padding: 0.625rem;
        font-size: 0.8rem;
    }
}

/* Tablet refinements for text columns */
@media (min-width: 768px) and (max-width: 1100px) {
    .message-content {
        max-width: 280px;
        white-space: normal;
    }

    .token-cell {
        max-width: 200px;
    }
}

/* Unified Checkbox System */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    margin-top: var(--space-2);
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
    padding: var(--space-2);
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.checkbox-item:hover {
    background: var(--background);
}

.checkbox-item input[type="checkbox"],
.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary-color);
    cursor: pointer;
}

.checkmark {
    opacity: 0;
    transition: var(--transition);
    color: var(--primary-color);
    font-weight: bold;
}

.checkbox-item input[type="checkbox"]:checked + .checkmark {
    opacity: 1;
}

.category-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
}

.category-hr {
    background: var(--category-hr-bg);
    color: var(--category-hr-text);
}

.category-admin {
    background: var(--category-admin-bg);
    color: var(--category-admin-text);
}

.category-dispatch {
    background: var(--category-dispatch-bg);
    color: var(--category-dispatch-text);
}

.permissions-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.permission-badge {
    display: inline-block;
    padding: 0.125rem 0.375rem;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Removed - using unified status badge system above */

.status-badge.active {
    background: var(--status-active-bg);
    color: var(--status-active-text);
}

.status-badge.inactive {
    background: var(--status-inactive-bg);
    color: var(--status-inactive-text);
}

.categories-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
}

.category-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    background: var(--surface);
}

.category-info h4 {
    margin: 0 0 0.25rem 0;
    color: var(--text-primary);
}

.category-info p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.form-builder-modal .modal-content {
    max-width: 90vw;
    max-height: 90vh;
    width: 1200px;
    height: 800px;
}

.form-builder-modal .modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.builder-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.no-data {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-style: italic;
}

.action-buttons {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
}

/* Removed - consolidated in main button system above */

@media (max-width: 768px) {
    .form-builder-modal .modal-content {
        max-width: 95vw;
        max-height: 95vh;
        width: auto;
        height: auto;
    }

    .checkbox-group {
        max-height: 200px;
        overflow-y: auto;
    }
    
    .category-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .permissions-list {
        max-width: 150px;
    }
    
    .action-buttons {
        flex-direction: column;
        width: 100%;
    }
    
    .action-buttons .btn {
        width: 100%;
        justify-content: center;
    }
}

/* Inline Form Builder Styles */
.builder-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
}

.builder-title {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.builder-title h2 {
    margin: 0;
    color: var(--text-primary);
}

.builder-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.builder-container {
    min-height: 600px;
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    background: var(--surface);
}

#form-builder-container {
    height: 600px;
    width: 100%;
}

/* Back button with icon */
#back-to-forms {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#back-to-forms svg {
    width: 16px;
    height: 16px;
}

/* Builder loading and error states */
.builder-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 400px;
    font-size: 1.1rem;
    color: var(--text-secondary);
}

.builder-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 400px;
    padding: 2rem;
    text-align: center;
}

.builder-error h3 {
    color: var(--error-color);
    margin-bottom: 1rem;
}

.builder-error p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
    .builder-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .builder-title {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .builder-actions {
        width: 100%;
        justify-content: flex-end;
    }
    
    #form-builder-container {
        height: 500px;
    }
}

/* Removed - using unified checkbox system above */

.checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    cursor: pointer;
    padding: var(--space-1) 0;
}

.checkbox-label:hover {
    color: var(--primary-color);
}

/* Category Actions Styles */
.category-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.category-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    margin-bottom: 0.5rem;
    background: var(--surface);
}

.category-item.clickable {
    cursor: pointer;
    transition: all 0.2s ease;
}

.category-item.clickable:hover {
    border-color: var(--primary-color);
    background: var(--background);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.category-item:hover {
    border-color: var(--primary-color);
    background: var(--background);
}

.category-info h4 {
    margin: 0 0 0.25rem 0;
    color: var(--text-primary);
}

.category-info p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Form Properties Modal Specific Styles */
#form-properties-modal .form-group {
    margin-bottom: 1.5rem;
}

#form-properties-modal label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

#form-properties-modal input,
#form-properties-modal select,
#form-properties-modal textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    transition: var(--transition);
}

#form-properties-modal input:focus,
#form-properties-modal select:focus,
#form-properties-modal textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgb(37 99 235 / 0.1);
}

/* Category Edit Modal Specific Styles */
#category-edit-modal .form-group {
    margin-bottom: 1.5rem;
}

#category-edit-modal label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

#category-edit-modal input,
#category-edit-modal textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    transition: var(--transition);
}

#category-edit-modal input:focus,
#category-edit-modal textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgb(37 99 235 / 0.1);
}

/* AI Model Selection Dropdown */
.ai-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
    padding: 16px;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
}

.model-selection {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.model-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.model-dropdown {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    background: var(--surface);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
}

.model-dropdown:hover {
    border-color: var(--primary-color);
}

.model-dropdown:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgb(37 99 235 / 0.1);
}

.ai-button {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
}

.ai-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.ai-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.ai-icon {
    width: 16px;
    height: 16px;
    filter: brightness(0) invert(1);
}

/* PDF Print Styles */
@media print {
    body {
        font-family: Arial, Helvetica, sans-serif;
        font-size: 12pt;
        line-height: 1.4;
        color: black;
        margin: 0;
        padding: 20px;
    }
    
    * {
        box-sizing: border-box;
    }
    
    .pdf-header {
        font-size: 18pt;
        font-weight: bold;
        margin-bottom: 20px;
        text-align: center;
        border-bottom: 2px solid #333;
        padding-bottom: 10px;
    }
    
    .pdf-meta {
        font-size: 10pt;
        color: #666;
        margin-bottom: 5px;
    }
    
    .pdf-field {
        margin: 10px 0;
        page-break-inside: avoid;
    }
    
    .pdf-field-label {
        font-weight: bold;
        font-size: 11pt;
        color: #333;
        margin-bottom: 3px;
    }
    
    .pdf-field-value {
        font-size: 10pt;
        padding: 5px;
        border-bottom: 1px solid #ddd;
        min-height: 20px;
    }
    
    table {
        border-collapse: collapse;
        width: 100%;
        margin: 10px 0;
        page-break-inside: avoid;
    }
    
    table, th, td {
        border: 1px solid #333;
    }
    
    th, td {
        padding: 8px;
        text-align: left;
        font-size: 10pt;
    }
    
    th {
        background-color: #f5f5f5;
        font-weight: bold;
    }
    
    /* Page break controls */
    .page-break {
        page-break-before: always;
    }
    
    .no-break {
        page-break-inside: avoid;
    }
    
    /* Hide elements that shouldn't print */
    .no-print,
    button,
    input[type="button"],
    input[type="submit"],
    .btn {
        display: none !important;
    }
}

/* Template Selection Styles */
.template-selection {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border);
}

.template-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 5px;
}

.template-dropdown {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    background: var(--surface);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
}

.template-dropdown:hover {
    border-color: var(--primary-color);
}

.template-dropdown:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgb(37 99 235 / 0.1);
}

/* ===============================
   2FA / TOTP Styles
   =============================== */

/* Security Status Indicator */
.security-status {
    display: inline-block;
    margin-top: 4px;
    font-size: 12px;
    font-weight: 500;
}

.status-enabled {
    color: var(--success-color);
}

.status-disabled {
    color: var(--warning-color);
}

/* 2FA Enrollment Modal */
.totp-enroll-content {
    max-width: 600px;
    width: 90vw;
}

.totp-setup-steps {
    margin-bottom: 30px;
}

.setup-step {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.setup-step:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.setup-step h4 {
    color: var(--text-primary);
    margin-bottom: 12px;
    font-size: 16px;
    font-weight: 600;
}

.setup-step p {
    color: var(--text-secondary);
    margin-bottom: 15px;
    line-height: 1.5;
}

.app-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.app-list li {
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    padding: 8px 12px;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
}

/* QR Code Container */
.qr-code-container {
    display: flex;
    justify-content: center;
    margin: 20px 0;
}

.qr-code {
    max-width: 200px;
    background: white;
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.manual-entry {
    text-align: center;
    margin-top: 20px;
}

.manual-entry p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 8px;
}

.secret-key {
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    padding: 8px 12px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 14px;
    color: var(--text-primary);
    word-break: break-all;
    display: inline-block;
    max-width: 100%;
}

/* TOTP Input */
.totp-input {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace !important;
    font-weight: 600;
    border: 2px solid var(--border) !important;
}

.totp-input:focus {
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 3px rgb(37 99 235 / 0.1) !important;
}

/* 2FA Verification Modal */
.backup-code-option {
    text-align: center;
    margin-top: 15px;
}

.link-button {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
}

.link-button:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

/* Backup Codes Modal */
.backup-codes-warning {
    background: #fef3c7;
    border: 1px solid #f59e0b;
    border-radius: var(--border-radius);
    padding: 15px;
    margin-bottom: 20px;
}

.backup-codes-warning p {
    color: #92400e;
    margin: 0;
    font-size: 14px;
}

.backup-codes-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin: 20px 0;
    padding: 20px;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
}

.backup-code {
    background: white;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 8px 12px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 14px;
    color: var(--text-primary);
    text-align: center;
    font-weight: 600;
    letter-spacing: 1px;
}

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

/* User Management 2FA Status */
.user-2fa-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 500;
    padding: 3px 8px;
    border-radius: 12px;
}

.user-2fa-enabled {
    background: var(--status-active-bg);
    color: var(--success-color);
    border: 1px solid var(--status-active-text);
}

.user-2fa-disabled {
    background: var(--status-warning-bg);
    color: var(--warning-color);
    border: 1px solid var(--status-warning-text);
}

/* Mobile 2FA Styles */
@media (max-width: 768px) {
    .security-status {
        display: block;
        margin: 5px 0;
        font-size: 11px;
    }

    .totp-enroll-content {
        width: 95vw;
        max-width: none;
    }

    .backup-codes-list {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .backup-codes-actions {
        flex-direction: column;
    }
    
    .backup-codes-actions .btn {
        width: 100%;
    }
    
    .app-list li {
        text-align: center;
    }
    
    .qr-code {
        max-width: 180px;
        padding: 15px;
    }
    
    .secret-key {
        font-size: 12px;
        padding: 6px 8px;
    }
}

/* Animation for 2FA Status Changes */
.status-enabled,
.status-disabled {
    transition: all 0.3s ease-in-out;
}

.adsb-status {
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: var(--border-radius);
    font-size: 0.875rem;
    display: block;
    background: rgba(37, 99, 235, 0.08);
    color: var(--text-primary);
}

.adsb-status[hidden] {
    display: none !important;
}

.adsb-status-success {
    background: rgba(5, 150, 105, 0.12);
    color: var(--success-color);
}

.adsb-status-error {
    background: rgba(220, 38, 38, 0.12);
    color: var(--error-color);
}

.adsb-status-info {
    background: rgba(37, 99, 235, 0.12);
    color: var(--primary-color);
}

.adsb-map-link {
    margin-left: 8px;
    text-decoration: none;
    font-size: 1.1rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
}

.adsb-map-link:hover {
    color: var(--primary-color);
}

.adsb-status-cell {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.adsb-status-note {
    color: var(--text-secondary);
    font-size: 0.75rem;
}

.mono {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9em;
}

/* Auth Method Icons */
.auth-method-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.auth-icon {
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
}

.google-icon {
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

.email-icon {
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

.tfa-icon {
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.15));
}

.auth-method-both-inner {
    display: flex;
    align-items: center;
    position: relative;
    padding-left: 8px;
}

.auth-method-both-inner .auth-icon:first-child {
    position: relative;
    z-index: 2;
}

.auth-method-both-inner .auth-icon:last-child {
    position: relative;
    margin-left: -8px;
    z-index: 1;
}

/* 2FA Status in Account Dropdown */
.status-2fa-enabled {
    color: var(--success-color);
    font-weight: 500;
    font-size: 14px;
    display: flex;
    align-items: center;
}

.status-2fa-disabled {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 14px;
}

/* Enhanced Modal Styles for 2FA */
.modal-content .setup-step:first-child {
    margin-top: 0;
}

.modal-content .setup-step:last-child {
    margin-bottom: 0;
}

/* Print Styles for Backup Codes */
@media print {
    .backup-codes-modal * {
        color: black !important;
        background: white !important;
    }
    
    .backup-codes-list {
        border: 1px solid black;
    }
    
    .backup-code {
        border: 1px solid black;
    }
    
    .modal-header,
    .modal-actions,
    .backup-codes-actions {
        display: none !important;
    }
}

/* ============================================================================
   AI CODE HELPER - Form.io JavaScript Generator
   ============================================================================ */

.ai-code-helper-modal .modal-content {
    max-width: 1400px;
    width: 95vw;
    height: 85vh;
    display: flex;
    flex-direction: column;
}

.code-helper-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ai-code-helper-container {
    display: flex;
    gap: 24px;
    flex: 1;
    overflow: hidden;
}

/* Left Panel - Prompt Input */
.ai-code-helper-left {
    flex: 0 0 50%;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
    padding-right: 16px;
}

/* Right Panel - Field Names Reference */
.ai-code-helper-right {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--border-color, #e5e7eb);
    padding-left: 24px;
    overflow: hidden;
    min-height: 0;
}

/* Code Type Selector (Dropdown) */
.code-type-selection {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
    margin-bottom: 16px;
}

.code-type-label {
    font-weight: 500;
    font-size: 14px;
    color: var(--text-primary, #111827);
}

.code-type-dropdown {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 6px;
    font-size: 14px;
    background: white;
    color: var(--text-primary, #111827);
    cursor: pointer;
}

.code-type-dropdown:focus {
    outline: none;
    border-color: var(--primary-color, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Example Prompts Section */
.example-prompts-section {
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 6px;
    overflow: hidden;
}

.example-prompts-toggle {
    width: 100%;
    padding: 10px 12px;
    background: var(--background-secondary, #f9fafb);
    border: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-primary, #111827);
    transition: background 0.2s ease;
}

.example-prompts-toggle:hover {
    background: var(--background-hover, #f3f4f6);
}

.example-prompts-toggle .toggle-arrow {
    color: var(--text-secondary, #6b7280);
    font-size: 12px;
    transition: transform 0.2s ease;
}

.example-prompts-content {
    padding: 12px;
    background: white;
}

.example-prompts-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.example-prompt-item {
    padding: 8px 12px;
    border-radius: 4px;
    background: var(--background-secondary, #f9fafb);
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary, #6b7280);
    transition: all 0.2s ease;
}

.example-prompt-item:hover {
    background: var(--primary-light, #dbeafe);
    color: var(--primary-color, #2563eb);
}

/* Prompt Input Section */
.prompt-input-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.prompt-label {
    font-weight: 500;
    font-size: 14px;
    color: var(--text-primary, #111827);
}

.prompt-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 6px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
    min-height: 120px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.prompt-textarea:focus {
    outline: none;
    border-color: var(--primary-color, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Element Picker Section */
.element-picker-section {
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 6px;
    overflow: hidden;
}

/* Element Picker - Full Height (Right Panel) */
.element-picker-full-height {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    margin-bottom: 16px;
}

.element-picker-full-height .element-picker-dropdown {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.element-picker-full-height .element-picker-list {
    flex: 1;
    max-height: none;
    overflow-y: auto;
    min-height: 0;
}

/* Scrollbar styling for element picker list */
.element-picker-list::-webkit-scrollbar {
    width: 8px;
}

.element-picker-list::-webkit-scrollbar-track {
    background: var(--background, #f9fafb);
}

.element-picker-list::-webkit-scrollbar-thumb {
    background: var(--border-color, #d1d5db);
    border-radius: 4px;
}

.element-picker-list::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

.element-picker-toggle {
    width: 100%;
    padding: 10px 12px;
    background: var(--background-secondary, #f9fafb);
    border: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    font-weight: 500;
    color: var(--text-primary, #111827);
    transition: background 0.2s ease;
    flex-shrink: 0;
}

.element-picker-toggle:hover {
    background: var(--background-hover, #f3f4f6);
}

.element-picker-dropdown {
    background: white;
    border-top: 1px solid var(--border-color, #e5e7eb);
}

.element-picker-search {
    padding: 8px;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
    flex-shrink: 0;
}

.element-search-input {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 4px;
    font-size: 13px;
}

.element-search-input:focus {
    outline: none;
    border-color: var(--primary-color, #2563eb);
}

.element-picker-list {
    max-height: 200px;
    overflow-y: auto;
    padding: 4px;
}

.element-picker-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.element-picker-item:hover {
    background: var(--background-hover, #f3f4f6);
}

.element-picker-item .field-name {
    font-size: 13px;
    color: var(--text-primary, #111827);
    font-weight: 500;
}

.element-picker-item .field-type {
    font-size: 11px;
    color: var(--text-secondary, #6b7280);
    background: var(--background-secondary, #f9fafb);
    padding: 2px 6px;
    border-radius: 3px;
}

.no-fields-message {
    padding: 16px;
    text-align: center;
    color: var(--text-muted, #9ca3af);
    font-size: 13px;
}

/* AI Generation Controls */
.ai-generation-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-top: 8px;
}

/* AI Generation Controls - Horizontal Layout */
.ai-generation-controls-horizontal {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    padding-top: 8px;
}

.ai-generation-controls-horizontal .model-selection {
    flex: 1 1 50%;
    margin: 0;
}

.ai-generation-controls-horizontal .ai-generate-btn {
    flex: 1 1 50%;
    width: auto;
    min-width: unset;
}

.ai-generate-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    font-weight: 600;
}

.ai-generate-btn .ai-icon {
    width: 18px;
    height: 18px;
}

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

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

/* Generated Code Display */
.generated-code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color, #e5e7eb);
}

.generated-code-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary, #111827);
}

.code-status {
    font-size: 13px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 4px;
}

.code-status.generating {
    color: var(--primary-color, #2563eb);
    background: var(--primary-light, #dbeafe);
}

.code-status.success {
    color: #059669;
    background: #d1fae5;
}

.code-status.error {
    color: #dc2626;
    background: #fee2e2;
}

.generated-code-container {
    flex-shrink: 0;
    overflow: hidden;
}

.generated-code-textarea {
    width: 100%;
    height: 140px;
    max-height: 200px;
    padding: 12px;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 6px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
    line-height: 1.6;
    background: var(--background-code, #f9fafb);
    color: var(--text-primary, #111827);
    resize: vertical;
    min-height: 100px;
}

.generated-code-textarea:focus {
    outline: none;
    border-color: var(--primary-color, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Code Actions */
.code-actions {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    padding-top: 8px;
    border-top: 1px solid var(--border-color, #e5e7eb);
}

.code-actions #copy-code-btn {
    flex-shrink: 0;
}

.apply-code-section {
    flex: 1;
    display: flex;
    gap: 8px;
}

.field-select {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border-color, #e5e7eb);
    border-radius: 6px;
    font-size: 14px;
    background: white;
    color: var(--text-primary, #111827);
}

.field-select:focus {
    outline: none;
    border-color: var(--primary-color, #2563eb);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.field-select:disabled {
    background: var(--background-secondary, #f9fafb);
    color: var(--text-muted, #9ca3af);
    cursor: not-allowed;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    .ai-code-helper-container {
        flex-direction: column;
    }

    .ai-code-helper-left {
        flex: 0 0 auto;
        max-height: 50%;
        padding-right: 0;
    }

    .ai-code-helper-right {
        flex: 1;
        border-left: none;
        border-top: 1px solid var(--border-color, #e5e7eb);
        padding-left: 0;
        padding-top: 16px;
    }
}

/* ============================================================================
   Toggle Switch Component (Form Properties Modal)
   ============================================================================ */

/* Toggle Switch Container */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
    flex-shrink: 0;
}

/* Hide default checkbox */
.toggle-switch input[type="checkbox"] {
    opacity: 0;
    width: 0;
    height: 0;
}

/* The slider (background track) */
.toggle-switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: background-color 0.3s ease;
    border-radius: 28px;
}

/* The slider knob */
.toggle-switch .slider::before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: transform 0.3s ease;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Checked state - blue background */
.toggle-switch input[type="checkbox"]:checked + .slider {
    background-color: var(--primary-color, #2563eb);
}

/* Checked state - move knob to right */
.toggle-switch input[type="checkbox"]:checked + .slider::before {
    transform: translateX(24px);
}

/* Focus state for accessibility */
.toggle-switch input[type="checkbox"]:focus + .slider {
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

/* Disabled state */
.toggle-switch input[type="checkbox"]:disabled + .slider {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Two-column grid for form fields */
.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Toggle row (label + toggle side by side) */
.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.toggle-row .toggle-label {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-primary);
}

/* Standardized form help text */
.form-help {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
    display: block;
}

/* Full-width form inputs in settings panels */
.settings-panel .form-group input,
.settings-panel .form-group select,
.settings-panel .form-group textarea {
    width: 100%;
}

.settings-panel .form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 0.875rem;
}

/* Pages List - tvOS Edit Modal */
.pages-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.page-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.page-row .page-number {
    width: 24px;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.875rem;
    flex-shrink: 0;
}

.page-row select {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--input-bg);
    font-size: 0.875rem;
}

.page-row select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.page-row .remove-page-btn {
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: color 0.15s, background-color 0.15s;
}

.page-row .remove-page-btn:hover {
    color: var(--error-color);
    background: rgba(239, 68, 68, 0.1);
}

.page-row .remove-page-btn:disabled {
    color: var(--text-muted);
    opacity: 0.3;
    cursor: not-allowed;
}

.page-row .remove-page-btn:disabled:hover {
    background: transparent;
}

/* Drag Handle for page reordering */
.page-row .drag-handle {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    color: var(--text-muted);
    flex-shrink: 0;
    border-radius: 4px;
    transition: color 0.15s, background-color 0.15s;
}

.page-row .drag-handle:hover {
    color: var(--text-secondary);
    background: var(--hover-bg, rgba(0, 0, 0, 0.05));
}

.page-row .drag-handle.disabled {
    cursor: not-allowed;
    opacity: 0.3;
}

.page-row .drag-handle.disabled:hover {
    color: var(--text-muted);
    background: transparent;
}

/* Drag states for page rows */
.page-row[draggable="true"] {
    cursor: grab;
}

.page-row.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.page-row.drag-over-top {
    border-top: 2px solid var(--primary-color);
    margin-top: -2px;
}

.page-row.drag-over-bottom {
    border-bottom: 2px solid var(--primary-color);
    margin-bottom: -2px;
}

/* Section count badge */
.section-count {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 400;
    margin-left: 8px;
}

/* Grid layout control for checkboxes */
#form-properties-modal .checkbox-group.grid-layout {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    margin-top: 0.5rem;
}
.section-header--with-actions .section-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

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

.btn.danger:hover {
    background: var(--error-color);
    color: #fff;
    border-color: var(--error-color);
}

/* ============================================
   Simple DataTables Customization
   Matches Flight Buddy admin theme
   ============================================ */

/* Wrapper styling */
.datatable-wrapper {
    margin-top: var(--space-4);
}

/* Top controls (search, per-page selector) */
.datatable-wrapper .datatable-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-4);
    background: var(--surface);
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    flex-wrap: wrap;
    gap: var(--space-3);
}

/* Search input styling */
.datatable-wrapper .datatable-search input {
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    min-width: 200px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.datatable-wrapper .datatable-search input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Per-page selector styling */
.datatable-wrapper .datatable-dropdown {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

.datatable-wrapper .datatable-dropdown select {
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    font-size: var(--text-sm);
    cursor: pointer;
}

/* Table container */
.datatable-wrapper .datatable-container {
    border: 1px solid var(--border);
    border-top: none;
    overflow-x: auto;
}

/* Table header with sort indicators */
.datatable-wrapper table thead th {
    position: relative;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.datatable-wrapper .datatable-sorter {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
}

.datatable-wrapper .datatable-sorter::after {
    content: '⇅';
    font-size: 10px;
    color: var(--text-muted);
    opacity: 0.5;
}

.datatable-wrapper th.datatable-ascending .datatable-sorter::after {
    content: '↑';
    opacity: 1;
    color: var(--primary-color);
}

.datatable-wrapper th.datatable-descending .datatable-sorter::after {
    content: '↓';
    opacity: 1;
    color: var(--primary-color);
}

/* Bottom controls (pagination, info) */
.datatable-wrapper .datatable-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-4);
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    flex-wrap: wrap;
    gap: var(--space-3);
}

/* Info text */
.datatable-wrapper .datatable-info {
    font-size: var(--text-sm);
    color: var(--text-secondary);
}

/* Pagination styling */
.datatable-wrapper .datatable-pagination {
    display: flex;
    gap: var(--space-1);
}

.datatable-wrapper .datatable-pagination a,
.datatable-wrapper .datatable-pagination button {
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface);
    color: var(--text-primary);
    font-size: var(--text-sm);
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
}

.datatable-wrapper .datatable-pagination a:hover,
.datatable-wrapper .datatable-pagination button:hover {
    background: var(--background);
    border-color: var(--primary-color);
}

.datatable-wrapper .datatable-pagination .active a,
.datatable-wrapper .datatable-pagination .active button {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.datatable-wrapper .datatable-pagination .disabled a,
.datatable-wrapper .datatable-pagination .disabled button {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Empty state */
.datatable-wrapper .datatable-empty {
    text-align: center;
    padding: var(--space-8);
    color: var(--text-muted);
}

/* Column filter inputs (Excel-like per-column filtering) */
.datatable-column-filter {
    width: 100%;
    padding: var(--space-1) var(--space-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: var(--text-xs);
    font-weight: normal;
}

.datatable-column-filter:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
}

.datatable-filter-row th {
    padding: var(--space-2) var(--space-3);
    background: var(--background);
}

/* Table options bar */
.table-options {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    margin-bottom: var(--space-3);
}

/* Toggle checkbox styling */
.column-filter-toggle {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-size: var(--text-sm);
    color: var(--text-secondary);
    cursor: pointer;
}

.column-filter-toggle input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary-color);
}

.column-filter-toggle:hover {
    color: var(--text-primary);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .datatable-wrapper .datatable-top,
    .datatable-wrapper .datatable-bottom {
        flex-direction: column;
        align-items: stretch;
    }

    .datatable-wrapper .datatable-search input {
        width: 100%;
    }

    .datatable-wrapper .datatable-pagination {
        justify-content: center;
    }

    .table-options {
        flex-wrap: wrap;
    }
}

/* ============================================
   Phase 3: Utility Classes & Components
   ============================================ */

/* Utility Classes - Text */
.text-uppercase {
    text-transform: uppercase;
}

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

.text-warning {
    color: var(--warning-color);
}

.text-error {
    color: var(--error-color);
}

.text-success {
    color: var(--success-color);
}

/* Utility Classes - Spacing */
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

.mt-0 { margin-top: 0; }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }

.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }

/* Utility Classes - Layout */
.hidden {
    display: none !important;
}

.max-w-sm {
    max-width: 300px;
}

.max-w-md {
    max-width: 400px;
}

.max-w-lg {
    max-width: 600px;
}

/* Code Editor Textarea */
.code-editor {
    width: 100%;
    min-height: 200px;
    padding: var(--space-3);
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    line-height: 1.5;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--background);
    color: var(--text-primary);
    resize: vertical;
}

.code-editor:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(30, 64, 175, 0.1);
}

/* Empty State Component */
.empty-state {
    text-align: center;
    padding: var(--space-12) var(--space-6);
    color: var(--text-secondary);
}

.empty-state-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto var(--space-4);
    color: var(--text-muted);
}

.empty-state-icon svg {
    width: 100%;
    height: 100%;
}

.empty-state h3 {
    margin: 0 0 var(--space-2);
    font-size: var(--text-lg);
    font-weight: 600;
    color: var(--text-primary);
}

.empty-state p {
    margin: 0 0 var(--space-4);
    font-size: var(--text-sm);
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.empty-state .btn {
    margin-top: var(--space-2);
}

/* Focus Visible - Keyboard Navigation */
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Remove default focus for mouse users */
button:focus:not(:focus-visible),
input:focus:not(:focus-visible),
select:focus:not(:focus-visible),
textarea:focus:not(:focus-visible),
a:focus:not(:focus-visible) {
    outline: none;
}

/* Skeleton Loader Animation */
@keyframes skeleton-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.4;
    }
}

.skeleton {
    background: var(--border);
    border-radius: var(--radius-sm);
    animation: skeleton-pulse 1.5s ease-in-out infinite;
}

.skeleton-text {
    height: 1rem;
    margin-bottom: var(--space-2);
    border-radius: var(--radius-sm);
}

.skeleton-text-sm {
    height: 0.75rem;
    width: 60%;
}

.skeleton-text-lg {
    height: 1.25rem;
    width: 80%;
}

.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
}

.skeleton-button {
    height: 36px;
    width: 100px;
    border-radius: var(--radius-lg);
}

/* Button Loading State */
.btn.is-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn.is-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin: -8px 0 0 -8px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.btn.is-loading.btn-primary::after {
    border-color: rgba(255, 255, 255, 0.3);
    border-right-color: transparent;
    border-top-color: white;
}

.btn.is-loading.btn-outline::after {
    border-color: rgba(30, 64, 175, 0.3);
    border-right-color: transparent;
    border-top-color: var(--primary-color);
}

/* Spin animation (reusable) */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Alert Components */
.alert {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-4);
    font-size: var(--text-sm);
}

.alert-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: 600;
    margin-bottom: var(--space-1);
}

.alert-message {
    margin: 0;
}

.alert-dismiss {
    flex-shrink: 0;
    background: none;
    border: none;
    padding: var(--space-1);
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.alert-dismiss:hover {
    opacity: 1;
}

.alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.alert-error .alert-icon {
    color: #dc2626;
}

.alert-warning {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
}

.alert-warning .alert-icon {
    color: #d97706;
}

.alert-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.alert-success .alert-icon {
    color: #059669;
}

.alert-info {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
}

.alert-info .alert-icon {
    color: #3b82f6;
}

/* Responsive: Form grid collapses on mobile */
@media (max-width: 768px) {
    .form-grid-2 {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   Settings Modal - Panel Design
   Refined, organized settings layout with clear visual groupings
   ========================================================================== */

/* Settings modal body - scrollable with subtle background */
.settings-modal-body {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
    padding: var(--space-4);
    background: #f8fafc;
    max-height: 72vh;
    overflow-y: auto;
}

/* Settings Panel - Simple grey box styling (Template Settings Modal) */
.settings-panel {
    background: #f8fafc;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
}

.settings-panel:last-child {
    margin-bottom: 0;
}

/* Panel Header - simple h5 title */
.settings-panel-header {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin: 0 0 12px 0;
    padding: 0;
}

/* Toggle rows in settings */
.settings-panel .toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
}

.settings-panel .toggle-row + .toggle-row {
    border-top: 1px solid #e5e7eb;
}

.settings-panel .toggle-label {
    font-size: 14px;
    color: #374151;
    font-weight: 500;
}

/* Form grid for side-by-side inputs */
.form-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

@media (max-width: 480px) {
    .form-grid-2 {
        grid-template-columns: 1fr;
    }
}

.settings-section-label:first-child {
    padding-top: 0;
}

/* =====================================================
   COPY SETTINGS MODAL - "Control Room" Aesthetic
   ===================================================== */

.copy-modal-content {
    max-width: 800px;
    width: 95vw;
}

.copy-modal-content .modal-header h3 {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.modal-title-icon {
    width: 20px;
    height: 20px;
    color: var(--primary-color);
}

/* Info Banner */
.copy-info-banner {
    display: flex;
    align-items: flex-start;
    gap: var(--space-4);
    padding: var(--space-4) var(--space-5);
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.08) 0%, rgba(59, 130, 246, 0.03) 100%);
    border: 1px solid rgba(59, 130, 246, 0.15);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-6);
}

.copy-info-banner > i {
    width: 20px;
    height: 20px;
    color: var(--primary-light);
    flex-shrink: 0;
    margin-top: 2px;
}

.copy-info-banner strong {
    color: var(--text-primary);
    display: block;
    margin-bottom: var(--space-1);
}

.copy-info-banner div {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Two-Panel Layout */
.copy-panels {
    display: grid;
    grid-template-columns: 2fr 3fr;
    gap: var(--space-4);
    min-height: 320px;
    position: relative;
}

@media (max-width: 640px) {
    .copy-panels {
        grid-template-columns: 1fr;
        gap: var(--space-6);
    }

    .copy-flow-arrow {
        display: none;
    }
}

/* Panel Base Styles */
.copy-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.copy-panel h4 {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: var(--space-4) var(--space-4) var(--space-3);
    margin: 0;
    border-bottom: 1px solid var(--border);
    background: rgba(241, 245, 249, 0.5);
}

.copy-panel h4 i {
    width: 14px;
    height: 14px;
}

/* Source Panel (left) - Subtle blue tint */
.copy-source-panel {
    background: linear-gradient(180deg, rgba(59, 130, 246, 0.03) 0%, var(--surface) 100%);
}

.copy-source-panel h4 {
    background: rgba(59, 130, 246, 0.06);
    border-bottom-color: rgba(59, 130, 246, 0.1);
    color: var(--primary-color);
}

/* Target Count Badge */
.target-count {
    margin-left: auto;
    background: var(--primary-color);
    color: white;
    font-size: 0.6875rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.2s ease-out;
}

.target-count.visible {
    opacity: 1;
    transform: scale(1);
}

/* TV List Container */
.copy-panel .tv-list {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-2);
}

/* Source TV Items (clickable cards) */
.tv-source-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) var(--space-4);
    margin: var(--space-1) 0;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease-out;
    border: 1px solid transparent;
    background: var(--surface);
}

.tv-source-item:hover {
    background: rgba(59, 130, 246, 0.06);
    border-color: rgba(59, 130, 246, 0.15);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.tv-source-item.selected {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 12px rgba(30, 64, 175, 0.25);
}

.tv-source-item.selected .tv-airfield-code {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.tv-source-item.selected .tv-source-check {
    opacity: 1;
    transform: scale(1);
}

.tv-source-item .tv-item-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.tv-source-item .tv-name {
    font-weight: 500;
    font-size: 0.9375rem;
    color: inherit;
}

.tv-source-item .tv-meta {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.tv-source-item.selected .tv-meta {
    color: rgba(255, 255, 255, 0.8);
}

/* Airfield Code Badge */
.tv-airfield-code {
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    font-weight: 500;
    padding: 2px 6px;
    background: var(--background);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    letter-spacing: 0.02em;
}

/* Source Check Icon */
.tv-source-check {
    width: 20px;
    height: 20px;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.2s ease-out;
    flex-shrink: 0;
}

/* Target TV Items (checkbox style) */
.tv-target-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    margin: var(--space-1) 0;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.15s ease-out;
    border: 1px solid transparent;
}

.tv-target-item:hover {
    background: var(--background);
}

.tv-target-item.checked {
    background: rgba(5, 150, 105, 0.06);
    border-color: rgba(5, 150, 105, 0.2);
}

/* Custom Checkbox */
.tv-target-item input[type="checkbox"] {
    display: none;
}

.tv-target-checkbox {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease-out;
    background: var(--surface);
}

.tv-target-item.checked .tv-target-checkbox {
    background: var(--success-color);
    border-color: var(--success-color);
}

.tv-target-checkbox i,
.tv-target-checkbox svg {
    width: 14px;
    height: 14px;
    color: white;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.15s ease-out;
    display: none;
}

.tv-target-item.checked .tv-target-checkbox i,
.tv-target-item.checked .tv-target-checkbox svg {
    opacity: 1;
    transform: scale(1);
    display: block;
}

.tv-target-item .tv-name {
    font-weight: 500;
    font-size: 0.9375rem;
    color: var(--text-primary);
}

.tv-target-item .tv-airfield-code {
    margin-left: auto;
}

/* Flow Arrow */
.copy-flow-arrow {
    position: absolute;
    left: calc(40% - 2px);
    top: 50%;
    transform: translate(-50%, -50%);
    width: 36px;
    height: 36px;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    z-index: 2;
}

.copy-flow-arrow i {
    width: 18px;
    height: 18px;
    color: var(--text-muted);
}

/* Empty State */
.copy-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    height: 100%;
    min-height: 200px;
    color: var(--text-muted);
    text-align: center;
    padding: var(--space-6);
}

.copy-empty-state i {
    width: 32px;
    height: 32px;
    opacity: 0.5;
}

.copy-empty-state p {
    font-size: 0.875rem;
}

/* Select All Container */
.select-all-container {
    padding: var(--space-3) var(--space-4);
    border-top: 1px solid var(--border);
    background: var(--background);
}

.select-all-label {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    cursor: pointer;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.select-all-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary-color);
}

/* ===== Confirmation View ===== */

.copy-warning-banner {
    display: flex;
    align-items: flex-start;
    gap: var(--space-4);
    padding: var(--space-5);
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1) 0%, rgba(245, 158, 11, 0.05) 100%);
    border-left: 4px solid var(--warning-color);
    border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
    margin-bottom: var(--space-6);
}

.copy-warning-banner > i {
    width: 24px;
    height: 24px;
    color: var(--warning-color);
    flex-shrink: 0;
}

.copy-warning-banner strong {
    color: var(--text-primary);
    display: block;
    margin-bottom: var(--space-1);
}

.copy-warning-banner p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
}

/* Copy Summary */
.copy-summary {
    background: var(--background);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    margin-bottom: var(--space-5);
}

.copy-summary-header {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    flex-wrap: wrap;
}

.copy-summary-source,
.copy-summary-targets {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.summary-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 600;
}

.summary-value {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1rem;
}

.copy-summary-arrow {
    color: var(--text-muted);
}

.copy-summary-arrow i {
    width: 20px;
    height: 20px;
}

.summary-pills {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.summary-pill {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: var(--space-1) var(--space-3);
    border-radius: 20px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* Copy Details Accordion */
.copy-details {
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.copy-details summary {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-4);
    cursor: pointer;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--background);
    transition: background 0.15s;
}

.copy-details summary:hover {
    background: var(--border);
}

.copy-details summary i {
    width: 16px;
    height: 16px;
}

.copy-details[open] summary {
    border-bottom: 1px solid var(--border);
}

.copy-items-list {
    list-style: none;
    padding: var(--space-4);
    margin: 0;
}

.copy-items-list li {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.copy-items-list li i {
    width: 16px;
    height: 16px;
    color: var(--success-color);
}

.copy-excluded {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    background: rgba(220, 38, 38, 0.05);
    border-top: 1px solid var(--border);
    font-size: 0.8125rem;
    color: var(--error-color);
}

.copy-excluded i {
    width: 16px;
    height: 16px;
}

/* Footer Buttons */
#copy-next-btn,
#copy-confirm-btn {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

#copy-next-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-warning {
    background: var(--warning-color);
    color: white;
    border: none;
}

.btn-warning:hover {
    background: #b45309;
}

/* ===== Success View ===== */

.copy-success-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--space-8) var(--space-6);
    min-height: 300px;
}

.success-icon-container {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, rgba(5, 150, 105, 0.15) 0%, rgba(5, 150, 105, 0.05) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: var(--space-5);
    animation: successPop 0.4s ease-out;
}

.success-icon-container i,
.success-icon-container svg {
    width: 40px;
    height: 40px;
    color: var(--success-color);
}

@keyframes successPop {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.copy-success-state h4 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 var(--space-2) 0;
}

.copy-success-state p {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    margin: 0 0 var(--space-6) 0;
}

.success-details {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4);
    background: var(--background);
    border-radius: var(--radius-lg);
    flex-wrap: wrap;
    justify-content: center;
}

.success-from {
    font-weight: 600;
    color: var(--text-primary);
    padding: var(--space-2) var(--space-4);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.success-details > i,
.success-details > svg {
    width: 18px;
    height: 18px;
    color: var(--text-muted);
}

.success-targets {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.success-targets .summary-pill {
    background: rgba(5, 150, 105, 0.1);
    border-color: rgba(5, 150, 105, 0.2);
    color: var(--success-color);
}

/* Done button styling */
#copy-done-btn {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

/* Responsive Adjustments */
@media (max-width: 640px) {
    .copy-modal-content {
        max-width: 100%;
        width: 100%;
        margin: var(--space-4);
        max-height: calc(100vh - var(--space-8));
    }

    .copy-summary-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .copy-summary-arrow {
        transform: rotate(90deg);
    }

    .success-details {
        flex-direction: column;
    }

    .success-details > i,
    .success-details > svg {
        transform: rotate(90deg);
    }
}
