:root {
    --primary: #6366f1;
    --primary-light: #818cf8;
    --secondary: #8b5cf6;
    --danger: #ef4444;
    --success: #22c55e;
    --warning: #f59e0b;
    --bg: #f8fafc;
    --bg-secondary: #e2e8f0;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.1);
}

body.dark-mode {
    --bg: #0f172a;
    --bg-secondary: #1e293b;
    --text: #f1f5f9;
    --text-light: #cbd5e1;
    --border: #334155;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg);
    color: var(--text);
    padding: 0;
    transition: background-color 0.3s, color 0.3s;
}

.app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navbar */
.navbar {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    padding: 0;
    box-shadow: var(--shadow-lg);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.nav-buttons {
    display: flex;
    gap: 1rem;
}

.nav-btn {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

/* Container */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    flex: 1;
    width: 100%;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid var(--border);
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header p {
    color: var(--text-light);
    font-size: 1.1rem;
}

.header-stats {
    display: flex;
    gap: 2rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--bg-secondary);
    padding: 1.5rem 2rem;
    border-radius: 10px;
    min-width: 150px;
}

.stat-label {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

/* Tabs */
.tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--border);
}

.tab-btn {
    padding: 1rem 1.5rem;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    color: var(--text-light);
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s;
    position: relative;
    margin-bottom: -2px;
}

.tab-btn:hover {
    color: var(--primary);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Section */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.section-header h3 {
    font-size: 1.5rem;
}

.controls-top {
    display: flex;
    gap: 1rem;
}

.controls-top input {
    padding: 0.75rem 1rem;
    border: 2px solid var(--border);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text);
    font-size: 1rem;
    transition: all 0.3s;
}

.controls-top input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Grid */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: var(--text-light);
    font-size: 1.1rem;
}

/* Card */
.card {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: var(--shadow);
    transition: all 0.3s;
    border: 1px solid var(--border);
}

.card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.card-header h4 {
    font-size: 1.3rem;
    margin: 0;
}

.btn-icon {
    background: transparent;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.25rem;
    transition: all 0.2s;
}

.btn-icon:hover {
    transform: scale(1.3);
}

.percentage {
    font-size: 2.5rem;
    font-weight: 700;
    margin: 1rem 0;
    text-align: center;
}

.percentage.excellent {
    color: #22c55e;
}

.percentage.good {
    color: #3b82f6;
}

.percentage.warning {
    color: #f59e0b;
}

.percentage.critical {
    color: #ef4444;
}

.card-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin: 1rem 0;
    padding: 1rem 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.stat {
    text-align: center;
}

.stat .label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}

.stat .value {
    display: block;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary);
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border);
    border-radius: 10px;
    overflow: hidden;
    margin: 1rem 0;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    transition: width 0.3s ease;
}

/* Buttons */
button {
    font-family: inherit;
    transition: all 0.3s;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    font-size: 1rem;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.2);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--primary);
    padding: 0.75rem 1.5rem;
    border: 2px solid var(--primary);
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    font-size: 1rem;
}

.btn-secondary:hover {
    background: var(--primary);
    color: white;
}

.btn-danger {
    background: #fee2e2;
    color: #991b1b;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    font-size: 1rem;
}

.btn-danger:hover {
    background: #fecaca;
}

.controls {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
}

.controls button {
    flex: 1;
    padding: 0.75rem;
    border-radius: 6px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.3s;
}

.btn-att {
    background: #dcfce7;
    color: #166534;
}

.btn-att:hover {
    background: #bbf7d0;
    transform: scale(1.05);
}

.btn-bunk {
    background: #fee2e2;
    color: #991b1b;
}

.btn-bunk:hover {
    background: #fecaca;
    transform: scale(1.05);
}

/* Input Group */
.input-group {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.input-group input {
    flex: 1;
    min-width: 200px;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border);
    border-radius: 6px;
    background: var(--bg-secondary);
    color: var(--text);
    font-size: 1rem;
    transition: all 0.3s;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Setup Section */
.setup-section {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

/* Analytics */
.analytics {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.analytics h3 {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
}

.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
}

.analytics-box {
    background: var(--bg);
    padding: 1.5rem;
    border-radius: 10px;
    border: 1px solid var(--border);
}

.analytics-box h4 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.analytics-box canvas {
    max-width: 100%;
    height: auto;
}

.insights-box {
    display: flex;
    flex-direction: column;
}

.insights-box p {
    padding: 0.75rem;
    margin: 0.5rem 0;
    background: var(--bg-secondary);
    border-left: 4px solid var(--primary);
    border-radius: 4px;
    font-weight: 500;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--bg-secondary);
    padding: 2rem;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

.close {
    color: var(--text-light);
    float: right;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s;
}

.close:hover {
    color: var(--danger);
}

.modal-content h2 {
    margin-bottom: 1.5rem;
    color: var(--text);
}

.settings-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.setting-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
}

.setting-item:hover {
    background: var(--border);
}

.setting-item input {
    cursor: pointer;
    width: 18px;
    height: 18px;
}

/* Notification */
.notification {
    position: fixed;
    bottom: -100px;
    right: 20px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    font-weight: 600;
    transition: all 0.3s;
    z-index: 2000;
}

.notification.show {
    bottom: 20px;
}

/* Dashboard Section */
.dashboard {
    animation: fadeIn 0.3s;
}

.dashboard h3 {
    font-size: 1.5rem;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1.5rem;
    }

    .header h1 {
        font-size: 1.8rem;
    }

    .header-stats {
        width: 100%;
        justify-content: space-around;
    }

    .stat-item {
        min-width: auto;
        flex: 1;
    }

    .nav-container {
        padding: 1rem;
        flex-direction: column;
        gap: 1rem;
    }

    .grid {
        grid-template-columns: 1fr;
    }

    .tabs {
        flex-wrap: wrap;
    }

    .tab-btn {
        padding: 0.75rem 1rem;
        font-size: 0.95rem;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .controls-top {
        width: 100%;
        flex-direction: column;
    }

    .controls-top input,
    .input-group input {
        width: 100%;
    }

    .input-group {
        flex-direction: column;
    }

    .input-group button {
        width: 100%;
    }

    .analytics-grid {
        grid-template-columns: 1fr;
    }

    .actions {
        flex-direction: column;
    }

    .actions button {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0.75rem;
    }

    .logo {
        font-size: 1.2rem;
    }

    .header h1 {
        font-size: 1.5rem;
    }

    .card-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .controls {
        flex-direction: column;
    }
}