/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --green-50: #f0fdf4;
    --green-100: #dcfce7;
    --green-200: #bbf7d0;
    --green-300: #86efac;
    --green-400: #4ade80;
    --green-500: #22c55e;
    --green-600: #16a34a;
    --green-700: #15803d;
    --green-800: #166534;
    --green-900: #14532d;
    --red-50: #fef2f2;
    --red-100: #fee2e2;
    --red-500: #ef4444;
    --red-600: #dc2626;
    --red-700: #b91c1c;
    --yellow-50: #fffbeb;
    --yellow-100: #fef3c7;
    --yellow-500: #f59e0b;
    --yellow-600: #d97706;
    --yellow-700: #b45309;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md: 0 4px 6px rgba(0,0,0,.1), 0 2px 4px rgba(0,0,0,.06);
    --shadow-lg: 0 10px 15px rgba(0,0,0,.1), 0 4px 6px rgba(0,0,0,.04);
    --radius: 12px;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--gray-100);
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
}

a { text-decoration: none; color: inherit; }

/* ===== NAVBAR ===== */
.navbar {
    background: linear-gradient(135deg, var(--green-700), var(--green-800));
    color: white;
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-md);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar h1 {
    font-size: 1.4rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: .5rem;
}

.navbar-links {
    display: flex;
    gap: 1rem;
}

.navbar-links a {
    color: rgba(255,255,255,.85);
    padding: .5rem 1rem;
    border-radius: 8px;
    transition: all .2s;
    font-size: .9rem;
    font-weight: 500;
}

.navbar-links a:hover, .navbar-links a.active {
    background: rgba(255,255,255,.15);
    color: white;
}

/* ===== CONTAINER ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* ===== CLASS GRID (Homepage) ===== */
.page-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--gray-800);
}

.class-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1rem;
}

.class-card {
    background: white;
    border-radius: var(--radius);
    padding: 1.5rem 1rem;
    text-align: center;
    box-shadow: var(--shadow);
    transition: all .25s;
    border: 2px solid transparent;
    cursor: pointer;
}

.class-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--green-400);
}

.class-card .class-name {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--green-700);
}

.class-card .class-count {
    font-size: .8rem;
    color: var(--gray-500);
    margin-top: .25rem;
}

.class-group-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--gray-600);
    margin-top: 2rem;
    margin-bottom: .75rem;
    padding-bottom: .5rem;
    border-bottom: 2px solid var(--green-200);
}

/* ===== BOARD PAGE ===== */
.board-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 80px);
    padding: 2rem;
    background: linear-gradient(135deg, #e8f5e9 0%, #f1f8e9 50%, #e8f5e9 100%);
}

.board-container {
    width: 100%;
    max-width: 800px;
    position: relative;
    overflow: hidden;
}

.board-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.board-header h2 {
    font-size: 1.5rem;
    color: var(--green-800);
}

.board-header .class-label {
    display: inline-block;
    background: var(--green-600);
    color: white;
    padding: .25rem 1rem;
    border-radius: 20px;
    font-size: .85rem;
    font-weight: 600;
    margin-top: .5rem;
}

/* Notice Slide */
.notice-slide {
    display: none;
    animation: fadeIn .6s ease;
}

.notice-slide.active {
    display: block;
}

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

.notice-card {
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    border-left: 5px solid var(--green-500);
    position: relative;
}

.notice-card.priority-alert {
    border-left-color: var(--yellow-500);
}

.notice-card.priority-stat {
    border-left-color: var(--red-500);
    animation: pulse-border 2s infinite;
}

@keyframes pulse-border {
    0%, 100% { box-shadow: 0 10px 15px rgba(0,0,0,.1), 0 0 0 0 rgba(239,68,68,.4); }
    50% { box-shadow: 0 10px 15px rgba(0,0,0,.1), 0 0 0 6px rgba(239,68,68,0); }
}

.notice-ribbon {
    padding: .75rem 1.5rem;
    font-size: .85rem;
    font-weight: 600;
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.notice-ribbon.normal { background: linear-gradient(135deg, var(--green-500), var(--green-600)); }
.notice-ribbon.alert { background: linear-gradient(135deg, var(--yellow-500), var(--yellow-600)); }
.notice-ribbon.stat { background: linear-gradient(135deg, var(--red-500), var(--red-600)); }

.notice-ribbon .priority-badge {
    background: rgba(255,255,255,.25);
    padding: .15rem .6rem;
    border-radius: 20px;
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.notice-body {
    padding: 2rem;
    background: linear-gradient(135deg, rgba(240,253,244,.3) 0%, white 100%);
}

.notice-card.priority-alert .notice-body {
    background: linear-gradient(135deg, rgba(255,251,235,.3) 0%, white 100%);
}

.notice-card.priority-stat .notice-body {
    background: linear-gradient(135deg, rgba(254,242,242,.3) 0%, white 100%);
}

.notice-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.notice-icon.normal { background: var(--green-100); color: var(--green-600); }
.notice-icon.alert { background: var(--yellow-100); color: var(--yellow-600); }
.notice-icon.stat { background: var(--red-100); color: var(--red-600); }

.notice-title {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: .75rem;
}

.notice-text {
    font-size: 1rem;
    color: var(--gray-600);
    line-height: 1.8;
    white-space: pre-wrap;
}

.notice-footer {
    padding: .75rem 2rem;
    background: var(--gray-50);
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: .8rem;
    color: var(--gray-500);
}

/* Slide indicators */
.slide-indicators {
    display: flex;
    justify-content: center;
    gap: .5rem;
    margin-top: 1.5rem;
}

.slide-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--green-200);
    transition: all .3s;
    cursor: pointer;
}

.slide-dot.active {
    background: var(--green-600);
    transform: scale(1.3);
}

/* Progress bar */
.slide-progress {
    height: 3px;
    background: var(--gray-200);
    border-radius: 3px;
    margin-top: 1rem;
    overflow: hidden;
}

.slide-progress-bar {
    height: 100%;
    background: var(--green-500);
    border-radius: 3px;
    transition: width linear;
}

.no-notices {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--gray-500);
}

.no-notices .icon { font-size: 3rem; margin-bottom: 1rem; }

/* ===== ADMIN PANEL ===== */
.admin-layout {
    display: grid;
    grid-template-columns: 250px 1fr;
    min-height: calc(100vh - 64px);
}

.admin-sidebar {
    background: white;
    border-right: 1px solid var(--gray-200);
    padding: 1.5rem 0;
}

.admin-sidebar a {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .75rem 1.5rem;
    color: var(--gray-600);
    font-weight: 500;
    transition: all .2s;
    border-left: 3px solid transparent;
}

.admin-sidebar a:hover {
    background: var(--green-50);
    color: var(--green-700);
}

.admin-sidebar a.active {
    background: var(--green-50);
    color: var(--green-700);
    border-left-color: var(--green-600);
    font-weight: 600;
}

.admin-content {
    padding: 2rem;
}

.admin-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: var(--gray-800);
}

/* Form styles */
.form-card {
    background: white;
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: .4rem;
    color: var(--gray-700);
    font-size: .9rem;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="password"],
.form-group input[type="datetime-local"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: .65rem .85rem;
    border: 1.5px solid var(--gray-300);
    border-radius: 8px;
    font-size: .95rem;
    font-family: inherit;
    transition: border-color .2s;
    background: white;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--green-500);
    box-shadow: 0 0 0 3px rgba(34,197,94,.15);
}

.form-group textarea { min-height: 120px; resize: vertical; }

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

.form-hint {
    font-size: .8rem;
    color: var(--gray-500);
    margin-top: .25rem;
}

/* Checkbox grid for classes */
.class-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: .4rem;
    max-height: 250px;
    overflow-y: auto;
    border: 1.5px solid var(--gray-300);
    border-radius: 8px;
    padding: .75rem;
}

.class-checkbox-grid label {
    display: flex;
    align-items: center;
    gap: .3rem;
    font-weight: 400;
    font-size: .85rem;
    cursor: pointer;
    padding: .2rem .4rem;
    border-radius: 4px;
    transition: background .2s;
}

.class-checkbox-grid label:hover { background: var(--green-50); }

/* Priority selector */
.priority-options {
    display: flex;
    gap: .75rem;
}

.priority-option {
    flex: 1;
    position: relative;
}

.priority-option input { display: none; }

.priority-option .priority-label {
    display: block;
    padding: .75rem;
    border-radius: 8px;
    text-align: center;
    cursor: pointer;
    font-weight: 600;
    font-size: .9rem;
    border: 2px solid var(--gray-200);
    transition: all .2s;
}

.priority-option input:checked + .priority-label.lbl-normal {
    border-color: var(--green-500);
    background: var(--green-50);
    color: var(--green-700);
}

.priority-option input:checked + .priority-label.lbl-alert {
    border-color: var(--yellow-500);
    background: var(--yellow-50);
    color: var(--yellow-700);
}

.priority-option input:checked + .priority-label.lbl-stat {
    border-color: var(--red-500);
    background: var(--red-50);
    color: var(--red-700);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .65rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: .95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    font-family: inherit;
}

.btn-primary {
    background: var(--green-600);
    color: white;
}

.btn-primary:hover { background: var(--green-700); }

.btn-danger {
    background: var(--red-500);
    color: white;
}

.btn-danger:hover { background: var(--red-600); }

.btn-sm {
    padding: .4rem .85rem;
    font-size: .8rem;
}

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--gray-300);
    color: var(--gray-700);
}

.btn-outline:hover {
    border-color: var(--green-500);
    color: var(--green-600);
}

/* Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.data-table th {
    background: var(--gray-50);
    padding: .85rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: .85rem;
    color: var(--gray-600);
    border-bottom: 2px solid var(--gray-200);
    text-transform: uppercase;
    letter-spacing: .3px;
}

.data-table td {
    padding: .75rem 1rem;
    border-bottom: 1px solid var(--gray-100);
    font-size: .9rem;
}

.data-table tr:hover td { background: var(--gray-50); }

.badge {
    display: inline-block;
    padding: .2rem .6rem;
    border-radius: 20px;
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .3px;
}

.badge-normal { background: var(--green-100); color: var(--green-700); }
.badge-alert { background: var(--yellow-100); color: var(--yellow-700); }
.badge-stat { background: var(--red-100); color: var(--red-700); }
.badge-active { background: var(--green-100); color: var(--green-700); }
.badge-inactive { background: var(--gray-100); color: var(--gray-500); }

/* Alert messages */
.alert {
    padding: 1rem 1.25rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-size: .9rem;
    font-weight: 500;
}

.alert-success { background: var(--green-100); color: var(--green-800); border: 1px solid var(--green-200); }
.alert-error { background: var(--red-100); color: var(--red-700); border: 1px solid var(--red-100); }

/* Login */
.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--green-600), var(--green-800));
}

.login-card {
    background: white;
    border-radius: var(--radius);
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
}

.login-card h2 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--green-700);
}

/* Filter bar */
.filter-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    align-items: end;
}

.filter-bar .form-group { margin-bottom: 0; }

/* Responsive */
@media (max-width: 768px) {
    .admin-layout {
        grid-template-columns: 1fr;
    }

    .admin-sidebar {
        display: flex;
        overflow-x: auto;
        border-right: none;
        border-bottom: 1px solid var(--gray-200);
        padding: 0;
    }

    .admin-sidebar a {
        white-space: nowrap;
        border-left: none;
        border-bottom: 3px solid transparent;
        padding: .75rem 1rem;
    }

    .admin-sidebar a.active { border-left: none; border-bottom-color: var(--green-600); }

    .form-row { grid-template-columns: 1fr; }

    .class-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }

    .container { padding: 1rem; }

    .navbar { padding: .75rem 1rem; }

    .priority-options { flex-direction: column; }

    .board-wrapper { padding: 1rem; }
}

/* Select all / deselect all */
.select-actions {
    display: flex;
    gap: .5rem;
    margin-bottom: .5rem;
}

.select-actions button {
    background: none;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    padding: .25rem .5rem;
    font-size: .75rem;
    cursor: pointer;
    color: var(--gray-600);
}

.select-actions button:hover {
    background: var(--green-50);
    border-color: var(--green-400);
}

/* Toggle switch */
.toggle-wrapper {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: .5rem;
}
