/**
 * AccessiMate Admin CSS
 * Optimized modern admin interface styling
 */

/* CSS Variables for admin interface */
:root {
    /* Light Theme Colors */
    --am-admin-primary: #1e40af; /* Deep indigo for better contrast */
    --am-admin-primary-hover: #1e3a8a; /* Darker indigo for hover */
    --am-admin-secondary: #475569; /* Neutral slate for secondary elements */
    --am-admin-success: #16a34a; /* Vibrant green for success states */
    --am-admin-warning: #d97706; /* Warm amber for warnings */
    --am-admin-danger: #dc2626; /* Bold red for errors */
    --am-admin-white: #ffffff;
    --am-admin-gray-50: #f9fafb;
    --am-admin-gray-100: #f3f4f6;
    --am-admin-gray-200: #e5e7eb;
    --am-admin-gray-300: #d1d5db;
    --am-admin-gray-400: #9ca3af;
    --am-admin-gray-500: #6b7280;
    --am-admin-gray-600: #4b5563;
    --am-admin-gray-700: #374151;
    --am-admin-gray-800: #1f2937;
    --am-admin-gradient: linear-gradient(135deg, var(--am-admin-primary) 0%, #4f46e5 100%); /* Softer gradient with indigo */
    --am-admin-shadow: 0 2px 4px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
    --am-admin-shadow-lg: 0 8px 12px rgba(0, 0, 0, 0.1), 0 3px 6px rgba(0, 0, 0, 0.08);
    --am-admin-radius: 0.5rem;
    --am-admin-radius-lg: 0.75rem;
    --am-admin-transition: all 0.2s ease-in-out;
}

/* Modern header styling */
.accessimate-admin-header {
    background: var(--am-admin-gradient) !important;
    color: var(--am-admin-white) !important;
    padding: 24px !important;
    border-radius: var(--am-admin-radius-lg) !important;
    border: none !important;
    margin: 20px 0 !important;
    box-shadow: var(--am-admin-shadow-lg) !important;
    position: relative !important;
    overflow: hidden !important;
}

.accessimate-admin-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at top right, rgba(255, 255, 255, 0.08) 0%, transparent 70%);
    pointer-events: none;
}

.accessimate-admin-header p {
    margin: 0 !important;
    font-size: 16px !important;
    font-weight: 400 !important;
    line-height: 1.6 !important;
    position: relative !important;
    z-index: 1 !important;
}

/* Info section styling */
.accessimate-admin-info {
    background: var(--am-admin-white) !important;
    padding: 32px !important;
    border: 1px solid var(--am-admin-gray-200) !important;
    border-radius: var(--am-admin-radius-lg) !important;
    margin-top: 32px !important;
    box-shadow: var(--am-admin-shadow) !important;
}

.accessimate-admin-info h3 {
    color: var(--am-admin-gray-800) !important;
    font-size: 20px !important;
    font-weight: 600 !important;
    margin: 0 0 20px 0 !important;
    padding-bottom: 12px !important;
    border-bottom: 2px solid var(--am-admin-gray-100) !important;
}

.accessimate-admin-info ul {
    list-style: none !important;
    padding: 0 !important;
    margin: 0 !important;
}

.accessimate-admin-info ul li {
    padding: 12px 0 !important;
    border-bottom: 1px solid var(--am-admin-gray-100) !important;
    color: var(--am-admin-gray-700) !important;
    font-size: 14px !important;
    line-height: 1.5 !important;
    position: relative !important;
    padding-left: 32px !important;
}

.accessimate-admin-info ul li:last-child {
    border-bottom: none !important;
}

.accessimate-admin-info ul li::before {
    content: '✓';
    position: absolute;
    left: 0;
    top: 12px;
    color: var(--am-admin-success);
    font-weight: 600;
    width: 20px;
    text-align: center;
}

/* AI Status Grid */
.accessimate-ai-status-grid {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)) !important;
    gap: 20px !important;
    margin-top: 24px !important;
}

.ai-service-status {
    background: var(--am-admin-gray-50) !important;
    border: 1px solid var(--am-admin-gray-200) !important;
    border-radius: var(--am-admin-radius) !important;
    padding: 20px !important;
    transition: var(--am-admin-transition) !important;
    position: relative !important;
    overflow: hidden !important;
}

.ai-service-status::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--am-admin-gradient);
}

.ai-service-status:hover {
    transform: translateY(-2px) !important;
    box-shadow: var(--am-admin-shadow-lg) !important;
    border-color: var(--am-admin-primary) !important;
}

.ai-service-status h4 {
    margin: 0 0 16px 0 !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    color: var(--am-admin-gray-800) !important;
}

/* Status indicators */
.status-indicator {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    padding: 6px 12px !important;
    border-radius: var(--am-admin-radius) !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.025em !important;
}

.status-configured {
    background: rgba(22, 163, 74, 0.1) !important;
    color: var(--am-admin-success) !important;
    border: 1px solid rgba(22, 163, 74, 0.2) !important;
}

.status-missing {
    background: rgba(220, 38, 38, 0.1) !important;
    color: var(--am-admin-danger) !important;
    border: 1px solid rgba(220, 38, 38, 0.2) !important;
}

.status-warning {
    background: rgba(217, 119, 6, 0.1) !important;
    color: var(--am-admin-warning) !important;
    border: 1px solid rgba(217, 119, 6, 0.2) !important;
}

.status-info {
    background: rgba(30, 64, 175, 0.1) !important;
    color: var(--am-admin-primary) !important;
    border: 1px solid rgba(30, 64, 175, 0.2) !important;
}

/* Enabled features list */
.enabled-features-list {
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
}

.enabled-features-list li {
    margin: 8px 0 !important;
    font-size: 13px !important;
    color: var(--am-admin-success) !important;
    font-weight: 500 !important;
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
}

.enabled-features-list li::before {
    content: '●' !important;
    color: var(--am-admin-success) !important;
    font-size: 8px !important;
}

/* Form improvements */
.form-table th {
    color: var(--am-admin-gray-700) !important;
    font-weight: 600 !important;
    font-size: 14px !important;
    padding: 20px 20px 20px 24px !important;
    width: 200px !important;
    vertical-align: top !important;
}

.form-table td {
    padding: 20px 24px !important;
    vertical-align: top !important;
}

.form-table input[type="text"],
.form-table input[type="password"],
.form-table select {
    border: 1px solid var(--am-admin-gray-300) !important;
    border-radius: var(--am-admin-radius) !important;
    padding: 10px 12px !important;
    font-size: 14px !important;
    transition: var(--am-admin-transition) !important;
    background: var(--am-admin-white) !important;
}

.form-table input[type="text"]:focus,
.form-table input[type="password"]:focus,
.form-table select:focus {
    border-color: var(--am-admin-primary) !important;
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.15) !important;
    outline: none !important;
}

/* Modern Switch Design */
.form-table input[type="checkbox"] {
    appearance: none !important;
    -webkit-appearance: none !important;
    width: 50px !important;
    height: 26px !important;
    background: var(--am-admin-gray-300) !important;
    border-radius: 13px !important;
    position: relative !important;
    cursor: pointer !important;
    transition: var(--am-admin-transition) !important;
    margin-right: 12px !important;
    border: none !important;
    outline: none !important;
    vertical-align: middle !important;
}

.form-table input[type="checkbox"]:before {
    content: '' !important;
    position: absolute !important;
    top: 2px !important;
    left: 2px !important;
    width: 22px !important;
    height: 22px !important;
    background: var(--am-admin-white) !important;
    border-radius: 50% !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}

.form-table input[type="checkbox"]:checked {
    background: var(--am-admin-primary) !important;
}

.form-table input[type="checkbox"]:checked:before {
    transform: translateX(24px) !important;
    margin: 0 !important;
}

.form-table input[type="checkbox"]:hover {
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.15) !important;
}

.form-table input[type="checkbox"]:focus {
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.25) !important;
}

/* Switch label styling */
.form-table label {
    display: flex !important;
    align-items: center !important;
    font-weight: 500 !important;
    color: var(--am-admin-gray-700) !important;
    cursor: pointer !important;
    line-height: 1.5 !important;
    position: relative;
}

.form-table label .accessimate-beta-feature {
    background: #f59e0b;
    color: #000;
    padding: 3px 12px;
    line-height: 1;
    border-radius: 10px;
    text-align: center;
    margin-left: 30px;
}

/* Submit button styling */
.button-primary {
    background: var(--am-admin-gradient) !important;
    border: none !important;
    border-radius: var(--am-admin-radius) !important;
    padding: 12px 24px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    text-shadow: none !important;
    box-shadow: var(--am-admin-shadow) !important;
    transition: var(--am-admin-transition) !important;
}

.button-primary:hover {
    background: linear-gradient(135deg, var(--am-admin-primary-hover) 0%, var(--am-admin-primary) 100%) !important;
    transform: translateY(-1px) !important;
    box-shadow: var(--am-admin-shadow-lg) !important;
}

.button-primary:focus {
    box-shadow: 0 0 0 3px rgba(30, 64, 175, 0.3) !important;
}

/* Section headers */
h2.title {
    color: var(--am-admin-gray-800) !important;
    font-size: 24px !important;
    font-weight: 700 !important;
    margin-bottom: 8px !important;
    position: relative !important;
    padding-bottom: 16px !important;
}

h2.title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60px;
    height: 3px;
    background: var(--am-admin-gradient);
    border-radius: 2px;
}

/* Settings sections */
.form-table {
    background: var(--am-admin-white) !important;
    border-radius: var(--am-admin-radius-lg) !important;
    box-shadow: var(--am-admin-shadow) !important;
    border: 1px solid var(--am-admin-gray-200) !important;
    margin-top: 20px !important;
    overflow: hidden !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
}

.form-table tr:nth-child(even) {
    background: var(--am-admin-gray-50) !important;
}

.form-table tr:hover {
    background: rgba(30, 64, 175, 0.05) !important;
}

.form-table tr:first-child th,
.form-table tr:first-child td {
    border-top: none !important;
}

.form-table tr:last-child th,
.form-table tr:last-child td {
    border-bottom: none !important;
}

.form-table th {
    border-right: 1px solid var(--am-admin-gray-200) !important;
    border-bottom: 1px solid var(--am-admin-gray-200) !important;
    background: var(--am-admin-gray-50) !important;
}

.form-table td {
    border-bottom: 1px solid var(--am-admin-gray-200) !important;
}

/* Description text */
.description {
    color: var(--am-admin-gray-600) !important;
    font-size: 13px !important;
    font-style: italic !important;
    margin-top: 6px !important;
    line-height: 1.4 !important;
    max-width: 600px !important;
}

/* Notice improvements */
.notice {
    border-radius: var(--am-admin-radius) !important;
    border-left-width: 4px !important;
    box-shadow: var(--am-admin-shadow) !important;
}

.notice-info {
    background: rgba(30, 64, 175, 0.05) !important;
    border-left-color: var(--am-admin-primary) !important;
}

/* Responsive design */
@media (max-width: 768px) {
    .accessimate-ai-status-grid {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }

    .accessimate-admin-header {
        padding: 20px !important;
        margin: 16px 0 !important;
    }

    .accessimate-admin-info {
        padding: 20px !important;
        margin-top: 20px !important;
    }

    .form-table th,
    .form-table td {
        display: block !important;
        width: 100% !important;
        padding: 16px 20px !important;
        border-right: none !important;
    }

    .form-table th {
        border-bottom: 1px solid var(--am-admin-gray-300) !important;
        padding-bottom: 8px !important;
        background: transparent !important;
        font-weight: 700 !important;
    }

    .form-table td {
        padding-top: 8px !important;
        border-top: none !important;
        padding-bottom: 20px !important;
    }

    .form-table tr {
        border-bottom: 2px solid var(--am-admin-gray-200) !important;
    }

    .form-table tr:last-child {
        border-bottom: none !important;
    }
}

/* Animation classes */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.accessimate-admin-header,
.accessimate-admin-info,
.form-table {
    animation: fadeInUp 0.5s ease-out !important;
}

.accessimate-admin-info {
    animation-delay: 0.1s !important;
}

.form-table {
    animation-delay: 0.2s !important;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --am-admin-primary: #60a5fa; /* Bright indigo for dark mode */
        --am-admin-primary-hover: #3b82f6; /* Slightly darker indigo */
        --am-admin-secondary: #94a3b8; /* Light slate for secondary elements */
        --am-admin-success: #4ade80; /* Bright green */
        --am-admin-warning: #f59e0b; /* Vibrant amber */
        --am-admin-danger: #f87171; /* Bright red */
        --am-admin-white: #1e293b; /* Dark slate for backgrounds */
        --am-admin-gray-50: #0f172a;
        --am-admin-gray-100: #1e293b;
        --am-admin-gray-200: #334155;
        --am-admin-gray-300: #475569;
        --am-admin-gray-400: #64748b;
        --am-admin-gray-500: #94a3b8;
        --am-admin-gray-600: #cbd5e1;
        --am-admin-gray-700: #e2e8f0;
        --am-admin-gray-800: #f1f5f9;
        --am-admin-gradient: linear-gradient(135deg, var(--am-admin-primary) 0%, #818cf8 100%); /* Softer indigo gradient */
        --am-admin-shadow: 0 2px 4px rgba(255, 255, 255, 0.08), 0 1px 2px rgba(255, 255, 255, 0.06);
        --am-admin-shadow-lg: 0 8px 12px rgba(255, 255, 255, 0.1), 0 3px 6px rgba(255, 255, 255, 0.08);
    }

    /* Ensure text is visible in dark mode */
    .form-table th,
    .form-table td,
    .accessimate-admin-info h3,
    .accessimate-admin-info .desc,
    .accessimate-admin-info ul li,
    .ai-service-status h4,
    h2.title,
    .description {
        color: var(--am-admin-gray-700) !important;
    }

    /* Dark mode specific adjustments */
    .form-table input[type="text"],
    .form-table input[type="password"],
    .form-table select {
        background: var(--am-admin-gray-100) !important;
        color: var(--am-admin-gray-700) !important;
        border-color: var(--am-admin-gray-300) !important;
    }

    .form-table input[type="text"]:focus,
    .form-table input[type="password"]:focus,
    .form-table select:focus {
        background: var(--am-admin-gray-50) !important;
        color: var(--am-admin-gray-800) !important;
        box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.2) !important;
    }

    /* Dark mode status indicators */
    .status-configured {
        background: rgba(74, 222, 128, 0.15) !important;
        color: var(--am-admin-success) !important;
        border-color: rgba(74, 222, 128, 0.3) !important;
    }

    .status-missing {
        background: rgba(248, 113, 113, 0.15) !important;
        color: var(--am-admin-danger) !important;
        border-color: rgba(248, 113, 113, 0.3) !important;
    }

    .status-warning {
        background: rgba(245, 158, 11, 0.15) !important;
        color: var(--am-admin-warning) !important;
        border-color: rgba(245, 158, 11, 0.3) !important;
    }

    .status-info {
        background: rgba(96, 165, 250, 0.15) !important;
        color: var(--am-admin-primary) !important;
        border-color: rgba(96, 165, 250, 0.3) !important;
    }

    /* Dark mode switch styling */
    .form-table input[type="checkbox"] {
        background: var(--am-admin-gray-400) !important;
    }

    .form-table input[type="checkbox"]:before {
        background: var(--am-admin-gray-50) !important;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3) !important;
    }

    .form-table input[type="checkbox"]:checked {
        background: var(--am-admin-primary) !important;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    :root {
        --am-admin-primary: #1e3a8a;
        --am-admin-gray-100: #ffffff;
        --am-admin-gray-200: #f0f0f0;
        --am-admin-gray-300: #d0d0d0;
    }

    .form-table input[type="text"],
    .form-table input[type="password"],
    .form-table select {
        border-width: 2px !important;
    }

    .button-primary {
        border: 2px solid var(--am-admin-primary) !important;
    }

    .status-indicator {
        border-width: 2px !important;
    }
}

/* Print styles */
@media print {
    .accessimate-admin-header {
        background: transparent !important;
        color: black !important;
        box-shadow: none !important;
        border: 1px solid black !important;
    }

    .ai-service-status {
        break-inside: avoid !important;
    }
}