/* public/style.css */

:root {
    --bg-base: #0b0f19;
    --bg-surface: rgba(17, 25, 40, 0.75);
    --bg-surface-hover: rgba(22, 33, 54, 0.85);
    --border-color: rgba(255, 255, 255, 0.08);
    
    --color-text-primary: #f3f4f6;
    --color-text-secondary: #9ca3af;
    --color-text-muted: #6b7280;

    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-glow: rgba(99, 102, 241, 0.15);
    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    
    --success: #10b981;
    --success-light: #34d399;
    --success-glow: rgba(16, 185, 129, 0.15);
    
    --warning: #f59e0b;
    
    --danger: #ef4444;
    --danger-light: #f87171;
    --danger-glow: rgba(239, 68, 68, 0.15);

    --info: #06b6d4;
    --info-light: #22d3ee;
    --info-glow: rgba(6, 182, 212, 0.15);

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.4);
    
    --font-sans: 'Inter', sans-serif;
    --font-display: 'Outfit', sans-serif;
}

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

body {
    background-color: var(--bg-base);
    color: var(--color-text-primary);
    font-family: var(--font-sans);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    position: relative;
}

/* Background decorative glow */
.bg-glow {
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.08) 0%, rgba(168, 85, 247, 0.05) 50%, rgba(0,0,0,0) 70%);
    top: -200px;
    right: -100px;
    z-index: -1;
    pointer-events: none;
}

/* Glassmorphism utility */
.glass {
    background: var(--bg-surface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.3s ease;
}

/* Typography and Gradients */
.text-gradient {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.icon-gradient {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Navbar */
.navbar {
    border-bottom: 1px solid var(--border-color);
    background: rgba(11, 15, 25, 0.8);
    backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.5rem;
}

.logo-text {
    letter-spacing: -0.5px;
}

.logo-alt {
    color: var(--primary-light);
    font-weight: 800;
}

.system-status {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.15);
    border-radius: 50%;
}

.status-dot {
    width: 8px;
    height: 8px;
    background-color: var(--success);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--success);
    animation: pulse 2s infinite;
}

/* Main Layout */
.dashboard-container {
    flex: 1;
    max-width: 1280px;
    width: 100%;
    margin: 1.25rem auto;
    padding: 0 2rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Control Panel */
.control-panel {
    padding: 2rem;
    margin-bottom: 2rem;
}

.panel-title {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.panel-subtitle {
    color: var(--color-text-secondary);
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
}

.selector-form {
    display: grid;
    grid-template-columns: 1fr 1fr auto;
    gap: 1.5rem;
    align-items: flex-end;
}

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

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-secondary);
}

.form-group label i {
    margin-right: 0.35rem;
    color: var(--primary-light);
}

.select-wrapper {
    position: relative;
}

.select-wrapper::after {
    content: '\f078';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    right: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--color-text-muted);
    font-size: 0.85rem;
    transition: color 0.2s ease;
}

select {
    width: 100%;
    padding: 0.85rem 1.25rem;
    background: rgba(17, 25, 40, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--color-text-primary);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    appearance: none;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

select option {
    background-color: var(--bg-base);
    color: var(--color-text-primary);
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: 0.9rem 2rem;
    border-radius: 10px;
    font-weight: 600;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
    filter: brightness(1.1);
}

.btn-primary:active {
    transform: translateY(1px);
}

.btn-dark {
    background: rgba(255, 255, 255, 0.05);
    color: var(--color-text-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-weight: 600;
    font-family: var(--font-sans);
    padding: 0.85rem 1.5rem;
    font-size: 0.95rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s, transform 0.2s;
}

.btn-dark:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--color-text-primary);
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

.btn-dark:active {
    background: rgba(255, 255, 255, 0.03);
    transform: translateY(1px);
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.8rem;
    border-radius: 6px;
}

/* Spinner and Loaders */
.loader-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem;
    gap: 1.5rem;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.05);
    border-radius: 50%;
    border-top-color: var(--primary-light);
    animation: spin 1s linear infinite;
}

.loader-container p {
    color: var(--color-text-secondary);
    font-size: 0.95rem;
    letter-spacing: 0.2px;
}

/* Alerts */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.95rem;
}

.alert-danger {
    background: var(--danger-glow);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: var(--danger-light);
}

.hidden {
    display: none !important;
}

/* Dashboard Grid Layout */
.dashboard-grid {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    animation: fadeIn 0.4s ease-out;
}

.col-span-2 {
    grid-column: span 2 / span 2;
}

.col-span-full {
    grid-column: span 3 / span 3;
}

/* Agent Meta Card */
.agent-card {
    padding: 1.75rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
}

@media (max-width: 640px) {
    .agent-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.5rem;
    }
}

.agent-profile {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.avatar {
    width: 60px;
    height: 60px;
    background: var(--primary-glow);
    border: 1px solid rgba(99, 102, 241, 0.25);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    color: var(--primary-light);
}

.agent-meta {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.agent-title {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 700;
}

.badges-row {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.badge-info {
    background: var(--info-glow);
    border: 1px solid rgba(6, 182, 212, 0.2);
    color: var(--info-light);
}

.badge-dark {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--color-text-secondary);
}

.badge-rules {
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.25);
    color: var(--primary-light);
}

body.light-mode .badge-rules {
    background: rgba(99, 102, 241, 0.05);
    border-color: rgba(99, 102, 241, 0.2);
    color: #4f46e5;
}

.badge-danger-outline {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: var(--danger-light);
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

body.light-mode .badge-danger-outline {
    background: rgba(239, 68, 68, 0.05);
    border-color: rgba(239, 68, 68, 0.20);
    color: #dc2626;
}

/* Eligibility Render block */
.eligibility-container {
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.5rem;
}

@media (max-width: 640px) {
    .eligibility-container {
        text-align: left;
        align-items: flex-start;
    }
}

/* Net Payout Display in Agent Card */
.agent-payout-display {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    text-align: left;
}

.agent-payout-display .payout-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--color-text-secondary);
    margin-bottom: 0.15rem;
}

.agent-payout-display .payout-value {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1.1;
}

/* Agent Info Group (Aligns Profile and Payout closely on the left) */
.agent-info-group {
    display: flex;
    align-items: center;
    gap: 2.5rem;
}

.agent-card-divider {
    width: 1px;
    height: 40px;
    background: var(--border-color);
}

/* Agent Status Actions Block (Right side of Agent Card) */
.agent-status-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

@media (max-width: 900px) {
    .agent-info-group {
        gap: 1.25rem;
        flex-direction: column;
        align-items: flex-start;
    }
    .agent-card-divider {
        display: none; /* Hide divider when stacked */
    }
}

@media (max-width: 768px) {
    .agent-card {
        flex-direction: column;
        align-items: stretch;
        gap: 1.5rem;
    }
    .agent-status-actions {
        align-self: flex-start;
    }
}

/* Compact Month Editor inside Agent Card */
.inline-edit-month {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.inline-edit-month .edit-month-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.inline-edit-month .edit-month-label i {
    color: var(--primary-light);
}

/* Compact Select Dropdown Styling */
.compact-select {
    width: 165px; /* Increased from 130px to prevent clipping month names */
}

.compact-select::after {
    right: 0.75rem !important;
    font-size: 0.7rem !important;
}

.compact-select select {
    padding: 0.25rem 1.75rem 0.25rem 0.5rem !important;
    font-size: 0.75rem !important;
    height: 32px !important;
    border-radius: 6px !important;
    background: rgba(255, 255, 255, 0.02) !important;
}

body.light-mode .compact-select select {
    background: rgba(0, 0, 0, 0.02) !important;
}

/* Compact Edit Button (Sleek colored background matching app aesthetics) */
.btn-compact-edit {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-glow);
    color: var(--primary-light);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.75rem;
    transition: background-color 0.2s, border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.btn-compact-edit:hover {
    background: var(--primary-gradient);
    color: white;
    border-color: transparent;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.btn-compact-edit:active {
    transform: translateY(1px);
}

body.light-mode .btn-compact-edit {
    background: rgba(99, 102, 241, 0.05);
    border-color: rgba(99, 102, 241, 0.20);
    color: #4f46e5;
}

body.light-mode .btn-compact-edit:hover {
    background: #4f46e5;
    color: white;
    border-color: #4f46e5;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
}

.eligibility-badge {
    padding: 0.25rem 0.65rem;
    border-radius: 6px;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    box-shadow: var(--shadow-sm);
}

.eligibility-badge.eligible {
    background: var(--success-glow);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--success-light);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.15);
}

.eligibility-badge.not-eligible {
    background: var(--danger-glow);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger-light);
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.15);
}

.eligibility-reason {
    color: var(--color-text-secondary);
    font-size: 0.85rem;
    max-width: 300px;
    line-height: 1.4;
}

/* Section titles */
.section-title {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-title::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 18px;
    background: var(--primary-gradient);
    border-radius: 2px;
}

/* Metrics Cards Grid */
.metrics-section {
    display: flex;
    flex-direction: column;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1.25rem;
    width: 100%;
}

@media (max-width: 1024px) {
    .metrics-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

.metric-card {
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
}

.metric-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: var(--shadow-lg);
}

.metric-card-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
}

.metric-card-icon {
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.metric-card-icon.val-volume { color: var(--primary-light); }
.metric-card-icon.val-units { color: var(--info-light); }
.metric-card-icon.val-insurance { color: var(--warning); }
.metric-card-icon.val-prequals { color: var(--success-light); }
.metric-card-icon.val-ctc { color: #c084fc; }

.metric-label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--color-text-secondary);
}

.metric-value {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
}

/* Points Breakdown Section */
.points-section {
    padding: 1.75rem;
    display: flex;
    flex-direction: column;
}

.score-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

.score-label {
    font-weight: 600;
    font-family: var(--font-display);
    font-size: 1rem;
    color: var(--color-text-secondary);
}

.score-value {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 800;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.breakdown-list {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    overflow-y: auto;
    max-height: 400px;
    padding-right: 0.5rem;
}

/* Custom Scrollbar for breakdown */
.breakdown-list::-webkit-scrollbar {
    width: 6px;
}
.breakdown-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 3px;
}
.breakdown-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.breakdown-group {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.group-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.75px;
    color: var(--color-text-muted);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 0.35rem;
    margin-bottom: 0.2rem;
}

.breakdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}

.breakdown-item span:first-child {
    color: var(--color-text-primary);
}

.credit {
    color: var(--info-light);
    font-weight: 600;
}

.penalty {
    color: var(--danger-light);
    font-weight: 600;
}

.bonus {
    color: var(--success-light);
    font-weight: 600;
}

/* Financial Section */
.financial-section {
    padding: 2rem;
}

.financial-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
}

@media (max-width: 1024px) {
    .financial-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .financial-grid {
        grid-template-columns: 1fr;
    }
}

.fin-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    position: relative;
    overflow: hidden;
}

.fin-card.highlight {
    background: rgba(99, 102, 241, 0.06);
    border: 1px solid rgba(99, 102, 241, 0.35);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.1);
}

.fin-card.highlight::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--primary-gradient);
}

.fin-label {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--color-text-secondary);
}

.fin-value {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 800;
}

.net-value {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

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

/* Footer */
.footer {
    border-top: 1px solid var(--border-color);
    padding: 2rem;
    text-align: center;
    background: rgba(11, 15, 25, 0.9);
}

.footer p {
    color: var(--color-text-muted);
    font-size: 0.85rem;
}

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

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

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
    }
    70% {
        box-shadow: 0 0 0 8px rgba(16, 185, 129, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

/* Nav Tabs */
.nav-tabs {
    display: flex;
    gap: 0.75rem;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--color-text-secondary);
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: background 0.2s, color 0.2s;
}

.tab-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--color-text-primary);
}

.tab-btn.active {
    background: var(--primary-glow);
    border: 1px solid rgba(99, 102, 241, 0.2);
    color: var(--primary-light);
}

@media (max-width: 768px) {
    .nav-tabs {
        order: 3;
        width: 100%;
        justify-content: flex-start;
        margin-top: 1rem;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 6px;
        gap: 0.5rem;
        scrollbar-width: none;
    }
    .nav-tabs::-webkit-scrollbar {
        display: none;
    }
    .tab-btn {
        flex-shrink: 0;
        font-size: 0.85rem;
        padding: 0.4rem 0.75rem;
    }
    .nav-container {
        flex-wrap: wrap;
        padding: 0.75rem 1rem;
    }
    .logo {
        font-size: 1.25rem;
    }
    .dashboard-container {
        padding: 0 1rem;
        margin: 1rem auto;
    }
}

/* Form Layouts & Inputs */
.card-form-container {
    padding: 2.5rem;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.standard-form {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.metrics-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 640px) {
    .metrics-form-grid {
        grid-template-columns: 1fr;
    }
    .metrics-form-grid .col-span-2 {
        grid-column: span 1 / span 1 !important;
    }
}

.form-section-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary-light);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
    margin-top: 1rem;
}

input[type="text"], input[type="number"], input[type="month"] {
    width: 100%;
    padding: 0.85rem 1.25rem;
    background: rgba(17, 25, 40, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--color-text-primary);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input[type="text"]:focus, input[type="number"]:focus, input[type="month"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

/* Custom Checkboxes */
.checkbox-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-top: 0.5rem;
}

@media (min-width: 640px) {
    .checkbox-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.checkbox-container {
    display: flex;
    align-items: center;
    position: relative;
    padding-left: 2.25rem;
    cursor: pointer;
    font-size: 0.95rem;
    user-select: none;
    min-height: 24px;
}

.checkbox-container input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

.checkmark {
    position: absolute;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    height: 22px;
    width: 22px;
    background-color: rgba(17, 25, 40, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    transition: background-color 0.2s, border-color 0.2s;
}

.checkbox-container:hover input ~ .checkmark {
    background-color: rgba(255, 255, 255, 0.05);
}

.checkbox-container input:checked ~ .checkmark {
    background-color: var(--primary);
    border-color: var(--primary);
}

.checkmark:after {
    content: "";
    position: absolute;
    display: none;
}

.checkbox-container input:checked ~ .checkmark:after {
    display: block;
}

.checkbox-container .checkmark:after {
    left: 7px;
    top: 3px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

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

.form-submit-btn {
    margin-top: 1.5rem;
}

/* Logout Button */
.btn-logout {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: #f87171;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
}

body.light-mode .btn-logout {
    background: rgba(239, 68, 68, 0.05);
    border-color: rgba(239, 68, 68, 0.2);
    color: #dc2626;
}

body.light-mode .btn-logout:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
}

/* Theme Toggle Button & Light Mode styling */
.theme-toggle-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--color-text-primary);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: background-color 0.2s, border-color 0.2s;
}

.theme-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
}

body.light-mode {
    --bg-base: #f3f4f6; /* Slate 100 */
    --bg-surface: rgba(255, 255, 255, 0.7);
    --bg-surface-hover: rgba(255, 255, 255, 0.85);
    --border-color: rgba(0, 0, 0, 0.08);
    
    --color-text-primary: #111827; /* Gray 900 */
    --color-text-secondary: #4b5563; /* Gray 600 */
    --color-text-muted: #9ca3af; /* Gray 400 */
    
    --primary-glow: rgba(99, 102, 241, 0.08);
    --primary-light: #4f46e5; /* Indigo 600 */
    
    /* Modify card backdrops */
    --bg-glow: radial-gradient(circle, rgba(99, 102, 241, 0.05) 0%, rgba(168, 85, 247, 0.03) 50%, rgba(0,0,0,0) 70%);
}

body.light-mode .navbar {
    background: rgba(255, 255, 255, 0.8);
    border-bottom-color: rgba(0, 0, 0, 0.06);
}

body.light-mode select,
body.light-mode input[type="text"],
body.light-mode input[type="number"],
body.light-mode input[type="month"] {
    background: rgba(255, 255, 255, 0.8);
    color: #111827;
    border-color: rgba(0, 0, 0, 0.12);
}

body.light-mode select option {
    background-color: #ffffff;
    color: #111827;
}

body.light-mode .checkmark {
    background-color: rgba(255, 255, 255, 0.8);
    border-color: rgba(0, 0, 0, 0.12);
}

body.light-mode .group-title {
    border-bottom-color: rgba(0, 0, 0, 0.08);
}

body.light-mode .score-summary {
    background: rgba(0, 0, 0, 0.02);
    border-color: rgba(0, 0, 0, 0.06);
}

body.light-mode .fin-card {
    background: rgba(0, 0, 0, 0.01);
    border-color: rgba(0, 0, 0, 0.06);
}

body.light-mode .system-status {
    background: rgba(16, 185, 129, 0.05);
    border-color: rgba(16, 185, 129, 0.12);
}

body.light-mode .tab-btn:hover {
    background: rgba(0, 0, 0, 0.03);
}

body.light-mode .theme-toggle-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.2);
}

/* Secondary Button Styles */
.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--color-text-primary);
    border: 1px solid var(--border-color);
    padding: 0.9rem 2rem;
    border-radius: 10px;
    font-weight: 600;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    transition: background-color 0.2s, border-color 0.2s, transform 0.2s;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.btn-secondary:active {
    transform: translateY(1px);
}

body.light-mode .btn-secondary {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.12);
    color: #111827;
}

body.light-mode .btn-secondary:hover {
    background: rgba(0, 0, 0, 0.06);
    border-color: rgba(0, 0, 0, 0.2);
}

/* Agents Table Styles */
.agents-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.95rem;
    margin-top: 1rem;
}

.agents-table th, .agents-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.agents-table th {
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
}

.agents-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

body.light-mode .agents-table tbody tr:hover {
    background: rgba(0, 0, 0, 0.01);
}

.actions-cell {
    text-align: right;
    vertical-align: middle;
}

.actions-cell-wrapper {
    display: inline-flex;
    gap: 0.5rem;
    justify-content: flex-end;
    align-items: center;
}

.btn-action {
    border: none;
    background: transparent;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background-color 0.2s, color 0.2s;
}

.btn-action.edit-btn {
    color: var(--info-light);
    border: 1px solid rgba(6, 182, 212, 0.15);
    background: rgba(6, 182, 212, 0.05);
}

.btn-action.edit-btn:hover {
    background: var(--info-glow);
    color: var(--info-light);
}

.btn-action.delete-btn {
    color: var(--danger-light);
    border: 1px solid rgba(239, 68, 68, 0.15);
    background: rgba(239, 68, 68, 0.05);
}

.btn-action.delete-btn:hover {
    background: var(--danger-glow);
    color: var(--danger-light);
}

/* Modal styles & keyframes */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(11, 15, 25, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-out;
}

.modal-content {
    max-width: 500px;
    width: 90%;
    border-radius: 16px;
    overflow: hidden;
    background: #111c30; /* Solid dark background to prevent backdrop muddying */
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

body.light-mode .modal-content {
    background: #ffffff; /* Solid light background to ensure high readability */
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
}

body.light-mode .modal-header {
    border-bottom-color: rgba(0, 0, 0, 0.08);
}

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

.modal-body {
    padding: 2rem;
}

.btn-close-modal {
    background: transparent;
    border: none;
    color: var(--color-text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s;
}

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

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Selected row highlight styling */
.agents-table tbody tr {
    cursor: pointer;
    transition: background-color 0.2s;
}

.agents-table tbody tr.selected {
    background: rgba(99, 102, 241, 0.1) !important;
    border-left: 3px solid var(--primary-light);
}

body.light-mode .agents-table tbody tr.selected {
    background: rgba(99, 102, 241, 0.05) !important;
}

/* Button danger for modal delete */
.btn-danger {
    background: var(--danger-glow);
    border: 1px solid rgba(239, 68, 68, 0.3) !important;
    color: var(--danger-light);
    transition: background-color 0.2s, filter 0.2s;
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
    filter: brightness(1.1);
}

#statement-rules-version {
    cursor: pointer;
    transition: background-color 0.2s, transform 0.15s;
}

#statement-rules-version:hover {
    background: rgba(99, 102, 241, 0.18);
    transform: scale(1.05);
}

/* Premium Input Enhancements */
.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.input-wrapper.has-prefix input {
    padding-left: 2.2rem !important;
}

.input-wrapper.has-suffix input {
    padding-right: 4.8rem !important;
}

.input-prefix {
    position: absolute;
    left: 0.95rem;
    color: var(--color-text-secondary);
    font-weight: 600;
    pointer-events: none;
    font-size: 0.95rem;
}

.input-suffix {
    position: absolute;
    right: 0.85rem;
    color: var(--color-text-secondary);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    pointer-events: none;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

body.light-mode .input-suffix {
    background: rgba(0, 0, 0, 0.03);
    color: #4b5563;
}

.input-wrapper.is-deduction .input-suffix {
    color: #f87171;
    border-color: rgba(248, 113, 113, 0.25);
    background: rgba(248, 113, 113, 0.08);
}

body.light-mode .input-wrapper.is-deduction .input-suffix {
    color: #dc2626;
    border-color: rgba(220, 38, 38, 0.2);
    background: rgba(220, 38, 38, 0.05);
}

.input-wrapper.is-bonus .input-suffix {
    color: #34d399;
    border-color: rgba(52, 211, 153, 0.25);
    background: rgba(52, 211, 153, 0.08);
}

body.light-mode .input-wrapper.is-bonus .input-suffix {
    color: #059669;
    border-color: rgba(5, 150, 105, 0.2);
    background: rgba(5, 150, 105, 0.05);
}

/* Remove default number spin buttons */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}

input[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* Rules Tab Quarter Cards */
.quarter-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
}

.quarter-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: transparent;
    transition: background-color 0.25s ease;
}

.quarter-card:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(99, 102, 241, 0.25);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.quarter-card.active-card {
    background: rgba(99, 102, 241, 0.06);
    border-color: var(--primary-color);
}

.quarter-card.active-card::before {
    background: var(--primary-color);
}

.quarter-card .q-name {
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-text-primary);
}

.quarter-card .q-status {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    font-weight: 500;
}

.quarter-card.configured .q-status {
    color: var(--success-light);
}

body.light-mode .quarter-card {
    background: #ffffff;
    border-color: #e5e7eb;
}

body.light-mode .quarter-card:hover {
    background: #f9fafb;
    border-color: #cbd5e1;
}

body.light-mode .quarter-card.active-card {
    background: rgba(99, 102, 241, 0.04);
    border-color: #4f46e5;
}

body.light-mode .quarter-card.active-card::before {
    background: #4f46e5;
}

/* Login Screen styles */
.login-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 2rem;
    position: relative;
    z-index: 10;
}

.login-card {
    width: 100%;
    max-width: 440px;
    padding: 3rem 2.5rem;
    text-align: center;
    box-shadow: var(--shadow-lg);
    border-radius: 20px;
}

.login-header {
    margin-bottom: 2rem;
}

.login-card input[type="text"],
.login-card input[type="password"] {
    width: 100%;
    padding: 0.85rem 1.25rem;
    background: rgba(17, 25, 40, 0.5);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--color-text-primary);
    font-family: var(--font-sans);
    font-size: 0.95rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.login-card input[type="text"]:focus,
.login-card input[type="password"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

body.light-mode .login-card input[type="text"],
body.light-mode .login-card input[type="password"] {
    background: rgba(255, 255, 255, 0.8);
    border-color: #d1d5db;
    color: #1f2937;
}

/* Fade in animation */
.animate-fade-in {
    animation: loginFadeIn 0.4s ease-out;
}

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

/* Custom Confirm Modal */
.confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.2s ease;
}

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

.confirm-modal {
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
    border-radius: 16px;
    padding: 2rem;
    max-width: 420px;
    width: 90%;
    text-align: center;
    transform: scale(0.9);
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.confirm-overlay.active .confirm-modal {
    transform: scale(1);
}

.confirm-icon {
    font-size: 2.5rem;
    color: #ef4444;
    margin-bottom: 1rem;
    animation: pulse 2s infinite;
}

.confirm-message {
    font-size: 1rem;
    font-weight: 500;
    color: var(--color-text-primary);
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

.confirm-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.confirm-btn-cancel {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--color-text-secondary);
    padding: 0.65rem 1.25rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.confirm-btn-cancel:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--color-text-primary);
}

.confirm-btn-ok {
    background: #ef4444;
    border: none;
    color: white;
    padding: 0.65rem 1.25rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(239, 68, 68, 0.2);
    transition: background 0.2s, transform 0.2s;
}

.confirm-btn-ok:hover {
    background: #dc2626;
}

body.light-mode .confirm-modal {
    background: rgba(255, 255, 255, 0.8);
    border-color: rgba(0, 0, 0, 0.08);
}

body.light-mode .confirm-btn-cancel {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.08);
    color: #4b5563;
}

body.light-mode .confirm-btn-cancel:hover {
    background: rgba(0, 0, 0, 0.08);
    color: #111827;
}

/* Align rules page eligibility and exception labels */
.align-labels-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}
.align-labels-grid.col-2 {
    grid-template-columns: repeat(2, 1fr);
}
.align-labels-grid .form-group {
    display: flex;
    flex-direction: column;
}
.align-labels-grid label {
    min-height: 2.8rem;
    display: flex;
    align-items: flex-end;
    margin-bottom: 0.5rem;
}

/* Responsive scale and custom rules rows styling */
.scale-range-row {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    width: 100%;
}
.custom-rule-row {
    display: flex;
    gap: 1rem;
    align-items: center;
    width: 100%;
}

@media (max-width: 768px) {
    .align-labels-grid, .align-labels-grid.col-2 {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .align-labels-grid label {
        min-height: auto;
        display: block;
        margin-bottom: 0.25rem;
    }
}

@media (max-width: 500px) {
    .scale-range-row {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
        padding: 0.75rem;
        background: rgba(255, 255, 255, 0.02);
        border: 1px solid var(--border-color);
        border-radius: 8px;
    }
    .custom-rule-row {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
        padding: 0.75rem;
        background: rgba(255, 255, 255, 0.02);
        border: 1px solid var(--border-color);
        border-radius: 8px;
    }
    .scale-header-row {
        display: none !important;
    }
}
