/**
 * Admin Modal Styles
 * BrightDocs Design System
 *
 * Requires: variables.css
 */

/* =========================================================================
   MODAL CONTAINER
   ========================================================================= */

#adminModal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: var(--z-modal);
    justify-content: center;
    align-items: center;
    padding: 20px;
}

#adminModal .admin-modal-content {
    background: var(--bg-white);
    border-radius: var(--radius-2xl);
    width: 100%;
    max-width: 1200px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
}

/* =========================================================================
   MODAL HEADER
   ========================================================================= */

.admin-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid var(--border-color);
    background: var(--primary-gradient);
    color: var(--bg-white);
    border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
}

.admin-modal-header h2 {
    margin: 0;
    font-size: 1.4em;
    font-weight: 600;
}

.admin-modal-header .close-btn {
    background: transparent;
    border: none;
    color: var(--bg-white);
    font-size: 28px;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity var(--transition-fast);
    line-height: 1;
}

.admin-modal-header .close-btn:hover {
    opacity: 1;
}

/* =========================================================================
   TABS
   ========================================================================= */

.admin-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
    padding: 0 15px;
}

.admin-tab-btn {
    padding: 12px 20px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary);
    border-bottom: 3px solid transparent;
    transition: all var(--transition-fast);
    margin-bottom: -1px;
}

.admin-tab-btn:hover {
    color: var(--primary-color);
    background: rgba(102, 126, 234, 0.05);
}

.admin-tab-btn.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    font-weight: 600;
}

.admin-tab-btn:disabled {
    color: var(--text-disabled);
    cursor: not-allowed;
}

/* =========================================================================
   TAB CONTENT
   ========================================================================= */

.admin-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.admin-tab-content {
    display: none;
    padding: 25px;
    min-height: 400px;
}

.admin-tab-content.active {
    display: block;
}

/* =========================================================================
   SETUP TAB LAYOUT
   ========================================================================= */

.admin-setup-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

@media (max-width: 900px) {
    .admin-setup-grid {
        grid-template-columns: 1fr;
    }
}

.admin-setup-lists {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.admin-setup-vars {
    position: sticky;
    top: 0;
}

/* =========================================================================
   SECTIONS
   ========================================================================= */

.admin-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 20px;
}

.admin-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.admin-section-header h3 {
    margin: 0;
    font-size: 1.1em;
    color: var(--text-primary);
}

.admin-section-desc {
    color: var(--text-secondary);
    font-size: 13px;
    margin: 0 0 15px 0;
    line-height: 1.4;
}

/* =========================================================================
   LIST ITEMS (Consolidated)
   ========================================================================= */

.admin-list {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-white);
}

.admin-list-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-placeholder);
    font-style: italic;
    font-size: 13px;
}

.admin-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid var(--border-lighter);
    background: var(--bg-white);
    transition: background var(--transition-fast);
}

.admin-list-item:last-child {
    border-bottom: none;
}

.admin-list-item:hover {
    background: var(--bg-secondary);
}

.admin-list-item.inactive {
    opacity: 0.6;
    background: var(--bg-muted);
}

.admin-list-item-main {
    display: flex;
    align-items: center;
    gap: 15px;
}

.admin-list-item-icon {
    font-size: 24px;
}

.admin-list-item-info,
.admin-list-item-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.admin-list-item-name,
.admin-list-item-title {
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-list-item-meta {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    gap: 8px;
    margin-top: 2px;
}

.admin-list-item-stats {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    gap: 15px;
}

.admin-list-item-badge {
    display: inline-block;
    font-size: 11px;
    padding: 2px 8px;
    background: var(--info-light);
    color: var(--info-color);
    border-radius: var(--radius-2xl);
    margin-top: 4px;
}

.admin-list-item-actions {
    display: flex;
    gap: 5px;
    margin-left: 10px;
}

/* =========================================================================
   BADGES (Consolidated)
   ========================================================================= */

.badge {
    display: inline-block;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-weight: 500;
}

.badge-success {
    background: var(--success-light);
    color: var(--success-dark);
}

.badge-info {
    background: var(--info-light);
    color: var(--info-color);
}

.badge-error {
    background: var(--error-light);
    color: var(--error-color);
}

.badge-warning,
.badge-pending {
    background: var(--warning-light);
    color: var(--warning-color);
}

.badge-inactive {
    background: var(--bg-hover);
    color: var(--text-secondary);
}

.badge-processing {
    background: var(--info-light);
    color: var(--info-color);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

/* =========================================================================
   ROLE BADGES
   ========================================================================= */

.role-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.role-system_admin {
    background: var(--role-system-admin);
    color: var(--bg-white);
}

.role-office_admin {
    background: var(--role-office-admin);
    color: var(--bg-white);
}

.role-dentist {
    background: var(--role-dentist);
    color: var(--bg-white);
}

.role-provider {
    background: var(--role-provider);
    color: var(--bg-white);
}

.role-staff {
    background: var(--role-staff);
    color: var(--bg-white);
}

/* =========================================================================
   STATUS BADGES
   ========================================================================= */

.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    font-weight: 500;
}

.status-active {
    background: var(--success-light);
    color: var(--success-dark);
}

.status-inactive {
    background: var(--danger-light);
    color: var(--danger-dark);
}

/* =========================================================================
   BUTTONS
   ========================================================================= */

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: none;
    transition: all var(--transition-fast);
}

.btn-small.btn-primary {
    background: var(--primary-color);
    color: var(--bg-white);
}

.btn-small.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-small.btn-secondary {
    background: var(--secondary-color);
    color: var(--bg-white);
}

.btn-small.btn-secondary:hover {
    background: var(--secondary-hover);
}

.btn-tiny {
    padding: 4px 8px;
    font-size: 11px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    border: none;
    transition: all var(--transition-fast);
}

.btn-tiny.btn-secondary {
    background: var(--secondary-color);
    color: var(--bg-white);
}

.btn-tiny.btn-secondary:hover {
    background: var(--secondary-hover);
}

.btn-tiny.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-tiny.btn-ghost:hover {
    background: var(--border-color);
}

.btn-icon {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    font-size: 14px;
    border-radius: var(--radius-sm);
    transition: background var(--transition-fast);
}

.btn-icon:hover {
    background: var(--border-color);
}

.btn-icon.btn-danger:hover {
    background: var(--error-light);
}

/* =========================================================================
   FORMS (Consolidated)
   ========================================================================= */

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-primary);
    font-size: 13px;
}

.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-input);
    border-radius: var(--radius-md);
    font-size: 14px;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: var(--focus-ring);
}

.form-row {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
}

.form-row .form-group {
    flex: 1;
    margin-bottom: 0;
}

.form-group-small {
    flex: 0 0 100px !important;
}

.form-help {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 15px;
}

.form-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.form-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.form-section h4 {
    margin-top: 0;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

/* Checkbox Label (Consolidated) */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: normal;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
}

/* =========================================================================
   TEMPLATE VARIABLES
   ========================================================================= */

.template-vars-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.template-vars-form .form-group {
    margin-bottom: 0;
}

.template-vars-form small {
    display: block;
    margin-top: 5px;
    color: var(--text-secondary);
    font-size: 12px;
}

/* Computed variables (read-only) */
.computed-vars {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.computed-vars h4 {
    margin: 0 0 5px 0;
    font-size: 14px;
    color: var(--text-primary);
}

.computed-var {
    margin-top: 12px;
}

.computed-var label {
    display: block;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--primary-color);
    margin-bottom: 4px;
}

.computed-value {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    font-size: 12px;
    color: var(--text-secondary);
    max-height: 60px;
    overflow-y: auto;
    word-break: break-word;
}

.computed-value em {
    color: var(--text-placeholder);
}

/* =========================================================================
   ENTITY FORM (Add/Edit)
   ========================================================================= */

.admin-entity-form {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-white);
    border-top: 2px solid var(--primary-color);
    box-shadow: var(--shadow-up);
    padding: 20px 25px;
    z-index: var(--z-modal-overlay);
    max-height: 50vh;
    overflow-y: auto;
}

.admin-form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.admin-form-header h3 {
    margin: 0;
    color: var(--text-primary);
}

#entity-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

#entity-form .form-group {
    margin-bottom: 0;
}

.admin-form-actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.admin-form-actions button {
    padding: 10px 20px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 14px;
    border: none;
    transition: all var(--transition-fast);
}

.admin-form-actions .btn-secondary {
    background: var(--border-color);
    color: var(--text-primary);
}

.admin-form-actions .btn-secondary:hover {
    background: #d0d0d0;
}

.admin-form-actions .btn-primary {
    background: var(--primary-color);
    color: var(--bg-white);
}

.admin-form-actions .btn-primary:hover {
    background: var(--primary-hover);
}

/* =========================================================================
   LOADING & ERROR STATES
   ========================================================================= */

.admin-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.admin-loading .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.admin-loading p {
    margin-top: 15px;
    font-size: 14px;
}

.admin-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--danger-color);
}

.admin-error p {
    margin-bottom: 15px;
    font-size: 14px;
}

/* =========================================================================
   MODAL FOOTER
   ========================================================================= */

.admin-modal-footer {
    padding: 15px 25px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: var(--bg-secondary);
    border-radius: 0 0 var(--radius-2xl) var(--radius-2xl);
}

.admin-modal-footer button {
    padding: 10px 20px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 14px;
    border: none;
    transition: all var(--transition-fast);
}

.admin-modal-footer .btn-secondary {
    background: var(--secondary-color);
    color: var(--bg-white);
}

.admin-modal-footer .btn-secondary:hover {
    background: var(--secondary-hover);
}

/* =========================================================================
   SCROLLBAR STYLING
   ========================================================================= */

.admin-list::-webkit-scrollbar,
.admin-modal-body::-webkit-scrollbar,
.computed-value::-webkit-scrollbar {
    width: 8px;
}

.admin-list::-webkit-scrollbar-track,
.admin-modal-body::-webkit-scrollbar-track,
.computed-value::-webkit-scrollbar-track {
    background: var(--bg-hover);
    border-radius: var(--radius-sm);
}

.admin-list::-webkit-scrollbar-thumb,
.admin-modal-body::-webkit-scrollbar-thumb,
.computed-value::-webkit-scrollbar-thumb {
    background: var(--text-disabled);
    border-radius: var(--radius-sm);
}

.admin-list::-webkit-scrollbar-thumb:hover,
.admin-modal-body::-webkit-scrollbar-thumb:hover,
.computed-value::-webkit-scrollbar-thumb:hover {
    background: #bbb;
}

/* =========================================================================
   USER MANAGEMENT
   ========================================================================= */

.admin-users-container {
    padding: 20px;
}

.admin-users-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 15px;
}

.admin-users-search {
    display: flex;
    align-items: center;
    flex: 1;
    max-width: 500px;
}

.admin-users-search input[type="text"] {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border-input);
    border-radius: var(--radius-sm);
    font-size: 14px;
}

.admin-users-search input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: var(--focus-ring-sm);
}

/* Users Table */
.admin-users-table-container {
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    background: var(--bg-white);
}

.admin-users-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.admin-users-table th {
    background: var(--bg-secondary);
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.admin-users-table td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}

.admin-users-table tbody tr:hover {
    background: var(--bg-secondary);
}

.admin-users-table tbody tr.inactive-row {
    background: var(--bg-muted);
    opacity: 0.7;
}

.admin-users-table tbody tr.inactive-row:hover {
    opacity: 1;
}

.admin-table-empty {
    text-align: center;
    padding: 40px !important;
    color: var(--text-secondary);
    font-style: italic;
}

/* Actions Cell */
.actions-cell {
    white-space: nowrap;
}

.actions-cell .btn-icon {
    padding: 4px 8px;
    margin: 0 2px;
}

/* Text Utilities */
.text-muted {
    color: var(--secondary-color);
    font-size: 12px;
}

/* User Form */
.admin-user-form {
    margin-top: 20px;
    padding: 20px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
}

/* Reset Password Form */
.reset-password-info {
    background: var(--bg-white);
    padding: 15px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

.reset-password-info p {
    margin: 0;
}

.reset-password-info p:first-child {
    margin-bottom: 5px;
}

/* =========================================================================
   EMAIL SECTION
   ========================================================================= */

.admin-email-section {
    padding: 20px;
}

.connection-settings {
    background: var(--bg-tertiary);
    border-radius: var(--radius-xl);
    padding: 20px;
    margin: 15px 0;
}

.connection-settings h4 {
    margin-top: 0;
    margin-bottom: 15px;
}

/* Gmail OAuth Status */
.gmail-status-box {
    padding: 16px;
    border-radius: var(--radius-xl);
    background: var(--bg-secondary);
    margin-top: 12px;
}

.gmail-connected,
.gmail-not-connected,
.gmail-error {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: var(--radius-lg);
}

.gmail-connected {
    background: var(--success-light);
}

.gmail-not-connected {
    background: var(--warning-muted);
}

.gmail-error {
    background: var(--danger-light);
}

.gmail-status-box .status-icon {
    font-size: 24px;
}

.gmail-status-box .status-details {
    flex: 1;
}

.gmail-status-box .status-details p {
    margin: 4px 0 0 0;
    font-size: 13px;
    color: var(--text-secondary);
}

.gmail-info-box {
    background: var(--info-alt);
    padding: 16px;
    border-radius: var(--radius-xl);
    margin-top: 12px;
}

.gmail-info-box ol {
    margin: 8px 0 0 20px;
    padding: 0;
}

.gmail-info-box li {
    margin: 4px 0;
}

/* =========================================================================
   BACKUP/SYSTEM TAB
   ========================================================================= */

.backup-tab-content {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.backup-status-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    padding: 20px;
    border-left: 4px solid var(--success-color);
}

.backup-status-card.status-ok {
    border-left-color: var(--success-color);
}

.backup-status-card.status-error {
    border-left-color: var(--error-color);
    background: var(--error-light);
}

.backup-status-card.status-progress {
    border-left-color: var(--primary-color);
    background: var(--info-light);
}

.backup-status-card.status-disabled {
    border-left-color: var(--text-placeholder);
    opacity: 0.7;
}

.backup-status-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.backup-status-icon {
    font-size: 2rem;
}

.backup-status-info {
    flex: 1;
}

.backup-status-info h3 {
    margin: 0;
    font-size: 1.1em;
    color: var(--text-primary);
}

.backup-status-text {
    color: var(--text-secondary);
    font-size: 14px;
}

.backup-status-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.backup-stat label {
    display: block;
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.backup-stat span {
    font-weight: 500;
    color: var(--text-primary);
}

.backup-stat small {
    display: block;
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 2px;
}

.backup-error-banner {
    margin-top: 15px;
    padding: 12px 15px;
    background: var(--error-light);
    border-radius: var(--radius-lg);
    color: var(--error-color);
    font-size: 14px;
}

.backup-error-banner small {
    display: block;
    margin-top: 4px;
    opacity: 0.8;
}

/* Settings Form */
.backup-settings-form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.setting-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.setting-row label {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.setting-row label input[type="checkbox"] {
    margin: 0;
}

.setting-row select {
    max-width: 200px;
    padding: 8px 12px;
    border: 1px solid var(--border-input);
    border-radius: var(--radius-md);
    font-size: 14px;
}

.setting-row select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: var(--focus-ring);
}

.setting-row small {
    color: var(--text-secondary);
    font-size: 12px;
}

/* Backup History Table */
.backup-history-table {
    overflow-x: auto;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.backup-history-table table {
    width: 100%;
    border-collapse: collapse;
}

.backup-history-table th,
.backup-history-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-lighter);
}

.backup-history-table th {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--bg-secondary);
}

.backup-history-table tr:last-child td {
    border-bottom: none;
}

.backup-history-table tr:hover {
    background: var(--bg-secondary);
}

.backup-row.failed {
    opacity: 0.6;
    background: var(--bg-muted);
}

.backup-name {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-primary);
}

.backup-source {
    display: block;
    color: var(--text-muted);
    font-size: 11px;
    margin-top: 2px;
}

/* No Data State */
.backup-history-table .no-data {
    text-align: center;
    color: var(--text-placeholder);
    padding: 30px !important;
    font-style: italic;
}

/* Primary button in backup card */
.backup-status-card .btn-primary {
    padding: 8px 16px;
    font-size: 13px;
    border-radius: var(--radius-md);
    cursor: pointer;
    border: none;
    background: var(--primary-color);
    color: var(--bg-white);
    transition: all var(--transition-fast);
}

.backup-status-card .btn-primary:hover {
    background: var(--primary-hover);
}

.backup-status-card .btn-primary:disabled {
    background: var(--text-disabled);
    cursor: not-allowed;
}

/* =========================================================================
   EXPORT TAB
   ========================================================================= */

.export-form {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 20px;
    margin-bottom: 20px;
}

.export-form h4 {
    margin: 0 0 16px 0;
    font-size: 16px;
}

/* Patient Search */
.patient-search-results {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin-top: 4px;
    background: var(--bg-white);
}

.patient-search-results:empty {
    display: none;
}

.patient-result {
    padding: 10px 12px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-lighter);
}

.patient-result:hover {
    background: var(--bg-hover);
}

.patient-result:last-child {
    border-bottom: none;
}

.patient-result .patient-name {
    font-weight: 500;
}

.patient-result .patient-dob {
    color: var(--text-secondary);
    font-size: 13px;
}

.patient-search-results .no-results,
.patient-search-results .search-error {
    padding: 12px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
}

.selected-patient {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--info-light);
    border: 1px solid var(--info-color);
    border-radius: var(--radius-lg);
    padding: 10px 12px;
    margin-top: 8px;
}

/* Export Job Items */
.export-job-item {
    padding: 16px;
}

.export-job-item.processing {
    background: var(--warning-light);
}

.export-job-item.failed {
    background: var(--error-light);
}

.export-job-item .admin-list-item-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
}

/* Progress Bar */
.export-progress {
    margin-top: 12px;
}

.progress-bar {
    height: 8px;
    background: var(--border-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-bottom: 6px;
}

.progress-fill {
    height: 100%;
    background: var(--info-color);
    transition: width var(--transition-normal);
}

.progress-text {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Export Error */
.export-error {
    margin-top: 10px;
    padding: 10px;
    background: var(--error-light);
    color: var(--error-color);
    border-radius: var(--radius-lg);
    font-size: 13px;
}

/* Export Files */
.export-files {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

.export-file {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
}

.export-file:not(:last-child) {
    border-bottom: 1px solid var(--border-lighter);
}

.export-file .file-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.export-file .file-months {
    color: var(--text-secondary);
    font-size: 12px;
}

.export-expires {
    margin-top: 10px;
    font-size: 12px;
    color: var(--text-secondary);
}

/* =========================================================================
   RESPONSIVE ADJUSTMENTS
   ========================================================================= */

@media (max-width: 768px) {
    .admin-users-header {
        flex-direction: column;
        align-items: stretch;
    }

    .admin-users-search {
        max-width: none;
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .admin-users-search .checkbox-label {
        margin-left: 0 !important;
    }

    .form-row {
        flex-direction: column;
        gap: 15px;
    }

    .admin-users-table {
        font-size: 13px;
    }

    .admin-users-table th,
    .admin-users-table td {
        padding: 10px;
    }
}


/* =========================================================================
   ARCHIVE FTS
   ========================================================================= */


.database-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 16px;
    margin-top: 16px;
}

.stat-card {
    background: var(--bg-secondary, #f8f9fa);
    border-radius: 8px;
    padding: 16px;
    text-align: center;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary, #212529);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted, #6c757d);
    margin-top: 4px;
}

.archival-status {
    background: var(--bg-secondary, #f8f9fa);
    border-radius: 8px;
    padding: 16px;
    margin-top: 16px;
}

.archival-config {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.form-control-inline {
    width: auto;
    display: inline-block;
    padding: 6px 12px;
    border: 1px solid var(--border-color, #dee2e6);
    border-radius: 4px;
}

.archival-summary {
    margin-top: 12px;
}

.archival-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color, #dee2e6);
}

.archival-status-ok {
    color: var(--success-color, #28a745);
    font-weight: 500;
    margin-top: 12px;
}

.archival-history {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color, #dee2e6);
}

.maintenance-actions {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.preview-summary {
    margin-bottom: 16px;
}

.preview-note {
    background: #fff3cd;
    border-radius: 8px;
    padding: 12px;
    margin-top: 16px;
}

.preview-note ul {
    margin: 8px 0 0 20px;
    padding: 0;
}

.preview-note li {
    margin-bottom: 4px;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.modal-medium {
    max-width: 500px;
    width: 90%;
}


/* Deleted Documents Modal Styles */
#deletedDocumentsModal .selected-row {
    background-color: #e3f2fd !important;
}

#deletedDocumentsModal .data-table {
    border-collapse: collapse;
    width: 100%;
}

#deletedDocumentsModal .data-table th,
#deletedDocumentsModal .data-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

#deletedDocumentsModal .data-table tbody tr:hover {
    background-color: #f5f5f5;
}

#deletedDocumentsModal .btn-small {
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
}

#deletedDocumentsModal .btn-small.btn-primary {
    background: #667eea;
    color: white;
}

#deletedDocumentsModal .btn-small.btn-primary:hover {
    background: #5a6fd6;
}

#deletedDocumentsModal .btn-small.btn-danger {
    background: #dc3545;
    color: white;
}

#deletedDocumentsModal .btn-small.btn-danger:hover {
    background: #c82333;
}

#deletedDocumentsModal .loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

#deletedDocumentsModal .modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}


/* =========================================================================
   Watched folders
   ========================================================================= */


.watched-folders-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.folder-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 12px;
    background: var(--bg-secondary, #f8f9fa);
    border-radius: 6px;
    border: 1px solid var(--border-color, #e0e0e0);
}

.folder-item.item-disabled {
    opacity: 0.6;
}

.folder-info {
    flex: 1;
    min-width: 0;
}

.folder-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.folder-name {
    font-weight: 500;
    font-size: 14px;
}

.folder-warning {
    cursor: help;
}

.folder-path {
    font-family: monospace;
    font-size: 12px;
    color: var(--text-muted, #666);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.folder-meta {
    display: flex;
    gap: 12px;
    font-size: 11px;
    color: var(--text-muted, #888);
}

.folder-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.input-with-button {
    display: flex;
    gap: 8px;
}

.input-with-button input {
    flex: 1;
}

.file-types-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
    padding: 12px;
    background: var(--bg-secondary, #f8f9fa);
    border-radius: 6px;
    border: 1px solid var(--border-color, #e0e0e0);
}

.file-type-checkbox {
    font-size: 13px;
}

.form-row {
    display: flex;
    gap: 24px;
}

.form-row .form-group {
    flex: 1;
}

.badge.status-active {
    background: #d4edda;
    color: #155724;
}

.badge.status-inactive {
    background: #f8d7da;
    color: #721c24;
}

.text-success {
    color: #28a745;
}

.text-warning {
    color: #ffc107;
}

.text-error {
    color: #dc3545;
}

.badge-dentist {
    background-color: #d4edda;
    color: #155724;
}

.badge-warning {
    background-color: #fff3cd;
    color: #856404;
}