@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

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

:root {
    /* Light Mode (Default) */
    --primary: #0891b2;
    --primary-dark: #0e7490;
    --primary-light: #22d3ee;
    --accent: #06b6d4;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;

    --bg-gradient-start: #0891b2;
    --bg-gradient-end: #14b8a6;
    --bg-body: #f0fdfa;
    --bg-card: #ffffff;
    --bg-card-hover: #f8fafc;
    --bg-input: #ffffff;
    --border: #e2e8f0;
    --border-light: #f1f5f9;

    --text: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --text-on-primary: #ffffff;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] {
    --bg-gradient-start: #134e4a;
    --bg-gradient-end: #0f766e;
    --bg-body: #0f172a;
    --bg-card: #1e293b;
    --bg-card-hover: #334155;
    --bg-input: #0f172a;
    --border: #334155;
    --border-light: #1e293b;

    --text: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-body);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
    transition: background-color 0.3s, color 0.3s;
}

/* Hero Header with Gradient */
.header {
    background: linear-gradient(135deg, var(--bg-gradient-start), var(--bg-gradient-end));
    padding: 20px 24px 60px;
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    pointer-events: none;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 40px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    backdrop-filter: blur(10px);
}

.logo-text {
    font-size: 1.4rem;
    font-weight: 700;
    color: white;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Theme Toggle */
.theme-toggle {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    transition: all 0.2s;
    backdrop-filter: blur(10px);
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* User Info */
.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 16px 8px 8px;
    border-radius: 50px;
    backdrop-filter: blur(10px);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.5);
}

.user-name {
    font-weight: 500;
    font-size: 0.9rem;
    color: white;
}

.logout-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    padding: 6px 14px;
    border-radius: 6px;
    color: white;
    font-weight: 500;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Hero Title */
.hero-title {
    text-align: center;
    color: white;
    margin-bottom: 32px;
}

.hero-title h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 12px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.hero-title p {
    font-size: 1.1rem;
    opacity: 0.9;
    max-width: 500px;
    margin: 0 auto;
}

/* Class Selector in Hero */
.class-selector {
    background: var(--bg-card);
    padding: 16px 24px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 700px;
    margin: 0 auto;
    box-shadow: var(--shadow-xl);
}

.class-selector label {
    font-weight: 500;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.class-selector select {
    min-width: 200px;
    border: 1px solid var(--border);
    background: var(--bg-input);
}

/* Main Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
}

.main-content {
    margin-top: -20px;
    position: relative;
    z-index: 10;
    padding-bottom: 40px;
}

/* Navigation Pills */
.nav-pills {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    flex-wrap: wrap;
    justify-content: center;
    background: var(--bg-card);
    padding: 8px;
    border-radius: 16px;
    box-shadow: var(--shadow);
}

.nav-pill {
    background: transparent;
    border: none;
    padding: 10px 20px;
    border-radius: 10px;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
    font-size: 0.9rem;
}

.nav-pill:hover {
    background: var(--bg-card-hover);
    color: var(--text);
}

.nav-pill.active {
    background: var(--primary);
    color: white;
}

/* Tool Cards Grid */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.tool-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    padding: 28px 24px;
    cursor: pointer;
    transition: all 0.25s ease;
    text-align: left;
    box-shadow: var(--shadow-sm);
}

.tool-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.tool-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, var(--bg-gradient-start), var(--bg-gradient-end));
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    margin-bottom: 16px;
}

.tool-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
}

.tool-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Tool Content Area */
.tool-content {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 16px;
    padding: 28px;
    margin-top: 20px;
    box-shadow: var(--shadow);
}

/* Back Button */
.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-card-hover);
    border: 1px solid var(--border);
    padding: 10px 20px;
    border-radius: 10px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 24px;
    font-size: 0.9rem;
    font-weight: 500;
}

.back-btn:hover {
    background: var(--border);
    color: var(--text);
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9rem;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 14px rgba(8, 145, 178, 0.35);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(8, 145, 178, 0.45);
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #059669);
    color: white;
}

.btn-success:hover {
    transform: translateY(-1px);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #dc2626);
    color: white;
}

.btn-danger:hover {
    transform: translateY(-1px);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning), #d97706);
    color: white;
}

.btn-secondary {
    background: var(--bg-card-hover);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
    color: var(--text);
}

/* Inputs */
input[type="text"],
input[type="number"],
input[type="email"],
input[type="date"],
textarea,
select {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 16px;
    color: var(--text);
    font-size: 0.9rem;
    width: 100%;
    transition: all 0.2s;
    font-family: inherit;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(8, 145, 178, 0.15);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
}

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

/* Student List */
.student-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
    margin-top: 20px;
}

.student-item {
    background: var(--bg-card-hover);
    padding: 16px 20px;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.student-item:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.student-name {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text);
}

.student-actions {
    display: flex;
    gap: 8px;
}

.student-actions button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    opacity: 0.6;
    transition: all 0.2s;
    padding: 4px;
}

.student-actions button:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 36px;
    max-width: 450px;
    width: 90%;
    position: relative;
    box-shadow: var(--shadow-xl);
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 20px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.2s;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: var(--bg-card-hover);
    color: var(--text);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 20px;
    margin-top: 10px;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideIn 0.3s ease;
    box-shadow: var(--shadow-lg);
    font-size: 0.9rem;
}

.toast.success {
    border-left: 4px solid var(--success);
}

.toast.error {
    border-left: 4px solid var(--danger);
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Loading Spinner */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Remove old animated bg */
.animated-bg {
    display: none;
}

/* Responsive */
@media (max-width: 768px) {
    .header {
        padding: 16px 16px 50px;
    }

    .header-top {
        flex-direction: column;
        gap: 16px;
    }

    .hero-title h1 {
        font-size: 1.8rem;
    }

    .hero-title p {
        font-size: 1rem;
    }

    .class-selector {
        flex-direction: column;
        padding: 20px;
    }

    .class-selector select {
        width: 100%;
    }

    .nav-pills {
        padding: 6px;
    }

    .nav-pill {
        padding: 8px 14px;
        font-size: 0.8rem;
    }

    .tools-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .tool-card {
        padding: 20px;
    }

    .container {
        padding: 0 16px;
    }
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-body);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Section titles */
.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Stats cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card-hover);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 4px;
}
