/* --- GLOBAL STYLES --- */
:root {
    --font-body: 'Space Grotesk', 'Segoe UI', sans-serif;
    --font-display: 'Syne', 'Arial Black', sans-serif;
}

* {
    margin: 0; padding: 0; box-sizing: border-box;
    font-family: var(--font-body);
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: #05050f;
    color: white;
    height: 100dvh; /* Dynamic height for mobile keyboard fix */
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.app-container {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
    width: 100%;
    min-width: 0;
}

/* --- SIDEBAR (Desktop Default) --- */
.sidebar {
    width: 260px;
    flex: 0 0 260px;
    background-color: #0a0a1a;
    border-right: 1px solid #1e1e2f;
    display: flex;
    flex-direction: column;
    padding: 20px;
    transition: left 0.3s ease-in-out;
    z-index: 1001;
}

.logo { font-size: 24px; color: #6e54ff; margin-bottom: 30px; font-weight: bold; }
.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 30px;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.sidebar-header .logo {
    margin-bottom: 0;
}

.sidebar-exit-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.04);
    color: #ffd7c7;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    flex-shrink: 0;
    transition: background 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.sidebar-exit-btn:hover {
    background: rgba(255, 91, 91, 0.12);
    border-color: rgba(255, 91, 91, 0.22);
    transform: translateY(-1px);
}

.nav-menu { flex-grow: 1; }
.nav-link {
    display: flex; align-items: center; gap: 12px;
    padding: 12px; color: #888; text-decoration: none;
    border-radius: 10px; margin-bottom: 8px; transition: 0.3s;
}
.nav-link:hover, .nav-link.active { background: #16162d; color: #6e54ff; }

.logout-btn {
    background: none; border: 1px solid #1e1e2f; color: #ff4d4d;
    padding: 10px; border-radius: 10px; cursor: pointer;
    display: flex; align-items: center; gap: 10px; width: 100%;
}

/* --- MAIN CONTENT AREA --- */
.main-content {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    background: #05050f;
    position: relative;
    width: 100%;
    min-width: 0;
    max-width: 100%;
}

.content-section {
    display: none;
    height: 100%;
    flex-direction: column;
    min-width: 0;
    max-width: 100%;
}
.content-section.active { display: flex; }

.admin-only {
    display: none !important;
}

body.is-admin .admin-only {
    display: block !important;
}

.media-section,
.announcements-section,
.memes-section,
.settings-section {
    animation: tabFadeIn 0.35s ease;
}

.media-header,
.announcements-toolbar,
.meme-topbar {
    position: relative;
    isolation: isolate;
}

.media-header::after,
.announcements-toolbar::after,
.meme-topbar::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -10px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.14), transparent);
}

.media-section {
    overflow-y: auto;
    padding: 28px;
    width: 100%;
    min-width: 0;
    background:
        radial-gradient(circle at top right, rgba(77, 171, 247, 0.12), transparent 22%),
        radial-gradient(circle at top left, rgba(255, 176, 102, 0.08), transparent 20%),
        linear-gradient(180deg, #070912 0%, #05050f 100%);
}

.media-shell {
    width: min(100%, 1120px);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.media-header h2 {
    color: #fff;
    font-family: var(--font-display);
    font-size: clamp(32px, 5vw, 46px);
    line-height: 1;
    letter-spacing: -0.04em;
    margin: 6px 0 10px;
    background: linear-gradient(135deg, #ffffff, #bcdfff 48%, #ffca9a 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.media-kicker {
    color: #7cc7ff;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 11px;
    font-weight: 800;
}

.media-subtitle {
    color: rgba(255,255,255,0.72);
    max-width: 760px;
    line-height: 1.65;
}

.media-toolbar {
    display: flex;
    gap: 14px;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    padding: 18px;
    border-radius: 24px;
    background: rgba(255,255,255,0.045);
    border: 1px solid rgba(255,255,255,0.08);
    backdrop-filter: blur(18px);
}

.media-search-wrap {
    flex: 1;
    min-width: 280px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    height: 52px;
    border-radius: 18px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
}

.media-search-wrap i {
    color: rgba(255,255,255,0.52);
    flex-shrink: 0;
}

.media-search-wrap input,
.media-selects select {
    background: transparent;
    border: none;
    outline: none;
    color: #fff;
    font-size: 14px;
}

.media-search-wrap input {
    width: 100%;
}

.media-selects {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.media-selects select {
    height: 52px;
    min-width: 160px;
    padding: 0 16px;
    border-radius: 16px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
}

.media-results-meta {
    color: rgba(255,255,255,0.58);
    font-size: 13px;
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 320px));
    justify-content: start;
    gap: 18px;
}

.media-card,
.media-empty-card {
    border-radius: 24px;
    overflow: hidden;
    background: rgba(12, 15, 26, 0.92);
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 18px 36px rgba(0,0,0,0.22);
}

.media-card {
    width: 100%;
    max-width: 320px;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.media-card:hover {
    transform: translateY(-4px);
    border-color: rgba(124, 199, 255, 0.18);
    box-shadow: 0 26px 46px rgba(0,0,0,0.28);
}

.media-empty-card {
    min-height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px;
    color: rgba(255,255,255,0.72);
}

.media-empty-card.error {
    color: #ffd0d0;
}

.media-thumb-wrap {
    position: relative;
    aspect-ratio: 16 / 10;
    background: rgba(255,255,255,0.04);
}

.media-thumb-image,
.media-file-thumb {
    width: 100%;
    height: 100%;
}

.media-thumb-image {
    display: block;
    object-fit: cover;
}

.media-file-thumb {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #fff;
}

.media-file-thumb.pdf {
    background: linear-gradient(135deg, #ff6b57, #b42318);
}

.media-file-thumb.ppt {
    background: linear-gradient(135deg, #ff8f57, #d24726);
}

.media-file-thumb.file {
    background: linear-gradient(135deg, #4dabf7, #1d4ed8);
}

.media-count-badge {
    position: absolute;
    right: 12px;
    bottom: 12px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(0,0,0,0.58);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
}

.media-card-body {
    padding: 16px 16px 18px;
}

.media-card-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.media-type-pill {
    display: inline-flex;
    align-items: center;
    padding: 7px 10px;
    border-radius: 999px;
    background: rgba(124, 199, 255, 0.12);
    color: #7cc7ff;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.media-date {
    color: rgba(255,255,255,0.46);
    font-size: 12px;
}

.media-card h3 {
    color: #fff;
    font-family: var(--font-display);
    font-size: 20px;
    line-height: 1.2;
    margin-bottom: 8px;
    letter-spacing: -0.03em;
}

.media-card p {
    color: rgba(255,255,255,0.72);
    line-height: 1.6;
    font-size: 14px;
}

.media-card-footer {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid rgba(255,255,255,0.08);
    display: flex;
    justify-content: space-between;
    gap: 10px;
    color: rgba(255,255,255,0.5);
    font-size: 12px;
}

.announcements-section {
    overflow-y: auto;
    padding: 28px;
    width: 100%;
    min-width: 0;
    background:
        radial-gradient(circle at top left, rgba(255, 172, 93, 0.14), transparent 24%),
        radial-gradient(circle at right top, rgba(77, 171, 247, 0.12), transparent 22%),
        linear-gradient(180deg, #070912 0%, #05050f 100%);
}

.announcements-shell {
    width: min(100%, 1120px);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.announcements-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.announcements-toolbar-title h2 {
    color: #fff;
    font-family: var(--font-display);
    font-size: clamp(30px, 5vw, 42px);
    line-height: 1;
    letter-spacing: -0.04em;
    background: linear-gradient(135deg, #fff7f0, #ffbf8a 52%, #ffd8bf 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.announcements-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.announcements-kicker,
.announcement-modal-kicker {
    color: #ffb066;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 11px;
    font-weight: 800;
    margin-bottom: 6px;
}

.announcements-subtitle {
    color: rgba(255,255,255,0.72);
    line-height: 1.6;
    font-size: 15px;
}

.announcements-info-panel {
    padding: 18px 20px;
    border-radius: 24px;
    background:
        radial-gradient(circle at top left, rgba(255, 176, 102, 0.14), transparent 28%),
        linear-gradient(135deg, rgba(18, 22, 40, 0.96), rgba(27, 19, 24, 0.95));
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 16px 36px rgba(0,0,0,0.22);
    animation: announcementInfoIn 0.25s ease;
}

.announcements-hero-meta {
    margin-top: 14px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.announcements-hero-meta span {
    padding: 9px 14px;
    border-radius: 999px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.76);
    font-size: 12px;
}

.announcement-create-btn,
.announcement-primary-btn,
.announcement-secondary-btn,
.announcement-icon-btn {
    border: none;
    cursor: pointer;
}

.announcement-info-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.05);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.announcement-create-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    border-radius: 16px;
    background: linear-gradient(135deg, #ff8f57, #ff5b5b);
    color: #fff;
    font-weight: 700;
    box-shadow: 0 14px 34px rgba(255, 91, 91, 0.25);
}

.announcements-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.announcement-card,
.announcement-empty-card {
    border-radius: 24px;
    overflow: hidden;
    background: rgba(12, 15, 26, 0.92);
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 18px 36px rgba(0,0,0,0.22);
}

.announcement-empty-card {
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 26px;
    color: rgba(255,255,255,0.72);
    text-align: center;
}

.announcement-empty-card.error {
    color: #ffd0d0;
    border-color: rgba(255, 91, 91, 0.18);
}

.announcement-card-media {
    aspect-ratio: 16 / 9;
    background: #111;
}

.announcement-card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.announcement-card-body {
    padding: 18px 18px 20px;
}

.announcement-card-body.compact {
    padding: 18px;
}

.announcement-card-topline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.announcement-badge {
    display: inline-flex;
    align-items: center;
    padding: 7px 10px;
    border-radius: 999px;
    background: rgba(255, 176, 102, 0.14);
    color: #ffb066;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.announcement-time {
    color: rgba(255,255,255,0.46);
    font-size: 12px;
}

.announcement-card h3 {
    color: #fff;
    font-family: var(--font-display);
    font-size: 22px;
    line-height: 1.15;
    margin-bottom: 10px;
    letter-spacing: -0.03em;
}

.announcement-card-main {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 120px;
    gap: 16px;
    align-items: start;
}

.announcement-card-copy p {
    margin: 0;
}

.announcement-card-thumb {
    width: 120px;
    height: 90px;
    border-radius: 18px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.04);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.announcement-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.announcement-card-thumb.empty span {
    color: rgba(255,255,255,0.4);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.announcement-card p {
    color: rgba(255,255,255,0.74);
    line-height: 1.7;
    font-size: 14px;
}

.announcement-card-footer {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 12px;
}

.announcement-card-footer span {
    color: rgba(255,255,255,0.5);
}

.announcement-card-footer a {
    color: #7cc7ff;
    text-decoration: none;
    font-weight: 700;
}

.announcement-open-hint {
    color: #7cc7ff !important;
    font-weight: 700;
}

.announcement-modal-card {
    width: min(92vw, 620px);
    border-radius: 28px;
    padding: 24px;
    background: linear-gradient(180deg, #111522, #0b0d14);
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 30px 80px rgba(0,0,0,0.4);
}

.announcement-modal-head {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.announcement-modal-head h3 {
    color: #fff;
    font-size: 30px;
    letter-spacing: -0.03em;
}

.announcement-icon-btn {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: rgba(255,255,255,0.06);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.announcement-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.announcement-form input,
.announcement-form textarea {
    width: 100%;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 18px;
    background: rgba(255,255,255,0.04);
    color: #fff;
    padding: 15px 16px;
    outline: none;
    font-size: 14px;
}

.announcement-form textarea {
    resize: vertical;
    min-height: 130px;
}

.announcement-upload-box {
    display: block;
    border: 1px dashed rgba(255,255,255,0.18);
    border-radius: 22px;
    padding: 18px;
    background: rgba(255,255,255,0.03);
    cursor: pointer;
}

.announcement-upload-box input {
    display: none;
}

.announcement-upload-title {
    display: block;
    color: #fff;
    font-weight: 700;
    margin-bottom: 6px;
}

.announcement-upload-sub {
    color: rgba(255,255,255,0.6);
    font-size: 13px;
}

.announcement-image-preview {
    position: relative;
    overflow: hidden;
    border-radius: 22px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.03);
    max-width: 220px;
}

.announcement-image-preview img {
    width: 100%;
    height: 138px;
    object-fit: cover;
    display: block;
}

.announcement-remove-image {
    position: absolute;
    top: 14px;
    right: 14px;
    border: none;
    border-radius: 999px;
    padding: 8px 12px;
    background: rgba(0,0,0,0.66);
    color: #fff;
    cursor: pointer;
}

.announcement-form-actions {
    display: flex;
    justify-content: end;
    gap: 12px;
    margin-top: 6px;
}

.announcement-primary-btn,
.announcement-secondary-btn {
    padding: 12px 18px;
    border-radius: 14px;
    font-weight: 700;
}

.announcement-primary-btn {
    background: linear-gradient(135deg, #ff8f57, #ff5b5b);
    color: #fff;
}

.announcement-secondary-btn {
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.82);
}

@keyframes announcementInfoIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.announcement-view-card {
    width: min(94vw, 920px);
    max-height: 92vh;
    overflow-y: auto;
    border-radius: 34px;
    background: linear-gradient(180deg, #101420, #080a10);
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 30px 80px rgba(0,0,0,0.45);
    position: relative;
}

.announcement-view-close {
    position: sticky;
    top: 18px;
    float: right;
    z-index: 2;
    margin: 18px 18px 0 0;
    width: 46px;
    height: 46px;
    border: none;
    border-radius: 16px;
    background: rgba(0,0,0,0.52);
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.announcement-view-image-wrap {
    width: 100%;
    max-height: 420px;
    overflow: hidden;
}

.announcement-view-image-wrap img {
    width: 100%;
    height: 100%;
    max-height: 420px;
    object-fit: cover;
    display: block;
}

.announcement-view-body {
    padding: 26px 28px 30px;
}

.announcement-view-topline {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin-bottom: 14px;
}

.announcement-view-body h2 {
    font-size: clamp(30px, 5vw, 54px);
    line-height: 1.05;
    color: #fff;
    font-family: var(--font-display);
    letter-spacing: -0.04em;
    margin-bottom: 10px;
}

.media-header h2,
.announcements-toolbar-title h2,
.announcement-view-body h2,
.meme-topbar h2,
.media-card h3,
.announcement-card h3,
.meme-upload-copy h3 {
    text-wrap: balance;
}

.announcement-view-author {
    color: rgba(255,255,255,0.6);
    margin-bottom: 22px;
}

.announcement-view-description {
    color: rgba(255,255,255,0.82);
    line-height: 1.9;
    font-size: 16px;
}

.homework-section {
    overflow-y: auto;
    padding: 28px;
    width: 100%;
    min-width: 0;
    background:
        radial-gradient(circle at top left, rgba(124, 199, 255, 0.16), transparent 22%),
        radial-gradient(circle at top right, rgba(255, 176, 102, 0.12), transparent 24%),
        linear-gradient(180deg, #070912 0%, #05050f 100%);
}

.homework-shell {
    width: min(100%, 1140px);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 100%;
}

.homework-topbar,
.homework-calendar-panel,
.homework-content-panel,
.homework-admin-bar,
.homework-modal-card {
    position: relative;
    overflow: hidden;
    border-radius: 28px;
    border: 1px solid rgba(255,255,255,0.08);
    background:
        linear-gradient(135deg, rgba(255,255,255,0.06), rgba(255,255,255,0.025)),
        rgba(8, 12, 24, 0.84);
    backdrop-filter: blur(18px);
    box-shadow: 0 22px 60px rgba(0,0,0,0.24);
}

.homework-topbar {
    padding: 24px;
}

.homework-topbar::before,
.homework-calendar-panel::before,
.homework-content-panel::before,
.homework-admin-bar::before,
.homework-modal-card::before {
    content: "";
    position: absolute;
    inset: auto auto 0 0;
    width: 180px;
    height: 180px;
    background: radial-gradient(circle, rgba(124, 199, 255, 0.14), transparent 68%);
    pointer-events: none;
}

.homework-topbar h2 {
    color: #fff;
    font-family: var(--font-display);
    font-size: clamp(32px, 5vw, 46px);
    line-height: 1;
    letter-spacing: -0.04em;
    margin-top: 6px;
}

.homework-kicker,
.homework-upload-label,
.homework-calendar-kicker,
.homework-day-kicker {
    color: #7cc7ff;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 11px;
    font-weight: 800;
}

.homework-subtitle {
    margin-top: 10px;
    max-width: 680px;
    color: rgba(255,255,255,0.72);
    line-height: 1.7;
}

.homework-admin-bar {
    padding: 18px 20px;
    display: flex !important;
    justify-content: flex-end;
}

.homework-form {
    margin-top: 18px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.homework-form input,
.homework-form textarea,
.homework-date-picker {
    width: 100%;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 20px;
    background: rgba(255,255,255,0.05);
    color: #fff;
    padding: 14px 16px;
    outline: none;
}

.homework-form input:focus,
.homework-form textarea:focus,
.homework-date-picker:focus {
    border-color: rgba(124, 199, 255, 0.4);
    box-shadow: 0 0 0 4px rgba(124, 199, 255, 0.08);
}

.homework-open-btn,
.homework-secondary-btn,
.homework-form button[type="submit"] {
    min-height: 50px;
    border: none;
    border-radius: 18px;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-weight: 700;
    cursor: pointer;
}

.homework-open-btn,
.homework-form button[type="submit"] {
    padding: 0 18px;
    background: linear-gradient(135deg, #ff9f68, #ff6767);
    box-shadow: 0 18px 34px rgba(255, 103, 103, 0.22);
}

.homework-secondary-btn {
    padding: 0 16px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
}

.homework-modal-card {
    width: min(92vw, 760px);
    max-height: min(88vh, 760px);
    padding: 22px;
    overflow: auto;
}

.homework-modal-head {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 16px;
}

.homework-modal-head h3 {
    color: #fff;
    font-family: var(--font-display);
    font-size: 30px;
    margin-top: 6px;
    letter-spacing: -0.03em;
}

.homework-modal-head p:last-child {
    margin-top: 8px;
    color: rgba(255,255,255,0.66);
    line-height: 1.6;
    max-width: 520px;
}

.homework-schedule-box {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(210px, 260px);
    gap: 12px;
    align-items: center;
}

.homework-schedule-toggle {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.homework-radio-pill {
    position: relative;
}

.homework-radio-pill input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.homework-radio-pill span {
    min-height: 50px;
    padding: 0 18px;
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.04);
    color: rgba(255,255,255,0.76);
    display: inline-flex;
    align-items: center;
    font-weight: 700;
    cursor: pointer;
}

.homework-radio-pill input:checked + span {
    background: rgba(124, 199, 255, 0.14);
    border-color: rgba(124, 199, 255, 0.28);
    color: #fff;
}

.homework-form textarea {
    resize: vertical;
    min-height: 88px;
}

.homework-subject-rows {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.homework-subject-row {
    width: 100%;
    max-width: 100%;
    padding: 16px;
    border-radius: 22px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.04);
}

.homework-row-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.homework-row-index {
    color: rgba(255,255,255,0.72);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.homework-remove-row {
    width: 40px;
    height: 40px;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 14px;
    background: rgba(255,255,255,0.04);
    color: #ffd2d2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.homework-remove-row:disabled {
    opacity: 0.35;
    cursor: default;
}

.homework-subject-input {
    margin-bottom: 12px;
}

.homework-form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: space-between;
}

.homework-layout {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.homework-calendar-panel,
.homework-content-panel {
    padding: 22px;
    width: 100%;
    max-width: 100%;
}

.homework-calendar-head,
.homework-day-summary,
.homework-card-topline {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 14px;
}

.homework-calendar-head h3 {
    margin-top: 6px;
    color: #fff;
    font-family: var(--font-display);
    font-size: clamp(24px, 4vw, 30px);
    letter-spacing: -0.03em;
}

.homework-calendar-meta {
    flex-shrink: 0;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.78);
    font-size: 12px;
    font-weight: 700;
}

.homework-dates-list {
    display: flex;
    gap: 12px;
    margin-top: 18px;
    overflow-x: auto;
    overflow-y: hidden;
    width: 100%;
    max-width: 100%;
    padding-bottom: 8px;
    scroll-snap-type: x proximity;
}

.homework-date-item {
    min-width: 86px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.04);
    color: #fff;
    border-radius: 24px;
    padding: 14px 12px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
    scroll-snap-align: start;
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
}

.homework-date-item:hover {
    transform: translateY(-3px);
    border-color: rgba(124, 199, 255, 0.2);
}

.homework-date-item.has-homework {
    background: linear-gradient(180deg, rgba(124, 199, 255, 0.1), rgba(255,255,255,0.04));
}

.homework-date-item.active {
    border-color: rgba(124, 199, 255, 0.38);
    background: linear-gradient(180deg, rgba(124, 199, 255, 0.2), rgba(255,255,255,0.08));
    box-shadow: 0 18px 34px rgba(0,0,0,0.22), 0 0 0 1px rgba(124, 199, 255, 0.16) inset;
}

.homework-date-weekday {
    color: rgba(255,255,255,0.62);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.homework-date-number {
    font-weight: 700;
    font-size: 26px;
    line-height: 1;
}

.homework-date-month {
    color: rgba(255,255,255,0.64);
    font-size: 12px;
}

.homework-date-indicator-wrap {
    min-height: 16px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.homework-date-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #7cc7ff;
    box-shadow: 0 0 14px rgba(124, 199, 255, 0.9);
}

.homework-date-indicator.ghost {
    opacity: 0;
    box-shadow: none;
}

.homework-date-today {
    font-size: 10px;
    color: rgba(255,255,255,0.62);
}

.homework-day-header {
    color: #fff;
    font-family: var(--font-display);
    font-size: clamp(28px, 4vw, 38px);
    line-height: 1.1;
    letter-spacing: -0.03em;
}

.homework-day-meta {
    color: rgba(255,255,255,0.68);
    line-height: 1.6;
    margin-top: 8px;
    max-width: 100%;
}

.homework-entries {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 20px;
    width: 100%;
    max-width: 100%;
}

.homework-card,
.homework-empty-card {
    width: 100%;
    max-width: 100%;
    border-radius: 24px;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.03)),
        rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.08);
    padding: 18px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
    overflow-wrap: anywhere;
}

.homework-empty-card {
    min-height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.homework-empty-card strong {
    display: block;
    color: #fff;
    margin-bottom: 8px;
}

.homework-card-subject {
    color: #fff;
    font-weight: 800;
    font-size: 18px;
}

.homework-card-divider {
    width: 100%;
    height: 1px;
    margin: 14px 0 12px;
    background: linear-gradient(90deg, rgba(124, 199, 255, 0.26), rgba(255,255,255,0.08));
}

.homework-card-chip {
    padding: 7px 10px;
    border-radius: 999px;
    background: rgba(124, 199, 255, 0.12);
    color: #7cc7ff;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.homework-card p,
.homework-empty-card {
    color: rgba(255,255,255,0.74);
    line-height: 1.65;
}

.homework-dates-list .homework-empty-card {
    min-width: min(100%, 240px);
    min-height: 140px;
    flex-shrink: 0;
}

.homework-entries-animate {
    animation: homeworkEntryIn 0.4s ease both;
}

.homework-dates-list::-webkit-scrollbar {
    height: 6px;
}

.homework-dates-list::-webkit-scrollbar-thumb {
    background: rgba(124, 199, 255, 0.22);
    border-radius: 999px;
}

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

.settings-section {
    overflow-y: auto;
    padding: 28px;
    width: 100%;
    min-width: 0;
    background:
        radial-gradient(circle at top left, rgba(110, 84, 255, 0.16), transparent 24%),
        radial-gradient(circle at bottom right, rgba(72, 201, 176, 0.12), transparent 26%),
        #060816;
}

.settings-shell {
    width: min(100%, 1040px);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.settings-hero {
    padding: 26px 28px;
    border-radius: 28px;
    background: linear-gradient(145deg, rgba(16, 21, 37, 0.95), rgba(9, 11, 20, 0.98));
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 22px 70px rgba(0,0,0,0.25);
}

.settings-kicker {
    margin: 0 0 10px;
    color: #7cc7ff;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 11px;
    font-weight: 700;
}

.settings-hero h2 {
    margin: 0;
    color: #fff;
    font-family: var(--font-display);
    font-size: clamp(30px, 5vw, 42px);
}

.settings-subtitle,
.settings-copy {
    color: rgba(255,255,255,0.68);
    line-height: 1.7;
}

.settings-subtitle {
    margin: 12px 0 0;
    max-width: 720px;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
}

.settings-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 22px 24px;
    border-radius: 24px;
    background: rgba(10, 14, 26, 0.92);
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 18px 55px rgba(0,0,0,0.22);
}

.settings-master-card {
    background:
        radial-gradient(circle at top right, rgba(110, 84, 255, 0.16), transparent 22%),
        linear-gradient(145deg, rgba(15, 20, 36, 0.98), rgba(8, 10, 18, 1));
}

.settings-label {
    margin: 0 0 6px;
    color: #7cc7ff;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 11px;
    font-weight: 700;
}

.settings-card h3 {
    margin: 0 0 8px;
    color: #fff;
    font-size: 20px;
}

.settings-copy {
    margin: 0;
    font-size: 14px;
}

.settings-note {
    padding: 14px 18px;
    border-radius: 18px;
    border: 1px solid rgba(124, 199, 255, 0.18);
    background: rgba(124, 199, 255, 0.08);
    color: rgba(255,255,255,0.76);
    font-size: 14px;
}

.toggle-switch {
    position: relative;
    width: 66px;
    height: 38px;
    display: inline-flex;
    flex-shrink: 0;
}

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

.toggle-slider {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: rgba(255,255,255,0.16);
    border: 1px solid rgba(255,255,255,0.12);
    cursor: pointer;
    transition: 0.25s ease;
}

.toggle-slider::before {
    content: "";
    position: absolute;
    width: 28px;
    height: 28px;
    left: 4px;
    top: 4px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 8px 18px rgba(0,0,0,0.22);
    transition: 0.25s ease;
}

.toggle-switch input:checked + .toggle-slider {
    background: linear-gradient(135deg, #6e54ff, #45d0b0);
    border-color: transparent;
}

.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(28px);
}

.toggle-switch input:disabled + .toggle-slider {
    cursor: not-allowed;
    opacity: 0.45;
}

.memes-section {
    overflow-y: auto;
    padding: 28px;
    background:
        radial-gradient(circle at top left, rgba(255, 91, 91, 0.08), transparent 20%),
        radial-gradient(circle at top right, rgba(124, 199, 255, 0.08), transparent 20%),
        linear-gradient(180deg, #060811 0%, #05050f 100%);
}

.meme-shell {
    width: min(100%, 1120px);
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.meme-topbar h2 {
    color: #fff;
    font-family: var(--font-display);
    font-size: clamp(34px, 6vw, 54px);
    line-height: 1;
    letter-spacing: -0.04em;
    margin: 6px 0 10px;
    background: linear-gradient(135deg, #ffffff, #ffafc7 48%, #a9d4ff 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.meme-kicker,
.meme-upload-label {
    color: #ffb066;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 11px;
    font-weight: 800;
}

.meme-subtitle {
    color: rgba(255,255,255,0.72);
    max-width: 720px;
    line-height: 1.65;
}

.meme-upload-panel,
.meme-hero-card,
.meme-grid-card,
.meme-video-modal-card {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.22);
}

.meme-upload-panel {
    padding: 18px;
    border-radius: 26px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.meme-upload-copy h3 {
    color: #fff;
    font-family: var(--font-display);
    font-size: 22px;
    margin-top: 4px;
    letter-spacing: -0.03em;
}

.meme-upload-form {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto;
    gap: 12px;
}

.meme-upload-form input {
    width: 100%;
    height: 52px;
    padding: 0 16px;
    border-radius: 18px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.04);
    color: #fff;
    outline: none;
}

.meme-upload-form button {
    height: 52px;
    padding: 0 18px;
    border-radius: 18px;
    border: none;
    background: linear-gradient(135deg, #ff8f57, #ff5b5b);
    color: #fff;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    cursor: pointer;
}

.meme-hero-card {
    position: relative;
    border-radius: 30px;
    overflow: hidden;
    width: min(100%, 880px);
    margin: 0 auto;
}

.meme-hero-video {
    width: 100%;
    height: min(48vh, 440px);
    display: block;
    object-fit: cover;
    background: #070912;
}

.meme-grid-container {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.meme-grid-card {
    position: relative;
    border-radius: 24px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.meme-grid-card:hover {
    transform: translateY(-4px) rotate(-0.2deg);
    box-shadow: 0 26px 46px rgba(0,0,0,0.28);
    border-color: rgba(255,255,255,0.16);
}

.meme-grid-media {
    position: relative;
    aspect-ratio: 4 / 5;
}

.meme-grid-media video {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    background: #070912;
}

.meme-preview-image {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    background: #070912;
}

.meme-preview-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
    padding: 18px;
    background: linear-gradient(135deg, #18142a, #0d101c);
    color: #fff;
    box-sizing: border-box;
}

.meme-caption-overlay {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 18px 16px 14px;
    color: #fff;
    font-weight: 600;
    line-height: 1.4;
    background: linear-gradient(to top, rgba(0,0,0,0.74), transparent);
    pointer-events: none;
}

.meme-loading-card {
    min-height: 160px;
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: rgba(255,255,255,0.72);
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
}

.meme-video-modal {
    position: fixed;
    inset: 0;
    z-index: 120000;
    display: none;
    align-items: center;
    justify-content: center;
}

.meme-video-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.72);
    backdrop-filter: blur(10px);
}

.meme-video-modal-card {
    position: relative;
    z-index: 1;
    width: min(92vw, 720px);
    border-radius: 30px;
    overflow: hidden;
}

.meme-modal-player-wrap {
    position: relative;
    width: 100%;
    background: #070912;
}

.meme-audio-toggle {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 2;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 14px;
    background: rgba(0,0,0,0.45);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.meme-audio-toggle.is-unmuted {
    background: rgba(255, 143, 87, 0.88);
}

.meme-modal-player-wrap video {
    width: 100%;
    max-height: 84vh;
    display: block;
    object-fit: cover;
    background: #070912;
}

.meme-video-close {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 2;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 14px;
    background: rgba(0,0,0,0.45);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.meme-card-shell {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.meme-delete-btn {
    position: absolute;
    top: 14px;
    right: 14px;
    z-index: 3;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 14px;
    background: rgba(16, 18, 30, 0.72);
    color: #ffb7b7;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(0,0,0,0.28);
}

.meme-delete-btn:hover {
    background: rgba(255, 91, 91, 0.18);
    color: #fff;
}

.meme-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(255,255,255,0.08);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.meme-status-pill.fallback {
    background: rgba(255, 176, 102, 0.16);
    color: #ffd6ae;
}

.meme-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 14px;
    border-radius: 12px;
    border: 1px solid rgba(255,255,255,0.1);
    background: linear-gradient(135deg, #ff8f57, #ff5b5b);
    color: #fff;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
}

.meme-action-btn-secondary {
    background: rgba(255,255,255,0.06);
}

.meme-fallback-note {
    margin: 0;
    padding: 14px 16px 0;
    color: rgba(255,255,255,0.76);
    line-height: 1.6;
    font-size: 14px;
}

.meme-modal-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    padding: 16px 18px 18px;
}

.meme-modal-fallback {
    min-height: min(56vh, 420px);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: 12px;
    padding: 24px;
    color: rgba(255,255,255,0.82);
    line-height: 1.7;
    background: linear-gradient(135deg, #18142a, #0d101c);
}

.meme-modal-fallback p {
    margin: 0;
    max-width: 480px;
}

@media (min-width: 1100px) {
    .meme-hero-video {
        height: 380px;
    }
}

/* --- CHAT WINDOW --- */
.chat-window {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scroll-behavior: smooth;
    background-image: radial-gradient(circle at 50% 50%, #0a0a1a 0%, #05050f 100%);
}

.chat-emergency-mode {
    position: relative;
    overflow: hidden;
}

.chat-emergency-mode .chat-window {
    filter: blur(10px) saturate(0.7);
    transform: scale(1.015);
    opacity: 0.2;
    pointer-events: none;
    transition: filter 0.35s ease, transform 0.35s ease, opacity 0.35s ease;
}

.chat-emergency-screen {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    z-index: 5;
    background:
        radial-gradient(circle at 20% 20%, rgba(255, 102, 102, 0.16), transparent 28%),
        radial-gradient(circle at 80% 25%, rgba(255, 180, 0, 0.16), transparent 24%),
        linear-gradient(135deg, rgba(9, 10, 20, 0.98), rgba(18, 8, 8, 0.96));
}

.chat-emergency-screen.active {
    display: flex;
}

.chat-emergency-bg {
    position: absolute;
    inset: 0;
}

.chat-emergency-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px);
    background-size: 34px 34px;
    mask-image: linear-gradient(to bottom, rgba(0,0,0,0.8), transparent);
    opacity: 0.45;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(6px);
    animation: emergencyFloat 8s ease-in-out infinite;
}

.orb-1 {
    width: 240px;
    height: 240px;
    top: 10%;
    left: 8%;
    background: radial-gradient(circle, rgba(255, 91, 91, 0.55), transparent 70%);
}

.orb-2 {
    width: 300px;
    height: 300px;
    right: 10%;
    top: 16%;
    animation-delay: -2s;
    background: radial-gradient(circle, rgba(255, 170, 0, 0.38), transparent 72%);
}

.orb-3 {
    width: 280px;
    height: 280px;
    left: 30%;
    bottom: 6%;
    animation-delay: -4s;
    background: radial-gradient(circle, rgba(255, 75, 43, 0.28), transparent 72%);
}

.chat-emergency-panel {
    position: relative;
    width: min(92%, 620px);
    padding: 34px 28px;
    border-radius: 28px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: linear-gradient(180deg, rgba(24, 15, 15, 0.9), rgba(10, 10, 18, 0.9));
    box-shadow: 0 30px 100px rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(20px);
    text-align: center;
    z-index: 1;
    animation: emergencyPanelIn 0.45s ease;
}

.chat-emergency-panel h2 {
    font-size: clamp(28px, 5vw, 44px);
    line-height: 1.05;
    margin: 18px 0 12px;
    color: #fff4ef;
    letter-spacing: -0.03em;
}

.chat-emergency-panel p {
    max-width: 520px;
    margin: 0 auto;
    color: rgba(255, 244, 239, 0.82);
    font-size: 15px;
    line-height: 1.65;
}

.emergency-live-pill {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #fff6f2;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.live-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ff5b5b;
    box-shadow: 0 0 0 0 rgba(255, 91, 91, 0.7);
    animation: emergencyPulse 1.8s infinite;
}

.emergency-status-badge {
    margin: 18px auto 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    max-width: 100%;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(255, 110, 80, 0.1);
    border: 1px solid rgba(255, 130, 110, 0.18);
    color: #ffd7c7;
    font-size: 13px;
}

.emergency-wave-bars {
    display: flex;
    align-items: end;
    justify-content: center;
    gap: 8px;
    height: 52px;
    margin-top: 28px;
}

.emergency-wave-bars span {
    width: 8px;
    border-radius: 999px;
    background: linear-gradient(180deg, #ffb066, #ff5b5b);
    animation: emergencyBars 1.1s ease-in-out infinite;
}

.emergency-wave-bars span:nth-child(1) { height: 18px; animation-delay: -0.45s; }
.emergency-wave-bars span:nth-child(2) { height: 36px; animation-delay: -0.2s; }
.emergency-wave-bars span:nth-child(3) { height: 48px; animation-delay: 0s; }
.emergency-wave-bars span:nth-child(4) { height: 30px; animation-delay: -0.3s; }
.emergency-wave-bars span:nth-child(5) { height: 20px; animation-delay: -0.55s; }

/* --- INPUT AREA (Keyboard-safe) --- */
.input-area {
    padding: 10px 15px;
    display: flex;
    align-items: center;
    gap: 10px; /* Sabhi elements ke beech gap */
    background: #0a0a1a;
    flex-wrap: wrap;
}

.input-area.input-disabled {
    opacity: 0.55;
    pointer-events: none;
    filter: saturate(0.7);
}

.reply-bar {
    width: 100%;
    flex: 0 0 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(22, 22, 45, 0.9);
    border: 1px solid rgba(110, 84, 255, 0.22);
    position: relative;
    overflow: hidden;
}

.reply-bar-accent {
    width: 6px;
    height: 100%;
    border-radius: 10px;
    background: linear-gradient(180deg, #6e54ff, #7cc7ff);
}

.reply-bar-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.reply-bar-label {
    color: rgba(255,255,255,0.7);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 700;
}

.reply-bar-text {
    color: #fff;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.reply-bar-close {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.05);
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.reply-bar-animate {
    animation: replyBarIn 0.22s ease;
}

/* Plus Button (Outside) */
.action-btn {
    background: #16162d;
    border: 1px solid #1e1e2f;
    color: #888;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

/* Input Box with GIF inside */
.input-container-inner {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    align-items: center;
    background: #16162d;
    border-radius: 25px;
    padding: 0 12px;
    border: 1px solid #1e1e2f;
}

.inner-action-btn {
    background: none;
    border: none;
    color: #6e54ff; /* GIF icon ko purple highlight diya hai */
    cursor: pointer;
    padding: 8px 4px;
    display: flex;
    align-items: center;
}

#message-input {
    flex: 1;
    min-width: 0;
    background: transparent !important;
    border: none !important;
    padding: 10px 8px;
    color: white;
    outline: none;
    width: 0;
}

.send-btn {
    background: #6e54ff;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    color: white;
    flex-shrink: 0;
}

.action-btn:disabled,
.inner-action-btn:disabled,
.send-btn:disabled,
#message-input:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}
/* --- MESSAGE BUBBLES (WhatsApp Style) --- */
.message-wrapper { display: flex; gap: 10px; margin-bottom: 15px; align-items: flex-end; max-width: 85%; }
.message-wrapper.sent { flex-direction: row-reverse; align-self: flex-end; }
.message-wrapper.received { align-self: flex-start; }

.chat-avatar { width: 35px; height: 35px; border-radius: 10px; object-fit: cover; border: 2px solid #6e54ff; cursor: pointer; }

.message-bubble { 
    padding: 8px 12px; 
    border-radius: 15px; 
    position: relative; 
    font-size: 14.5px; 
    line-height: 1.4;
    display: flex;
    flex-direction: column;
    min-width: 60px;
    max-width: 100%;
    transition: transform 0.16s ease;
    will-change: transform;
}

.message-bubble.swipe-reset {
    transition: transform 0.18s ease;
}

.msg-content-area {
    max-width: 100%;
    overflow: hidden;
}

.chat-media-content {
    display: block;
    max-width: 100% !important;
    height: auto;
    box-sizing: border-box;
}

.message-bubble img {
    max-width: 100%;
}

.scroll-bottom-btn {
    position: absolute;
    right: 20px;
    bottom: 86px;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(22, 22, 45, 0.88);
    color: #fff;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 50;
    box-shadow: 0 18px 34px rgba(0,0,0,0.4);
}

.scroll-bottom-btn.visible {
    display: inline-flex;
    animation: replyBubbleIn 0.2s ease;
}

.scroll-bottom-btn.pulse {
    animation: scrollPulse 1.4s ease-in-out infinite;
}

.reply-bubble {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px 10px;
    margin-bottom: 8px;
    border-radius: 12px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.reply-bubble::before {
    content: "";
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 999px;
    background: linear-gradient(180deg, #6e54ff, #7cc7ff);
}

.reply-bubble-label {
    color: rgba(255,255,255,0.7);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 700;
    padding-left: 8px;
}

.reply-bubble-text {
    color: #fff;
    font-size: 12px;
    opacity: 0.9;
    padding-left: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.reply-bubble-animate {
    animation: replyBubbleIn 0.25s ease;
}

.msg-text {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
}

.msg-text-block {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-inline-link {
    color: #b8dcff;
    text-decoration: underline;
    text-underline-offset: 2px;
    font-weight: 600;
}

.chat-inline-link:hover {
    color: #fff;
}

.chat-link-card-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-link-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 14px;
    text-decoration: none;
    color: inherit;
    border: 1px solid rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.07);
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.chat-link-card:hover {
    transform: translateY(-1px);
    border-color: rgba(255,255,255,0.22);
    background: rgba(255,255,255,0.1);
}

.chat-link-card-media {
    align-items: stretch;
    padding: 8px;
}

.chat-link-card-pdf {
    align-items: stretch;
}

.chat-link-card-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(124, 199, 255, 0.14);
    color: #dff3ff;
    font-size: 18px;
    flex-shrink: 0;
}

.chat-link-media-thumb {
    width: 92px;
    height: 92px;
    object-fit: cover;
    border-radius: 12px;
    flex-shrink: 0;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.04);
}

.chat-link-pdf-thumb {
    width: 92px;
    min-height: 92px;
    border-radius: 12px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #ff5f5f, #ff8f5f);
    color: #fff;
    font-size: 22px;
    font-weight: 900;
    letter-spacing: 0.08em;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.18);
}

.chat-link-card-meta {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.chat-link-card-title {
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.3;
}

.chat-link-card-domain {
    color: rgba(255,255,255,0.72);
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-link-card-badge {
    align-self: flex-start;
    margin-top: 2px;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.chat-link-card-badge.trusted {
    background: rgba(92, 214, 141, 0.18);
    color: #a8ffcf;
}

.chat-link-card-badge.caution {
    background: rgba(255, 189, 89, 0.18);
    color: #ffd48f;
}

.external-link-modal-card {
    width: min(92vw, 520px);
    border-radius: 24px;
    border: 1px solid rgba(255,255,255,0.1);
    background: linear-gradient(180deg, rgba(20,24,40,0.98), rgba(10,12,22,0.98));
    box-shadow: 0 24px 70px rgba(0,0,0,0.5);
    color: #fff;
    overflow: hidden;
}

.external-link-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding: 22px 22px 12px;
}

.external-link-kicker {
    margin: 0 0 6px;
    color: #7cc7ff;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.external-link-head h3 {
    margin: 0;
    font-size: 24px;
    line-height: 1.15;
    letter-spacing: -0.03em;
}

.external-link-body {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 0 22px 22px;
}

.external-link-badge {
    align-self: flex-start;
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(255, 189, 89, 0.16);
    color: #ffd48f;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.external-link-copy {
    margin: 0;
    color: rgba(255,255,255,0.76);
    line-height: 1.6;
    font-size: 14px;
}

.external-link-url {
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.08);
    color: #dff3ff;
    font-size: 13px;
    line-height: 1.45;
    word-break: break-word;
}

.external-link-check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    color: rgba(255,255,255,0.86);
    font-size: 14px;
    line-height: 1.5;
}

.external-link-check input {
    margin-top: 3px;
    accent-color: #7cc7ff;
}

.external-link-actions {
    display: flex;
    gap: 10px;
}

.external-link-actions button {
    flex: 1;
}

.external-link-actions .announcement-primary-btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
    filter: grayscale(0.1);
}

.reply-target-flash {
    animation: replyTargetFlash 1.2s ease;
}

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

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

@keyframes replyTargetFlash {
    0% {
        box-shadow: 0 0 0 0 rgba(124, 199, 255, 0.6);
        background: rgba(124, 199, 255, 0.2);
    }
    60% {
        box-shadow: 0 0 0 16px rgba(124, 199, 255, 0);
        background: rgba(124, 199, 255, 0.06);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(124, 199, 255, 0);
        background: inherit;
    }
}

@keyframes scrollPulse {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(4px);
    }
}

.sent .message-bubble { background: #6e54ff; color: white; border-bottom-right-radius: 2px; }
.received .message-bubble { background: #16162d; color: #e0e0e0; border-bottom-left-radius: 2px; border: 1px solid #1e1e2f; }

/* In-Bubble Name Style */
.sender-name { 
    display: block; 
    font-size: 11px; 
    font-weight: 800; 
    margin-bottom: 2px; 
    color: #a594ff; 
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

.msg-time {
    font-size: 9px;
    opacity: 0.5;
    align-self: flex-end;
    margin-top: 2px;
}

/* --- MODAL STYLES --- */
.modal-overlay {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.9);
    backdrop-filter: blur(10px); z-index: 9999; align-items: center; justify-content: center;
}
.modal-box {
    background: #0a0a1a; border: 1px solid #1e1e2f; padding: 30px;
    border-radius: 25px; width: 90%; max-width: 340px; text-align: center;
}
.modal-box img { width: 120px; height: 120px; border-radius: 20px; border: 3px solid #6e54ff; margin-bottom: 15px; }

/* --- RESPONSIVE / MOBILE SETTINGS --- */
.mobile-header { display: none; }
.header-info-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.06);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.chat-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px 8px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.chat-section-kicker {
    color: #7cc7ff;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 10px;
    font-weight: 800;
    margin-bottom: 4px;
}

.chat-section-head h3 {
    color: #fff;
    font-family: var(--font-display);
    font-size: 24px;
    letter-spacing: -0.03em;
}

.desktop-info-btn {
    display: inline-flex;
}

.manage-subsection {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

.manage-subsection-title {
    color: #ffd7c7;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.unban-request-card {
    max-width: 560px;
}

.unban-request-note {
    color: rgba(255,255,255,0.72);
    line-height: 1.6;
    font-size: 14px;
}

.review-request-card {
    padding: 16px;
    border-radius: 18px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    margin-bottom: 12px;
}

.review-request-card b {
    color: #fff;
}

.review-request-card p {
    color: rgba(255,255,255,0.72);
    font-size: 13px;
    line-height: 1.55;
    margin-top: 6px;
}

.review-request-actions {
    display: flex;
    gap: 10px;
    margin-top: 14px;
}

.review-request-actions button {
    flex: 1;
    border: none;
    border-radius: 12px;
    padding: 10px 12px;
    font-weight: 700;
    cursor: pointer;
}

.review-request-actions .approve {
    background: linear-gradient(135deg, #4caf50, #2e7d32);
    color: #fff;
}

.review-request-actions .reject {
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.88);
}

@media (max-width: 768px) {
    .mobile-header {
        display: flex; align-items: center; background: #0a0a1a;
        padding: 10px 15px; height: 60px; border-bottom: 1px solid #1e1e2f;
        position: sticky; top: 0; z-index: 1000;
    }
    .mobile-header {
        position: sticky;
    }
    #BTN_UNBAN_INFO {
        position: absolute;
        right: 15px;
        top: 50%;
        transform: translateY(-50%);
    }
    .header-info h2 { font-size: 16px; color: white; }
    .header-info span { font-size: 12px; color: #6e54ff; }

    .sidebar {
        position: fixed; left: -280px; top: 0; bottom: 0;
        width: 280px; z-index: 2001; /* Higher than header */
    }
    .sidebar.active { left: 0; }

    .sidebar-overlay {
        display: none; position: fixed; inset: 0;
        background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(4px);
        z-index: 2000;
    }
    .sidebar-overlay.active { display: block; }

    .mobile-only-btn { background: none; border: none; color: white; margin-right: 15px; cursor: pointer; display: block !important; }
    .chat-section-head {
        display: none;
    }

    .announcements-section {
        padding: 16px;
    }

    .media-section {
        padding: 16px;
    }

    .homework-section {
        padding: 16px;
    }

    .memes-section {
        padding: 16px;
    }

    .media-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .media-search-wrap {
        min-width: 0;
    }

    .media-selects {
        width: 100%;
        flex-direction: column;
    }

    .media-selects select {
        width: 100%;
    }

    .announcements-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .announcements-toolbar-actions {
        justify-content: space-between;
    }

    .announcement-create-btn {
        justify-content: center;
    }

    .homework-calendar-head,
    .homework-day-summary,
    .homework-card-topline {
        flex-direction: column;
        align-items: flex-start;
    }

    .homework-schedule-box,
    .homework-form-actions {
        display: flex;
        flex-direction: column;
        align-items: stretch;
    }

    .homework-admin-bar {
        justify-content: stretch;
    }

    .homework-open-btn,
    .homework-secondary-btn,
    .homework-form button[type="submit"] {
        width: 100%;
    }

    .homework-modal-card {
        width: min(94vw, 760px);
        max-height: 86vh;
        padding: 18px;
    }

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

    .meme-hero-video {
        height: 60vh;
    }

    .meme-grid-container {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 12px;
    }

    .announcement-modal-card {
        padding: 18px;
    }

    .announcement-form-actions {
        flex-direction: column-reverse;
    }

    .announcement-card-main {
        grid-template-columns: 1fr;
    }

    .announcement-card-thumb {
        width: 100%;
        height: 150px;
    }

    .announcement-view-body {
        padding: 20px 18px 24px;
    }
}
/* --- MODAL CLOSE BUTTON STYLING --- */
.modal-box button {
    margin-top: 20px;
    background: #6e54ff; /* Schoolix Purple */
    color: white;
    border: none;
    padding: 10px 25px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%; /* Mobile par full width accha lagta hai */
    text-transform: uppercase;
    letter-spacing: 1px;
}

.modal-box button:hover {
    background: #5a42e0;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(110, 84, 255, 0.4);
}

.modal-box button:active {
    transform: translateY(0);
}
/* 1. GIF Modal (The Container) */
#gif-modal {
    display: none;
    position: absolute;
    bottom: calc(100% + 15px); 
    left: 10px; /* 0 ki jagah 10px ya 20px karo taaki sidebar se door rahe */
    width: 300px;
    background: #1e1e1e;
    z-index: 1500; /* Sidebar (2000) se kam, lekin chat window se zyada */
    border-radius: 15px;
    /* ... baki styles wahi rehne do ... */
}

/* 2. Search Area inside GIF box */
.gif-header {
    padding: 10px;
    background: #252525;
    display: flex;
    gap: 8px;
    align-items: center;
}

#gif-search-input {
    flex: 1;
    background: #333;
    border: none;
    padding: 8px 12px;
    border-radius: 20px;
    color: white;
    font-size: 14px;
    outline: none;
}

/* 3. GIF Results Grid (The Scrolling Part) */
#gif-results {
    display: grid;
    grid-template-columns: repeat(3, 1fr); /* 3 columns WhatsApp style */
    gap: 5px;
    padding: 10px;
    overflow-y: auto;
    flex: 1;
}

#gif-results img {
    width: 100%;
    height: 80px;
    object-fit: cover;
    border-radius: 5px;
    transition: transform 0.2s;
}

#gif-results img:active {
    transform: scale(0.95);
}

/* 4. Message Bubble mein GIF ka look */
.chat-gif-img {
    max-width: 100%;
    width: 180px; /* Thoda chota aur clean look */
    height: auto;
    border-radius: 8px;
    margin-top: 5px;
    display: block;
}

/* Scrollbar styling for a cleaner look */
#gif-results::-webkit-scrollbar {
    width: 4px;
}
#gif-results::-webkit-scrollbar-thumb {
    background: #6e54ff;
    border-radius: 10px;
}

/* Phone fitting adjustment */
@media (max-width: 480px) {
    #gif-modal {
        width: 100%;
        bottom: 55px; /* Mobile input height ke hisaab se */
        border-radius: 20px 20px 0 0;
    }
}
.file-card:hover {
    background: rgba(255, 255, 255, 0.1) !important;
    transform: translateY(-2px);
}
.chat-media-container:hover img {
    filter: brightness(0.8);
}
/* WhatsApp Style Spinner */
.whatsapp-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(255,255,255,0.2);
    border-top: 3px solid #6e54ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 5px;
}

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

.chat-upload-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    background: rgba(0,0,0,0.1);
    border-radius: 10px;
}

/* GIF Badge */
.gif-container { position: relative; display: inline-block; }
.gif-badge {
    position: absolute; bottom: 8px; left: 8px;
    background: rgba(0,0,0,0.6); color: white;
    font-size: 10px; padding: 2px 5px; border-radius: 3px;
    font-weight: bold; border: 0.5px solid #fff;
}
.chat-gif { border: 2px solid #6e54ff; border-radius: 10px; max-width: 200px; }

.whatsapp-tray {
    display: none;
    gap: 12px;
    padding: 10px 15px;
    background: #1e1e1e;
    border-top: 1px solid #333;
    overflow-x: auto;
    max-height: 80px; /* Small height */
    align-items: center;
}

.tray-thumb-wrapper {
    position: relative;
    width: 50px;
    height: 50px;
    flex-shrink: 0;
}

.tray-thumb-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid #444;
}

.file-icon-tray {
    width: 100%;
    height: 100%;
    background: #6e54ff;
    color: white;
    font-size: 10px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
}

.remove-btn {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4b2b;
    color: white;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}
/* Grid Container */
.image-grid {
    display: grid;
    gap: 4px;
    max-width: min(280px, 100%);
    width: 100%;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
}

/* Grid Layouts based on count */
.grid-1 { grid-template-columns: 1fr; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.grid-3 img:first-child { grid-row: span 2; }
.grid-4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }

.grid-item {
    position: relative;
    width: 100%;
    height: 100%;
}

.grid-item img {
    width: 100%;
    height: 120px;
    object-fit: cover;
    display: block;
}

@media (max-width: 420px) {
    .input-area {
        gap: 8px;
        padding: 10px 12px;
    }

    .action-btn,
    .send-btn {
        width: 40px;
        height: 40px;
    }

    .input-container-inner {
        padding: 0 10px;
    }
}

/* Media Viewer Styling */
/* Media Viewer Styling - Fully Fixed */
#media-viewer {
    display: none; 
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.98) !important;
    z-index: 9999999 !important; 
    flex-direction: column;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

#viewer-img {
    max-width: 95%;
    max-height: 80dvh;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 0 40px rgba(0,0,0,0.8);
    pointer-events: auto;
}

.viewer-nav {
    display: flex;
    align-items: center;
    gap: 40px;
    margin-top: 30px;
    color: white;
    z-index: 10000000;
}

#close-viewer-btn {
    position: absolute;
    top: 20px;
    right: 25px;
    font-size: 50px;
    color: #fff;
    cursor: pointer;
    z-index: 10000001;
    text-shadow: 0 0 10px rgba(0,0,0,0.5);
}
/* Context Menu Styling */
.glass-menu {
    position: fixed; /* Zaroori: taaki scroll ke saath move na ho */
    background: rgba(25, 25, 25, 0.95);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 8px;
    min-width: 180px;
    z-index: 10000;
    box-shadow: 0 20px 40px rgba(0,0,0,0.7);
    animation: menuFade 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: #efefef;
    font-size: 14px;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.2s ease;
}

.menu-item:hover {
    background: rgba(110, 84, 255, 0.2);
    color: #8b75ff;
}

.menu-item svg {
    width: 18px;
    height: 18px;
    opacity: 0.8;
}

.menu-item.danger {
    color: #ff4b2b;
}

.menu-item.danger:hover {
    background: rgba(255, 75, 43, 0.15);
}

.menu-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 6px 4px;
}

@keyframes menuFade {
    from { opacity: 0; transform: scale(0.9) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}
/* Custom Context Menu */
.glass-menu {
    position: absolute;
    background: rgba(25, 25, 25, 0.85);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 8px;
    z-index: 10000;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    min-width: 150px;
}

.menu-item {
    padding: 10px 15px;
    color: white;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    border-radius: 8px;
    transition: 0.2s;
}

.menu-item:hover { background: rgba(110, 84, 255, 0.2); }
.menu-item.warn:hover { background: rgba(255, 171, 0, 0.2); color: #ffab00; }
.menu-item.danger:hover { background: rgba(255, 75, 43, 0.2); color: #ff4b2b; }

/* Custom Modal */
.custom-modal-overlay {
    position: fixed;
    top:0; left:0; width:100%; height:100%;
    background: rgba(0,0,0,0.7);
    display: flex; align-items: center; justify-content: center;
    z-index: 20000;
}

.custom-modal {
    padding: 25px;
    width: 90%;
    max-width: 350px;
    text-align: center;
    border-radius: 20px;
}

.punish-opts { display: flex; gap: 10px; margin: 20px 0; flex-wrap: wrap; justify-content: center; }
.punish-opts button {
    padding: 10px 15px;
    background: #6e54ff;
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: bold;
}

.punish-opts button.danger { background: #ff4b2b; }
.close-btn { background: none; border: 1px solid #444; color: #aaa; margin-top: 10px; padding: 5px 15px; border-radius: 5px; }

/* Animations */
.animate-pop { animation: pop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
@keyframes pop { from { transform: scale(0.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* 1. Disable default text selection for custom context menu */
body {
    -webkit-user-select: none;  /* Safari/Chrome */
    -moz-user-select: none;     /* Firefox */
    -ms-user-select: none;      /* IE/Edge */
    user-select: none;          /* Standard */
    -webkit-touch-callout: none; /* iOS Safari default menu disable */
}

/* 2. Typing boxes mein selection enable rakhna zaroori hai */
input, textarea, #message-input {
    -webkit-user-select: text !important;
    user-select: text !important;
}

/* 3. Sidebar smooth transition (Halka sa smooth slide) */
.sidebar {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), left 0.3s ease;
}

.sidebar-overlay {
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* Overlay jab active ho toh kaisa dikhe */
.sidebar-overlay.active {
    display: block !important;
    opacity: 1;
}
/* --- ADMIN SECTION UI REBOOT --- */
#ADMIN_SECTION {
    padding: 10px 15px;
    margin-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.admin-header-title {
    color: #ff4b2b;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin-bottom: 12px;
    padding-left: 10px;
}

.admin-link {
    display: flex !important;
    align-items: center;
    gap: 14px;
    padding: 12px 15px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    border-radius: 12px;
    transition: all 0.2s ease;
    margin-bottom: 4px;
}

/* Hover Effects */
.admin-link:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    transform: translateX(5px);
}

.admin-link.is-live-stop {
    background: rgba(255, 92, 92, 0.1);
    border: 1px solid rgba(255, 92, 92, 0.18);
    color: #ffd2d2;
}

/* Icons Specific Colors */
#BTN_WIPE_HUB i { color: #ff4b2b; }
#BTN_MANAGE_USERS i { color: #4dabf7; }
#BTN_SHUTDOWN i { color: #fcc419; }

.admin-link span {
    font-size: 14px;
    font-weight: 500;
}

/* Logout Button Adjustment */
.sidebar-footer {
    padding: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}
/* Sidebar ke andar admin section ko force show karna */
#ADMIN_SECTION, #ADMIN_WIPE_FORCE {
    visibility: visible !important;
    opacity: 1 !important;
}

/* Check karo kahin sidebar-footer ke piche toh nahi dab gaya */
.sidebar {
    overflow-y: auto; /* Agar buttons zyada ho jayein toh scroll ho sake */
}
.modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.9); /* Dark overlay */
    backdrop-filter: blur(10px); /* Glass effect */
    z-index: 100000; /* Sabse upar */
    display: none; /* JS isse handle karega */
    justify-content: center;
    align-items: center;
}

.modal-overlay.active {
    display: flex !important; /* Click karne par show hoga */
}

.modal-content {
    background: #151515;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    width: 90%;
    max-width: 450px;
    padding: 20px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
}

@keyframes emergencyPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 91, 91, 0.65);
    }
    70% {
        box-shadow: 0 0 0 14px rgba(255, 91, 91, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 91, 91, 0);
    }
}

@keyframes emergencyBars {
    0%, 100% {
        transform: scaleY(0.55);
        opacity: 0.65;
    }
    50% {
        transform: scaleY(1.1);
        opacity: 1;
    }
}

@keyframes emergencyFloat {
    0%, 100% {
        transform: translate3d(0, 0, 0);
    }
    50% {
        transform: translate3d(0, -18px, 0);
    }
}

@keyframes emergencyPanelIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}
