/* Design System */
:root {
    --primary: #4f46e5;
    /* Deeper Indigo */
    --primary-hover: #4338ca;
    --secondary: #db2777;
    /* Deeper Pink */
    --background: #f1f5f9;
    /* Slate 100 */
    --surface: #ffffff;
    --text: #0f172a;
    /* Slate 900 */
    --text-muted: #475569;
    /* Slate 600 */
    --border: #e2e8f0;
    --success: #059669;
    --danger: #dc2626;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 10px 10px -5px rgb(0 0 0 / 0.1);
    --radius: 0.75rem;
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
}

/* Reset & Base */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

textarea {
    resize: none !important;
}

body {
    font-family: var(--font-sans);
    background-color: var(--background);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    padding-top: 70px;
}

header {
    background-color: var(--surface);
    box-shadow: var(--shadow-sm);
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    transition: transform 0.3s ease-in-out;
}

.nav-hidden {
    transform: translateY(-100%);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 1.5rem;
    position: relative;
    width: 100%;
}

.logo {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary);
    z-index: 1001;
    white-space: nowrap;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-links a:not(.btn) {
    color: var(--text);
    font-weight: 500;
    font-size: 1rem;
    padding: 0;
}

/* ... lines 86-280 skipped ... */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    font-size: 1rem;
}

.nav-links a:not(.btn):hover {
    color: var(--primary);
}

.nav-profile {
    display: flex;
    align-items: center;
    color: var(--text);
    font-weight: 500;
}

.nav-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    margin-right: 0.5rem;
    object-fit: cover;
    border: 1px solid var(--border);
}

.logout-btn {
    margin-left: 0.5rem;
}

/* Nav Toggle (Hamburger) */
.nav-toggle {
    display: none;
}

.nav-toggle-label {
    display: none;
    cursor: pointer;
    padding: 0.5rem;
    z-index: 1001;
}

.nav-toggle-label span,
.nav-toggle-label span::before,
.nav-toggle-label span::after {
    display: block;
    background: var(--text);
    height: 2px;
    width: 22px;
    border-radius: 2px;
    position: relative;
    transition: all 0.3s ease;
}

.nav-toggle-label span::before,
.nav-toggle-label span::after {
    content: '';
    position: absolute;
}

.nav-toggle-label span::before {
    bottom: 7px;
}

.nav-toggle-label span::after {
    top: 7px;
}

/* Mobile Menu Media Query */
@media (max-width: 992px) {
    .nav-toggle-label {
        display: block;
    }

    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 280px;
        height: 100vh;
        background: var(--surface);
        flex-direction: column;
        align-items: flex-start;
        justify-content: flex-start;
        padding: 5rem 2rem 2rem;
        box-shadow: -5px 0 25px rgba(0, 0, 0, 0.05);
        transition: right 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 1000;
        gap: 1.5rem;
        overflow-y: auto;
    }

    .nav-overlay {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(15, 23, 42, 0.5);
        backdrop-filter: blur(4px);
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
        z-index: 999;
    }

    .nav-toggle:checked~.nav-overlay {
        opacity: 1;
        visibility: visible;
    }

    .nav-links a,
    .nav-profile {
        width: 100%;
    }

    .logout-btn {
        margin-left: 0;
        margin-top: 1rem;
    }

    .nav-toggle:checked~.nav-links {
        right: 0;
    }

    .nav-toggle:checked~.nav-toggle-label span {
        background: transparent;
    }

    .nav-toggle:checked~.nav-toggle-label span::before {
        transform: rotate(45deg);
        bottom: 0;
    }

    .nav-toggle:checked~.nav-toggle-label span::after {
        transform: rotate(-45deg);
        top: 0;
    }
}

@media (max-width: 480px) {
    .nav-container {
        padding: 0.75rem 0.5rem;
    }

    nav a.logo {
        font-size: 1rem;
    }
}


a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--primary-hover);
}

ul {
    list-style: none;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    line-height: 1.2;
    margin-bottom: 1rem;
    font-weight: 700;
}

h1 {
    font-size: 2.25rem;
}

h2 {
    font-size: 1.875rem;
}

h3 {
    font-size: 1.5rem;
}

p {
    margin-bottom: 1rem;
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Components */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    font-size: 0.95rem;
}

.btn:active {
    transform: scale(0.98);
}

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

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

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

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

.card {
    background-color: var(--surface);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.hero {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    padding: 4rem 2rem;
    border-radius: var(--radius);
    color: white;
    margin-bottom: 3rem;
    text-align: center;
}

.hero h1 {
    color: white;
    margin-bottom: 1rem;
    font-size: 2.5rem;
}

.hero p {
    font-size: 1.25rem;
    opacity: 0.9;
    max-width: 700px;
    margin: 0 auto;
}


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

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text);
}

.form-input,
input[type="text"],
input[type="password"],
input[type="email"],
textarea,
select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    resize: none !important;
}

.form-input:focus,
input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-primary {
    background-color: rgba(99, 102, 241, 0.1);
    color: var(--primary);
}

.badge-success {
    background-color: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.badge-danger {
    background-color: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.notification-unread {
    background-color: rgba(99, 102, 241, 0.05) !important;
}

/* Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out forwards;
}

@media (max-width: 768px) {
    .home-grid {
        grid-template-columns: 1fr !important;
    }
}











/* Utilities */
.text-center {
    text-align: center;
}

.mt-4 {
    margin-top: 1rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.flex {
    display: flex;
}

.grid {
    display: grid;
    gap: 1.5rem;
}

.grid-cols-2 {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

/* Utilities & Polish */
.text-muted {
    color: var(--text-muted) !important;
}

.btn-sm {
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
}

.btn-round {
    border-radius: 50% !important;
    width: 36px;
    height: 36px;
    padding: 0 !important;
}

.rounded-pill {
    border-radius: 2rem !important;
}

.announcement-card {
    border-left: 4px solid var(--secondary);
}

.home-chat {
    height: 500px;
}

.home-chat .chat-header {
    padding: 1rem;
}

.home-chat .chat-header h3 {
    font-size: 1.1rem;
    margin: 0;
}

.home-chat .chat-header p {
    font-size: 0.75rem;
    opacity: 0.8;
    margin: 0;
}

.home-chat .chat-messages {
    padding: 1rem;
    font-size: 0.9rem;
}

.home-chat .chat-input-area {
    padding: 1rem;
}

.chat-footer {
    padding: 0.5rem;
    text-align: center;
    background: #f8fafc;
    border-top: 1px solid var(--border);
}

.chat-footer a {
    font-size: 0.8rem;
    font-weight: 600;
}

.container-narrow {
    max-width: 800px;
    margin: 0 auto;
}

.flex-between-center {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.subtitle {
    margin: 0;
    opacity: 0.9;
    font-size: 0.875rem;
}

.badge-white {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.loading-state {
    margin-top: 2rem;
}

.full-page-chat {
    height: calc(100vh - 200px);
    min-height: 500px;
}

.btn-round.large {
    width: 45px;
    height: 45px;
}



/* Chat Enhancements */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 600px;
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.chat-header {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    padding: 1.5rem;
    color: white;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background-color: #f1f5f9;
}

.message-bubble {
    max-width: 75%;
    padding: 0.75rem 1rem;
    border-radius: 1.25rem;
    position: relative;
    box-shadow: var(--shadow-sm);
    animation: fadeIn 0.3s ease-out;
}

.message-bubble.mine {
    align-self: flex-end;
    background-color: var(--primary);
    color: white;
    border-bottom-right-radius: 0.25rem;
}

.message-bubble.others {
    align-self: flex-start;
    background-color: white;
    color: var(--text);
    border-bottom-left-radius: 0.25rem;
    border: 1px solid var(--border);
}

.message-info {
    font-size: 0.75rem;
    margin-bottom: 0.25rem;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.mine .message-info {
    justify-content: flex-end;
    color: rgba(255, 255, 255, 0.8);
}

.others .message-info {
    color: var(--text-muted);
}

.message-text {
    word-break: break-word;
    line-height: 1.4;
}

.chat-input-area {
    padding: 1.25rem;
    background: white;
    border-top: 1px solid var(--border);
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Premium UI Enhancements */
.badge-year {
    background: linear-gradient(135deg, #6366f1, #a855f7);
    color: white;
    border: none;
}

.badge-stream {
    background: linear-gradient(135deg, #10b981, #3b82f6);
    color: white;
    border: none;
}

.badge-subject {
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    color: white;
    border: none;
}

.card {
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-8px) scale(1.01);
}

/* Tab Styles */
.tabs-header {
    display: flex;
    gap: 1rem;
    border-bottom: 2px solid var(--border);
    margin-bottom: 1.5rem;
}

.tab-btn {
    background: none;
    border: none;
    padding: 0.75rem 1.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    position: relative;
    transition: all 0.3s;
}

.tab-btn:hover {
    color: var(--primary);
}

.tab-btn.active {
    color: var(--primary);
}

.tab-btn.active::after {
    content: "";
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--primary);
    border-radius: 3px;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.4s ease-out;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Tab link styles */
a.tab-btn {
    text-decoration: none;
    display: inline-block;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    border: 1px solid transparent;
}

.alert-error,
.alert-danger {
    background: #fee2e2;
    color: #991b1b;
    border-color: #fecaca;
}

.alert-success {
    background: #dcfce7;
    color: #166534;
    border-color: #bbf7d0;
}

.alert-info,
.alert-debug {
    background: var(--primary);
    color: white;
}

/* Dark Mode Variables */
[data-theme='dark'] {
    --background: #0f172a;
    --surface: #1e293b;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #334155;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.3);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.3);
}

.theme-toggle {
    background: var(--background);
    border: 2px solid var(--border);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text);
    transition: all 0.3s;
    padding: 0;
}

.theme-toggle:hover {
    border-color: var(--primary);
    transform: rotate(15deg);
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
}

.theme-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

/* Premium Theme Toggle (Switch Style) */
.theme-switch-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-left: 2rem;
}

.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #cbd5e1;
    transition: .4s;
    border-radius: 34px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 4px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
    z-index: 2;
}

input:checked+.slider {
    background-color: var(--primary);
}

input:checked+.slider:before {
    transform: translateX(24px);
}

.slider svg {
    width: 12px;
    height: 12px;
    color: white;
}

[data-theme='dark'] .slider {
    background-color: #334155;
}

[data-theme='dark'] .slider:before {
    background-color: #f1f5f9;
}

/* Dark Mode Color Overrides for Cards/Inputs */
[data-theme='dark'] .card {
    border-color: #334155;
}

[data-theme='dark'] .form-input,
[data-theme='dark'] input,
[data-theme='dark'] select,
[data-theme='dark'] textarea {
    background-color: #0f172a;
    border-color: #334155;
    color: #f1f5f9;
}

[data-theme='dark'] .form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

[data-theme='dark'] .badge {
    background: rgba(255, 255, 255, 0.1);
    color: #f1f5f9;
}

[data-theme='dark'] .hero {
    background: linear-gradient(135deg, #3730a3, #9d174d);
}

[data-theme='dark'] .announcement-card {
    background: #1e293b;
    border-left-color: var(--secondary);
}

[data-theme='dark'] .chat-messages {
    background-color: #0f172a;
}

[data-theme='dark'] .message-bubble.others {
    background-color: #334155;
    color: #f1f5f9;
    border-color: #475569;
}

[data-theme='dark'] .chat-input-area {
    background: #1e293b;
    border-top-color: #334155;
}

[data-theme='dark'] .chat-footer {
    background: #1e293b;
    border-top-color: #334155;
}

/* Search in Nav */
.nav-search {
    position: relative;
    margin-right: 1rem;
    display: flex;
    align-items: center;
}

.nav-search input {
    padding: 0.4rem 0.75rem;
    padding-right: 2rem;
    border-radius: 9999px;
    border: 1px solid var(--border);
    background: var(--background);
    width: 180px;
    transition: width 0.3s;
    font-size: 0.9rem;
}

.nav-search input:focus {
    width: 250px;
    outline: none;
    border-color: var(--primary);
}

[data-theme='dark'] .nav-search input {
    background: var(--surface);
    color: var(--text);
}

.nav-search button {
    position: absolute;
    right: 0.5rem;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
}

.nav-search button:hover {
    color: var(--primary);
}

@media (max-width: 992px) {
    .nav-search {
        width: 100%;
        margin-right: 0;
        margin-bottom: 1rem;
    }

    .nav-search input {
        width: 100%;
    }

    .nav-search input:focus {
        width: 100%;
    }
}

/* Chat Message Actions */
.message-actions {
    display: none;
    position: absolute;
    top: -10px;
    right: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 4px;
    box-shadow: var(--shadow-sm);
    padding: 2px 5px;
    z-index: 10;
}

.message-bubble:hover .message-actions {
    display: flex;
    gap: 10px;
}

.action-btn {
    cursor: pointer;
    font-size: 0.75rem;
    color: var(--text-muted);
    transition: color 0.2s;
}

.action-btn:hover {
    color: var(--primary);
}

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

.edit-input-area {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 100%;
}

.edit-input {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 5px;
    font-size: 0.85rem;
    resize: none !important;
}

.edit-controls {
    display: flex;
    gap: 5px;
    justify-content: flex-end;
}