@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --primary: #4F46E5;
    --primary-glow: #4f46e580;
    --secondary: #10B981;
    --background: #0f172a;
    --surface: #1e293b;
    --surface-glass: rgba(30, 41, 59, 0.7);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border: #334155;
    --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

[data-theme="light"] {
    --background: #f8fafc;
    --surface: #ffffff;
    --surface-glass: rgba(255, 255, 255, 0.9);
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Light Mode Overrides */
[data-theme="light"] body {
    background-image:
        radial-gradient(at 0% 0%, hsla(253, 16%, 90%, 1) 0, transparent 50%),
        radial-gradient(at 50% 0%, hsla(225, 39%, 90%, 1) 0, transparent 50%),
        radial-gradient(at 100% 0%, hsla(339, 49%, 95%, 1) 0, transparent 50%);
}

[data-theme="light"] input[type="text"],
[data-theme="light"] input[type="date"],
[data-theme="light"] input[type="email"] {
    background: #f1f5f9;
    /* Lighter grey for contrast */
    color: var(--text-main);
    border-color: #cbd5e1;
}

[data-theme="light"] input:focus {
    background: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

/* Ensure secondary button remains visible in light mode */
[data-theme="light"] .btn-secondary {
    background: white;
    border: 1px solid var(--border);
    color: var(--text-main);
}

.theme-toggle {
    position: fixed;
    /* Changed from absolute to fixed */
    top: 1.5rem;
    right: 1.5rem;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: transparent;
    /* Removed background */
    border: 2px solid rgba(255, 255, 255, 0.1);
    /* Subtle border for visibility */
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1000;
    /* Increased Z-Index to ensure clickability */
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: rotate(15deg);
    color: var(--primary);
    border-color: var(--primary);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--background);
    background-image:
        radial-gradient(at 0% 0%, hsla(253, 16%, 7%, 1) 0, transparent 50%),
        radial-gradient(at 50% 0%, hsla(225, 39%, 30%, 1) 0, transparent 50%),
        radial-gradient(at 100% 0%, hsla(339, 49%, 30%, 1) 0, transparent 50%);
    color: var(--text-main);
    min-height: 100vh;
    padding: 2rem;
    overflow-x: hidden;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 3rem;
    animation: fadeInDown 0.8s ease-out;
}

h1 {
    font-size: 3rem;
    font-weight: 700;
    background: linear-gradient(to right, #818cf8, #c084fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
}

/* Glassmorphism Card */
.glass-card {
    background: var(--surface-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 2rem;
    box-shadow: var(--card-shadow);
    margin-bottom: 2rem;
    animation: fadeInUp 0.8s ease-out;
}

/* Form Styles */
.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
}

input[type="text"],
input[type="date"],
input[type="email"] {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: white;
    font-family: inherit;
    transition: all 0.3s ease;
}

input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-glow);
}

/* Audit List */
.audit-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.audit-item {
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid transparent;
    transition: all 0.3s ease;
}

.audit-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

.criteria-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #e2e8f0;
}

[data-theme="light"] .criteria-title {
    color: #1e293b;
    /* Dark Slate for contrast on white */
    font-weight: 700;
}

.levels-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.level-option {
    position: relative;
    cursor: pointer;
}

.level-option input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

/* Level Options */
.level-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 1.25rem;
    background: rgba(255, 255, 255, 0.03);
    /* Subtle glass effect */
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

[data-theme="light"] .level-content {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.level-content:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
}

[data-theme="light"] .level-content:hover {
    background: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.level-badge {
    align-self: flex-start;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    /* Pill shape */
    margin-bottom: 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
    border: 1px solid transparent;
    transition: all 0.3s ease;
}

[data-theme="light"] .level-badge {
    background: #f1f5f9;
    color: #64748b;
    border-color: #e2e8f0;
}

.level-desc {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.5;
    font-weight: 400;
}

[data-theme="light"] .level-desc {
    color: #475569;
}

/* Selected State - Premium Glow */
.level-option input:checked+.level-content {
    border-color: var(--primary);
    background: rgba(79, 70, 229, 0.15);
    box-shadow: 0 0 0 1px var(--primary), 0 10px 25px -5px rgba(79, 70, 229, 0.4);
}

[data-theme="light"] .level-option input:checked+.level-content {
    background: #eef2ff;
    /* Very light indigo tint */
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary), 0 10px 15px -3px rgba(79, 70, 229, 0.2);
}

.level-option input:checked+.level-content .level-badge {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 6px rgba(79, 70, 229, 0.3);
}

.level-option input:checked+.level-content .level-desc {
    color: #e2e8f0;
    font-weight: 500;
}

[data-theme="light"] .level-option input:checked+.level-content .level-desc {
    color: #1e293b;
    /* Dark text for light mode selected */
}

/* Actions */
.actions {
    margin-top: 2rem;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
}

.btn {
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.3s ease;
    font-family: inherit;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #818cf8);
    color: white;
    box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px var(--primary-glow);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.3);
    /* Lighter border */
    color: white;
    /* Explicitly white for dark mode */
}

/* Light mode override for secondary button */
[data-theme="light"] .btn-secondary {
    background: transparent;
    border-color: var(--border);
    color: var(--text-main);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: white;
    color: white;
}

[data-theme="light"] .btn-secondary:hover {
    background: rgba(0, 0, 0, 0.05);
    border-color: var(--primary);
    color: var(--primary);
}

/* Dashboard Hidden State */
.hidden {
    display: none;
}

/* Animations */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--background);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    transform: scale(0.95);
    transition: all 0.3s ease;
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
}

.detail-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
    background: rgba(0, 0, 0, 0.2);
    padding: 1.5rem;
    border-radius: 12px;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid var(--border);
}

.detail-item:last-child {
    border-bottom: none;
}

.detail-score-1 {
    color: #EF4444;
    font-weight: bold;
}

.detail-score-2 {
    color: #F59E0B;
    font-weight: bold;
}

.detail-score-3 {
    color: #10B981;
    font-weight: bold;
}

.close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
}

.close-btn:hover {
    color: white;
}