/* CSS Variables for Premium Aesthetics */
:root {
    --bg-main: #0B0F19;
    --bg-card: rgba(22, 28, 45, 0.7);
    --bg-card-hover: rgba(30, 39, 62, 0.85);
    --border-color: rgba(255, 255, 255, 0.08);
    --text-primary: #F3F4F6;
    --text-secondary: #9CA3AF;
    --bg-input: rgba(17, 24, 39, 0.6);
    --bg-rule-item: rgba(17, 24, 39, 0.4);
    --bg-candidate-row: rgba(17, 24, 39, 0.3);
    --bg-toast: #1F2937;
    --toast-shadow: 0 4px 12px rgba(0,0,0,0.5);
    --bg-slider: rgba(255, 255, 255, 0.15);
    
    --color-primary: #6366F1; /* Indigo */
    --color-primary-hover: #4F46E5;
    --color-accent: #8B5CF6; /* Violet */
    --color-success: #10B981; /* Emerald Green */
    --color-danger: #EF4444; /* Crimson Red */
    --color-warning: #F59E0B; /* Amber */
    
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --shadow-premium: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body.light-theme {
    --bg-main: #F3F4F6;
    --bg-card: rgba(255, 255, 255, 0.85);
    --bg-card-hover: rgba(243, 244, 246, 0.95);
    --border-color: rgba(0, 0, 0, 0.08);
    --text-primary: #1F2937;
    --text-secondary: #4B5563;
    --bg-input: #FFFFFF;
    --bg-rule-item: rgba(243, 244, 246, 0.9);
    --bg-candidate-row: rgba(243, 244, 246, 0.7);
    --bg-toast: #FFFFFF;
    --toast-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    --bg-slider: #D1D5DB;
    --shadow-premium: 0 10px 30px -10px rgba(0, 0, 0, 0.08);
}

/* Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.6;
    padding: 2rem;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Header */
header {
    margin-bottom: 2.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1.5rem;
}

h1 {
    font-size: 2.25rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--text-primary) 30%, var(--color-primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.025em;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: 0.25rem;
}

/* Layout Grid */
.layout-grid {
    display: grid;
    grid-template-columns: 1.5fr 1.0fr;
    gap: 2rem;
}

@media (max-width: 900px) {
    .layout-grid {
        grid-template-columns: 1fr;
    }
}

/* Cards & Glassmorphism */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.75rem;
    box-shadow: var(--shadow-premium);
    backdrop-filter: blur(12px);
    transition: var(--transition-smooth);
}

.card:hover {
    border-color: rgba(99, 102, 241, 0.2);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Forms & Inputs */
.form-group {
    margin-bottom: 1.25rem;
}

label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

input, select, textarea {
    width: 100%;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition-smooth);
}

input:focus, select:focus, textarea:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: var(--transition-smooth);
    font-size: 0.95rem;
    gap: 0.5rem;
}

.btn-primary {
    background-color: var(--color-primary);
    color: #FFF;
}

.btn-primary:hover {
    background-color: var(--color-primary-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.btn-danger {
    background-color: var(--color-danger);
    color: #FFF;
}

.btn-danger:hover {
    background-color: #DC2626;
}

/* Rules Selection List */
.rules-list {
    margin-top: 1rem;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.rule-item {
    background: var(--bg-rule-item);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.rule-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.rule-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.rule-meta {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-top: 0.25rem;
}

.rule-meta-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.rule-meta-group label {
    font-size: 0.7rem;
    margin-bottom: 0;
}

.rule-meta-group input {
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-slider);
    transition: .4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--color-success);
}

input:checked + .slider:before {
    transform: translateX(20px);
}

/* Evaluation Output Area */
.results-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.shift-result-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
}

.shift-result-header {
    font-weight: bold;
    font-size: 1.1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
    margin-bottom: 1rem;
    color: var(--color-accent);
}

.candidate-row {
    background: var(--bg-candidate-row);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    transition: var(--transition-smooth);
}

.candidate-row:hover {
    background: var(--bg-card-hover);
}

.candidate-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.candidate-name {
    font-weight: 600;
    font-size: 1rem;
}

.candidate-score {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-success);
}

.candidate-logs {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    border-left: 2px solid var(--border-color);
    padding-left: 0.75rem;
}

.log-item {
    margin-top: 0.25rem;
}

/* Toast Notification */
#toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background-color: var(--bg-toast);
    color: var(--text-primary);
    border-left: 4px solid var(--color-primary);
    padding: 1rem 1.5rem;
    border-radius: 6px;
    box-shadow: var(--toast-shadow);
    transform: translateY(150%);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1000;
}

#toast.show {
    transform: translateY(0);
}

/* Tabbed Interface Sandbox */
.tabs-header {
    display: flex;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 6px;
    transition: var(--transition-smooth);
}

.tab-btn:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.05);
}

body.light-theme .tab-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.tab-btn.active {
    color: #FFF;
    background-color: var(--color-primary);
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

/* Modal Overlay and Content */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(11, 15, 25, 0.8);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.modal-content {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    width: 95%;
    max-width: 1200px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-premium);
    overflow: hidden;
    animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--text-primary);
}

.modal-close-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    transition: var(--transition-smooth);
}

.modal-close-btn:hover {
    color: var(--color-danger);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Tabular Details Grid */
.details-table-wrapper {
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--bg-input);
}

.details-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.85rem;
}

.details-table th,
.details-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.details-table th {
    background-color: rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

body.light-theme .details-table th {
    background-color: rgba(0, 0, 0, 0.02);
}

.details-table tr:last-child td {
    border-bottom: none;
}

.details-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

body.light-theme .details-table tbody tr:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

/* Progress Indicator Card and Bouncing Dots */
.progress-indicator-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2.5rem;
    max-width: 600px;
    margin: 4rem auto;
    box-shadow: var(--shadow-premium);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.progress-spinner {
    display: flex;
    gap: 8px;
    margin-bottom: 2rem;
}

.dot-bounce {
    width: 14px;
    height: 14px;
    background-color: var(--color-primary);
    border-radius: 50%;
    animation: dotBounce 1.4s infinite ease-in-out both;
}

.dot-bounce:nth-child(1) { animation-delay: -0.32s; }
.dot-bounce:nth-child(2) { animation-delay: -0.16s; }

@keyframes dotBounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1.0); }
}

.progress-steps {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
    max-width: 400px;
}

.progress-step {
    font-size: 0.9rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0.4;
    transition: all 0.3s ease;
    text-align: left;
}

.progress-step.active {
    opacity: 1;
    color: var(--text-primary);
    font-weight: 500;
}

.progress-step.success {
    opacity: 0.9;
    color: var(--color-success);
}

.progress-step::before {
    content: "•";
    font-size: 1.25rem;
    display: inline-block;
    width: 20px;
    text-align: center;
}

.progress-step.active::before {
    content: "⚡";
    animation: pulse-icon 1s infinite alternate;
}

.progress-step.success::before {
    content: "✓";
    font-weight: bold;
}

@keyframes pulse-icon {
    from { opacity: 0.6; }
    to { opacity: 1; }
}

