/* 
 * 마이페이지 스타일시트
 * 관리자 페이지 라이트 테마와 동일한 고급진 회색 테마
 */

/* ===== CSS Variables - Premium Gray Theme ===== */
:root {
    /* Primary Colors - Blue accent (like admin) */
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --calendar-weekday-bg: #488cef;
    --calendar-nav-bg: #f8f8f8;
    --calendar-accent-blue: #3b82f6;

    /* Background Colors - Premium Gray */
    --bg-dark: #e4e4e4;
    --bg-darker: #f1f1f1;
    --bg-card: #ffffff;
    --bg-secondary: #d4d4d4;
    --bg-glass: rgba(0, 0, 0, 0.03);

    /* Text Colors */
    --text-primary: #545961;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;

    /* Status Colors */
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;

    /* Border */
    --border: rgba(0, 0, 0, 0.1);

    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-2xl: 3rem;

    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 300ms ease;

    /* Font */
    --font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-family);
    background: var(--bg-darker);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

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

img {
    max-width: 100%;
    height: auto;
    display: block;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    outline: none;
}

input,
select,
textarea {
    font-family: inherit;
    font-size: inherit;
}

/* ===== Typography ===== */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
}

h1 {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
}

h2 {
    font-size: clamp(1.5rem, 3vw, 2rem);
}

h3 {
    font-size: clamp(1.25rem, 2.5vw, 1.5rem);
}

h4 {
    font-size: clamp(1.1rem, 2vw, 1.25rem);
}

p {
    color: var(--text-secondary);
}

/* ===== Container ===== */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-lg);
}

/* ===== Header & Navigation ===== */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: var(--spacing-md) 0;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: var(--transition-normal);
}

.header .container {
    max-width: 100%;
    padding-left: var(--spacing-md);
    padding-right: var(--spacing-md);
}

.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-lg);
}

.nav-center {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 0.4rem;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-left: 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.logo img {
    height: 40px;
    width: auto;
}

.logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.nav-link {
    padding: var(--spacing-sm) var(--spacing-md);
    color: var(--text-secondary);
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: var(--transition-fast);
}

.nav-link:hover {
    color: var(--text-primary);
    background: var(--bg-glass);
}

.nav-user-hidden {
    display: none;
}

.header-logout-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 1rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    color: var(--text-secondary);
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all var(--transition-fast);
}

.header-logout-btn:hover {
    background: #eef2ff;
    border-color: #c7d2fe;
    color: #4338ca;
}

.header-quick-menu {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-right: 0.75rem;
}

.header-quick-menu button {
    background: none;
    border: none;
    color: inherit;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
}

.header-quick-menu button:hover {
    color: #4338ca;
    text-decoration: underline;
}

.header-menu-sep {
    color: #cbd5f5;
}

.top-gift-banner {
    margin-top: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    width: auto;
    max-width: 100%;
    border: none;
    background: transparent;
    border-radius: 0;
    padding: 0;
}

.top-gift-banner.swipe {
    animation: topGiftSwipeIn 0.35s ease;
}

.top-gift-banner-icon {
    display: none;
}

.top-gift-banner-text {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.top-gift-banner-title {
    font-size: 1.08rem;
    color: #4f46e5;
    font-weight: 800;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.top-gift-banner-detail {
    font-size: 1rem;
    color: #475569;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.order-coupon-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.72rem;
    padding: 0.68rem 0.82rem;
    border: 1px solid #dbe5f4;
    border-radius: 12px;
    background: #ffffff;
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.order-coupon-item:hover {
    border-color: #c7d2fe;
    background: #f8faff;
}

.order-coupon-item.is-selected {
    border-color: #6366f1;
    background: #eef2ff;
    box-shadow: inset 0 0 0 1px rgba(99, 102, 241, 0.2);
}

.order-coupon-item.is-disabled {
    background: #f8fafc;
    border-color: #e2e8f0;
    cursor: default;
    opacity: 0.82;
}

.order-coupon-radio {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.order-coupon-check {
    width: 22px;
    height: 22px;
    border-radius: 8px;
    border: 1.5px solid #cbd5e1;
    background: #ffffff;
    color: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.order-coupon-check i {
    font-size: 0.68rem;
}

.order-coupon-item.is-selected .order-coupon-check {
    border-color: #4f46e5;
    background: #4f46e5;
    color: #ffffff;
}

.order-coupon-content {
    min-width: 0;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.order-coupon-main {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
    color: #1e293b;
    font-size: 0.92rem;
    line-height: 1.3;
}

.order-coupon-kind {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 0.2rem 0.55rem;
    background: #e2e8f0;
    color: #475569;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.order-coupon-benefit {
    display: inline-flex;
    align-items: baseline;
    gap: 0.18rem;
    flex-wrap: wrap;
    color: #0f172a;
    font-weight: 700;
}

.order-coupon-benefit-key {
    color: #16a34a;
    font-size: 1.05rem;
    font-weight: 800;
    line-height: 1.2;
}

.order-coupon-benefit-tail {
    color: #0f172a;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.25;
}

.order-coupon-meta {
    color: #64748b;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}

.order-coupon-item.is-disabled .order-coupon-main,
.order-coupon-item.is-disabled .order-coupon-benefit,
.order-coupon-item.is-disabled .order-coupon-meta,
.order-coupon-item.is-disabled .order-coupon-kind {
    color: #94a3b8;
}

.order-coupon-item.is-disabled .order-coupon-benefit-key,
.order-coupon-item.is-disabled .order-coupon-benefit-tail {
    color: #94a3b8;
}

.order-coupon-reason {
    color: #ef4444;
    font-size: 0.78rem;
    font-weight: 700;
    margin-left: 0.35rem;
}

.order-price-final {
    display: inline-flex;
    align-items: baseline;
    color: #4f46e5;
    font-weight: 800;
    line-height: 1.12;
    white-space: nowrap;
}

.order-price-meta {
    display: inline-flex;
    align-items: baseline;
    gap: 0.34rem;
    flex-wrap: wrap;
    margin-top: 0;
    font-size: 0.84em;
    line-height: 1.2;
}

.order-price-discount-wrap {
    display: inline-flex;
    align-items: baseline;
    gap: 0.2rem;
    white-space: nowrap;
}

.order-price-original {
    color: #dc2626;
    text-decoration: line-through;
    font-weight: 700;
    white-space: nowrap;
}

.order-price-discount-note {
    color: #dc2626;
    font-weight: 800;
    white-space: nowrap;
}

.order-price-reward-note {
    color: #059669;
    font-weight: 800;
    white-space: nowrap;
}

.mobile-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 1px solid #c7d2fe;
    background: #eef2ff;
    color: #4338ca;
    font-size: 1.25rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.mobile-menu-btn:hover {
    background: #dbeafe;
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: var(--spacing-sm) var(--spacing-lg);
    font-weight: 600;
    font-size: 0.95rem;
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast);
    white-space: nowrap;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

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

.btn-secondary:hover {
    background: var(--bg-dark);
    border-color: var(--primary);
}

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

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

.btn-lg {
    padding: var(--spacing-md) var(--spacing-xl);
    font-size: 1.1rem;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

/* ===== App Layout ===== */
.app-layout {
    display: flex;
    min-height: 100vh;
    padding-top: 70px;
}

/* ===== Sidebar ===== */
.sidebar {
    width: 300px;
    background: transparent;
    border-right: none;
    padding: calc(var(--spacing-xl) + 0.25rem);
    padding-bottom: 0.35rem;
    position: fixed;
    top: calc(70px + var(--spacing-xl));
    bottom: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1200;
}

.sidebar-overlay {
    position: fixed;
    inset: 0;
    top: var(--header-height, 70px);
    background: transparent;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-fast);
    z-index: 2400;
    display: none;
}

.sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: var(--spacing-md);
    right: var(--spacing-md);
    background: var(--bg-card);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    box-shadow: var(--shadow-sm);
    pointer-events: none;
    z-index: 0;
}

.sidebar>* {
    position: relative;
    z-index: 1;
}

.sidebar-menu {
    list-style: none;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    flex: 1 1 auto;
    overflow-y: auto;
    padding-right: 0.25rem;
    padding-bottom: var(--spacing-md);
}

.sidebar-item {
    margin-bottom: 0.35rem;
    width: 100%;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    padding-left: 0.85rem;
    color: var(--text-secondary);
    border-radius: var(--radius-lg);
    transition: all var(--transition-fast);
    justify-content: flex-start;
    text-align: left;
    width: 100%;
    flex-wrap: nowrap;
}

#levelTestLink {
    padding-left: 0.85rem !important;
    padding-right: 0.95rem !important;
    text-align: left;
    width: 100%;
}

#levelTestLink>div {
    justify-content: flex-start;
}

#levelTestMenuText {
    text-align: left;
}

.leveltest-status {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    line-height: 1.4;
}

.leveltest-status-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 700;
    color: #1f2937;
}

.leveltest-status-date {
    font-size: 0.85rem;
    font-weight: 700;
    color: #92400e;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 0.5rem;
    padding: 0.2rem 0.55rem;
    align-self: flex-start;
}

.leveltest-status-message {
    font-size: 0.75rem;
    color: #4b5563;
}

.leveltest-complete-card {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 0.55rem 0;
    color: #111827;
    position: relative;
    overflow: hidden;
}

.leveltest-complete-row {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.leveltest-complete-icon {
    width: auto;
    height: auto;
    border-radius: 0;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #111827;
    flex-shrink: 0;
}

.leveltest-complete-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: #111827;
}

.leveltest-complete-desc {
    font-size: 0.78rem;
    color: #374151;
    line-height: 1.35;
}

.leveltest-complete-btn {
    margin-top: 0.5rem;
    background: #111827;
    color: #fde68a;
    padding: 0.45rem 0.95rem;
    border-radius: 12px;
    border: none;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    align-self: center;
    box-shadow: none;
}

.sidebar-link:hover {
    background: var(--bg-glass);
    color: var(--text-primary);
}

.sidebar-link.active {
    background: var(--primary);
    color: white;
}

.sidebar-time {
    margin-top: 0.5rem;
    padding: var(--spacing-md);
    background: linear-gradient(135deg, #f8fafc, #eef2ff);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    text-align: center;
}

.sidebar-time-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.sidebar-time-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
}

.sidebar-time-zone {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    background: rgba(99, 102, 241, 0.12);
    color: #4f46e5;
    font-size: 0.7rem;
    font-weight: 600;
}

.sidebar-time-change {
    font-size: 0.7rem;
    font-weight: 600;
    color: #4f46e5;
    background: transparent;
    border: 1px solid rgba(79, 70, 229, 0.35);
    border-radius: 999px;
    padding: 0.15rem 0.5rem;
    transition: all var(--transition-fast);
}

.sidebar-time-change:hover {
    background: rgba(79, 70, 229, 0.08);
}

.sidebar-time-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 0.02em;
}

.sidebar-time-date {
    margin-top: 0.2rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.sidebar-language {
    margin-top: 0.5rem;
    margin-bottom: 4px;
    padding: 0.4rem var(--spacing-md);
    background: var(--bg-white);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
}

.sidebar-language-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}

.sidebar-language select {
    appearance: none;
    border: 1px solid rgba(148, 163, 184, 0.4);
    border-radius: 999px;
    padding: 0.3rem 0.65rem;
    font-size: 0.78rem;
    font-weight: 600;
    background: #ffffff;
    color: #111827;
    cursor: pointer;
}

/* ===== Main Content ===== */
.main-content {
    flex: 1;
    margin-left: 300px;
    padding: var(--spacing-xl);
    padding-left: var(--spacing-sm);
}

/* ===== Cards ===== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    margin-bottom: var(--spacing-lg);
    box-shadow: var(--shadow-sm);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-md);
    border-bottom: 1px solid var(--border);
}

/* ===== Forms ===== */
.form-group {
    margin-bottom: var(--spacing-lg);
}

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

.form-input,
.form-control {
    width: 100%;
    padding: var(--spacing-md);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

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

.form-input::placeholder,
.form-control::placeholder {
    color: var(--text-muted);
}

select.form-control {
    appearance: none;
    background-color: var(--bg-card);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%236b7280' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.5rem;
}

/* ===== Tables ===== */
.table-container {
    overflow-x: auto;
}

.orders-table-container {
    overflow-x: auto;
}

.orders-table {
    border: 1px solid #e5e7eb;
    table-layout: fixed;
}

.orders-table th,
.orders-table td {
    border: 1px solid #e5e7eb;
    text-align: left;
    vertical-align: middle;
}

.orders-table th {
    font-size: 0.95rem;
    font-weight: 700;
    text-transform: none;
}

.orders-table td {
    font-size: 0.9rem;
    color: var(--text-primary);
}

@media (min-width: 769px) {
    .orders-table th.orders-col-time,
    .orders-table td.orders-col-time {
        width: 7%;
        min-width: 86px;
        white-space: nowrap;
    }

    .orders-table th.orders-col-amount,
    .orders-table td.orders-col-amount {
        width: 15%;
        min-width: 170px;
    }
}

.ai-apps-card {
    overflow: hidden;
}

.ai-apps-table-container {
    margin: 0;
    padding: 0;
}

@media (min-width: 1200px) {

    .ai-apps-card .card-header,
    .ai-apps-card .table-container,
    .ai-apps-card>p {
        max-width: 100%;
        margin-left: 0;
        margin-right: 0;
    }
}

.ai-apps-table {
    border: 1px solid #e5e7eb;
    table-layout: fixed;
}

.ai-apps-table th,
.ai-apps-table td {
    border: 1px solid #e5e7eb;
    text-align: left;
    vertical-align: middle;
}

.ai-apps-table th {
    font-size: 0.95rem;
    font-weight: 700;
    text-transform: none;
}

.ai-apps-table td {
    font-size: 0.9rem;
    color: var(--text-primary);
}

.chat-layout {
    position: relative;
    flex: 1;
    display: flex;
    overflow: hidden;
}

.chat-page-card {
    height: calc(100vh - 70px - var(--spacing-xl) - 10px);
    margin-bottom: 0;
}

.chat-header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chat-admin-contact-btn {
    border: 1px solid #c7d2fe;
    background: #eef2ff;
    color: #4338ca;
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: all var(--transition-fast);
}

.chat-admin-contact-btn:hover {
    background: #e0e7ff;
    border-color: #a5b4fc;
}

.chat-admin-contact-btn:active {
    transform: translateY(1px);
}

.chat-admin-notice {
    position: sticky;
    top: 0.2rem;
    z-index: 2;
    margin: 0 auto 0.35rem;
    padding: 0.55rem 1rem;
    border-radius: 999px;
    background: #fef9c3;
    color: #92400e;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.4;
    display: flex;
    justify-content: center;
    max-width: calc(100% - 2rem);
    white-space: normal;
    text-align: center;
}

.chat-list-toggle {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid #c7d2fe;
    background: #eef2ff;
    color: #4338ca;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.chat-list-toggle:hover {
    background: #dbeafe;
    border-color: #a5b4fc;
}

.chat-toggle-desktop {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.chat-toggle-mobile {
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.chat-list-panel {
    width: 280px;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    transition: transform var(--transition-normal);
}

.chat-list-overlay {
    display: none;
}

.chat-messages-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #f8fafc;
    position: relative;
}

#chatTranslateToggle.chat-translate-popup {
    position: absolute;
    right: 0.75rem;
    bottom: 88px;
    display: flex;
    align-items: center;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.35rem 0.75rem;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.12);
}

.chat-translate-label {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.chat-translate-label input {
    width: 14px;
    height: 14px;
    cursor: pointer;
}

#chatInputArea {
    background: transparent !important;
    border-top: none !important;
    margin-bottom: 0;
    position: relative;
}

.chat-ai-footer {
    margin-top: auto;
    margin-bottom: 0;
}

#chatInputArea .chat-attach-button {
    background: #fefefe !important;
    width: 48px;
    height: 48px;
    border-radius: 0.75rem;
}

#chatInputArea .chat-input-field {
    background: #fefefe !important;
    height: 48px;
    border-radius: 1.5rem;
}

#chatInputArea .chat-send-button {
    width: 48px;
    height: 48px;
    border-radius: 0.75rem;
}

#chatInputArea>div {
    gap: 0.3rem;
}

.class-type-grid {
    align-items: stretch;
}

.class-type-grid>label {
    display: block;
    height: 100%;
}

.class-type-card {
    height: 100%;
    min-height: 140px;
}

#categoryLevelBadge {
    max-width: 100%;
    display: inline-flex;
    align-items: center;
    gap: 0.1rem;
    overflow: hidden;
    white-space: nowrap;
}

#categoryLevelText {
    flex: 1 1 auto;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: inline-block;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-transform: uppercase;
    background: #F9FAFB !important;
}

thead {
    background: #F9FAFB !important;
}

tr:hover td {
    background: rgba(0, 0, 0, 0.02);
}

/* ===== Badges ===== */
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: var(--radius-full);
}

.badge-success {
    background: rgba(34, 197, 94, 0.15);
    color: var(--success);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

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

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

.chat-badge {
    background: #ef4444;
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    display: none;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    line-height: 1;
    box-sizing: border-box;
}

.chat-badge.show {
    display: flex;
}

.sidebar-link .chat-badge {
    margin-left: auto;
}

.sidebar-counsel-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #ef4444;
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.35);
}


/* ===== Modal ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-normal), visibility var(--transition-normal);
}

.modal-overlay#modalOverlay {
    z-index: 3000;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform var(--transition-normal);
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
}

.modal-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-glass);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    font-size: 1.25rem;
    transition: all var(--transition-fast);
}

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

/* ===== QR Frame ===== */
.qr-frame {
    border: 1px solid var(--qr-border, var(--border));
    border-radius: 10px;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--qr-ink, var(--text-secondary));
    box-sizing: border-box;
}

.qr-frame img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.qr-frame canvas {
    width: 100%;
    height: 100%;
}

.qr-placeholder {
    font-size: var(--qr-icon-size, 2.5rem);
    color: var(--qr-muted, var(--text-muted));
}

.qr-fallback {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.85rem;
    font-weight: 600;
}

.qr-fallback small {
    font-size: 0.72rem;
    font-weight: 500;
    opacity: 0.75;
}

.qr-fallback i {
    font-size: 1.35rem;
}

.uid-ellipsis {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===== Calendar ===== */
.calendar {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: var(--spacing-lg);
}

.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--spacing-lg);
}

.calendar-nav {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
}

.calendar-nav-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-glass);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

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

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 2px;
    width: 100%;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-darker);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    transition: all var(--transition-fast);
}

.calendar-day:hover {
    background: var(--primary);
    color: white;
    cursor: pointer;
}

.calendar-day.today {
    border: 2px solid var(--primary);
}

.calendar-day.selected {
    background: var(--primary);
    color: white;
}

.calendar-day.disabled {
    color: var(--text-muted);
    pointer-events: none;
}

/* ===== Loading Spinner ===== */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-3xl);
}

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

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

/* ===== Alerts ===== */
.alert {
    padding: var(--spacing-md);
    border-radius: var(--radius-lg);
    margin-bottom: var(--spacing-md);
}

.alert-success {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.alert-danger {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert-warning {
    background: rgba(245, 158, 11, 0.1);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.2);
}

/* ===== Class Cards ===== */
.class-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-md);
    transition: all var(--transition-fast);
}

.class-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.class-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--spacing-md);
}

.class-card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.class-card-status {
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
}

.class-card-info {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-md);
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.class-card-info i {
    color: var(--primary);
    margin-right: 0.25rem;
}

/* ===== Profile Section Styles ===== */
.profile-section {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: var(--spacing-xl);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
}

.profile-header {
    margin-bottom: var(--spacing-xl);
    padding-bottom: var(--spacing-lg);
    border-bottom: 1px solid var(--border);
}

.profile-header h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
}

.profile-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.profile-avatar-section {
    display: flex;
    align-items: center;
    gap: var(--spacing-xl);
    padding: var(--spacing-lg);
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: var(--radius-lg);
    margin-bottom: var(--spacing-xl);
    border: 1px solid var(--border);
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.profile-avatar-info h4 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.profile-name-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.profile-pass-btn {
    background: #0f172a;
    color: #f8fafc;
    border: none;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
}

.profile-pass-btn:hover {
    background: #1e293b;
}

.profile-avatar-info p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: var(--spacing-sm);
}

.profile-avatar-btn {
    background: var(--bg-card);
    border: 1px solid var(--primary);
    color: var(--primary);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

.password-sticker-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.password-sticker-card {
    width: min(420px, 92vw);
    background: #fff7ed;
    border-radius: 18px;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.3);
    border: 2px solid #fdba74;
    padding: 1.1rem 1.2rem 1.2rem;
}

.password-sticker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.9rem;
}

.password-sticker-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: #9a3412;
}

.password-sticker-close {
    background: transparent;
    border: none;
    font-size: 1.4rem;
    cursor: pointer;
    color: #9a3412;
}

.password-sticker-body {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.password-form-group label {
    display: block;
    font-weight: 700;
    color: #92400e;
    margin-bottom: 0.35rem;
    font-size: 0.85rem;
}

.password-form-group input {
    width: 100%;
    border: 1px solid #fed7aa;
    border-radius: 10px;
    padding: 0.55rem 0.75rem;
    font-size: 0.9rem;
    background: #fffdf7;
}

.password-hint {
    margin-top: 0.35rem;
    font-size: 0.75rem;
    color: #9a3412;
}

.password-sticker-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1rem;
}

.password-sticker-cancel {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    color: #334155;
    padding: 0.45rem 0.9rem;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
}

.password-sticker-submit {
    background: #fb923c;
    border: none;
    color: #1f2937;
    padding: 0.45rem 1rem;
    border-radius: 10px;
    font-weight: 800;
    cursor: pointer;
}

.profile-form-group {
    margin-bottom: var(--spacing-lg);
}

.profile-form-group label {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
    font-size: 0.9rem;
}

.profile-form-group input,
.profile-form-group select {
    width: 100%;
    padding: 0.875rem 1rem;
    background: var(--bg-darker);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all var(--transition-fast);
}

.profile-form-group input:focus,
.profile-form-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
    background: var(--bg-card);
}

.profile-form-group input[readonly] {
    background: var(--bg-dark);
    color: var(--text-secondary);
    cursor: not-allowed;
}

.profile-actions {
    display: flex;
    gap: var(--spacing-md);
    justify-content: flex-end;
    padding-top: var(--spacing-xl);
    border-top: 1px solid var(--border);
    margin-top: var(--spacing-xl);
}

.profile-actions .btn-cancel {
    padding: 0.75rem 1.5rem;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    border-radius: var(--radius-lg);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.profile-actions .btn-cancel:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.profile-actions .btn-save {
    padding: 0.75rem 1.5rem;
    background: var(--primary);
    border: none;
    color: white;
    border-radius: var(--radius-lg);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.profile-actions .btn-save:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.class-settings-block {
    margin-bottom: var(--spacing-xl);
}

.class-settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-md);
    flex-wrap: wrap;
    padding: 0.6rem 0;
    border-bottom: 1px dashed var(--border);
}

.class-settings-row:last-child {
    border-bottom: none;
}

.class-settings-label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.class-toggle {
    display: flex;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 4px;
    gap: 4px;
}

.class-toggle-btn {
    border: none;
    background: transparent;
    color: #64748b;
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.class-toggle-btn.active {
    background: #fbbf24;
    color: #111827;
    box-shadow: 0 2px 6px rgba(251, 191, 36, 0.35);
}

.class-bg-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin-top: 0.6rem;
}

.class-bg-option {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.6rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #ffffff;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.class-bg-option.active {
    border-color: #7c3aed;
    border-width: 2px;
    box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.35);
}

.class-bg-swatch {
    width: 18px;
    height: 18px;
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    font-weight: 700;
    color: #111827;
}

.class-settings-save {
    width: 100px;
    min-width: 100px;
    margin-top: 0;
    padding: 0.5rem 0.9rem;
    background: #10b981;
    color: #fff;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.class-settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.class-settings-header > div {
    flex: 1;
}

.top-notice {
    position: fixed;
    top: 14px;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    background: #f6d55c;
    color: #111111;
    padding: 0.6rem 1.4rem;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 10005;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: max-content;
    min-width: 0;
    flex: 0 0 auto;
    max-width: 92vw;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.top-notice.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ===== Enhanced Calendar Styles ===== */
.calendar {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: var(--spacing-lg);
}

.calendar-header {
    display: flex;
    align-items: center;
    margin-bottom: var(--spacing-lg);
    gap: var(--spacing-lg);
}

.calendar-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
}

.calendar-nav {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.calendar-nav-row {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    width: 100%;
    justify-content: space-between;
}

.calendar-nav-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 4px;
    width: 100%;
}

    .calendar-weekday {
        padding: 0.75rem 0.5rem;
        text-align: center;
        font-weight: 600;
        font-size: 0.95rem;
        color: #ffffff;
        background: var(--calendar-weekday-bg);
        border: none;
        border-radius: var(--radius-sm);
        min-width: 0;
    }

.calendar-day {
    min-height: 90px;
    padding: 0.5rem;
    background: var(--calendar-nav-bg);
    border-radius: var(--radius-md);
    border: none;
    transition: all var(--transition-fast);
    position: relative;
    min-width: 0;
    display: block;
    aspect-ratio: auto;
    overflow: hidden;
}

.calendar-day:hover {
    background: var(--bg-card);
    border-color: var(--border);
}

.calendar-day.today {
    border: none;
    box-shadow: inset 0 0 0 2px #488cef;
    background: var(--calendar-nav-bg);
}

.calendar-day.other-month {
    opacity: 0.4;
}

.calendar-day .day-number {
    position: absolute;
    top: 4px;
    left: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
    z-index: 1;
}

.calendar-day.has-class {
    background: var(--calendar-nav-bg);
}

.calendar-day .class-items {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-top: 24px;
    margin-top: 4px;
}

.calendar-day .class-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.55rem;
    padding-left: 2.6rem;
    background: var(--status-color);
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.72rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: none;
    color: #ffffff;
    min-height: 2rem;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.calendar-day .class-status-square {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2.2rem;
    height: 100% !important;
    background: var(--status-color); /* Fallback */
    border-radius: 0;
    z-index: 2;
    display: block !important;
}

.calendar-day .class-status-dot {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ffffff !important;
    display: block;
    z-index: 3;
}

.class-status-row {
    display: flex;
    align-items: center;
    font-size: 0.7rem;
    font-weight: 500;
    color: #ffffff !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.calendar-day .class-item.level-test {
    color: #1f2937;
    box-shadow: var(--shadow-sm);
}

.calendar-day .class-item.level-test .class-time,
.calendar-day .class-item.level-test .class-status {
    color: inherit !important;
}



.calendar-day .class-item:hover {
    background: var(--status-color);
    color: white;
    transform: translateY(-1px);
    box-shadow: none;
}

.calendar-day .class-item:hover .class-time,
.calendar-day .class-item:hover .class-status {
    color: white !important;
}

.calendar-day .class-time {
    font-weight: 600;
    color: #ffffff;
}

.calendar-day .class-status {
    display: none;
}

.calendar-day .class-status-icon {
    font-size: 0.85rem;
    line-height: 1;
}

.calendar-day .class-item:hover {
    background: var(--status-color);
    color: white;
    transform: translateY(-1px);
    box-shadow: none;
}

.calendar-status-legend {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-left: auto;
}

.calendar-status-legend .legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0;
    background: transparent;
    border-radius: 0;
}

.calendar-status-legend .legend-dot {
    width: 14px;
    height: 14px;
    border-radius: 999px;
    display: inline-block;
}

.calendar-status-legend .legend-scheduled {
    background: #6366f1;
}

.calendar-status-legend .legend-completed {
    background: #22c55e;
}

.calendar-status-legend .legend-absent {
    background: #ef4444;
}

.calendar-status-legend .legend-today {
    background: #488cef;
}

.calendar-nav-box {
    background: var(--calendar-nav-bg);
    border: none;
    padding: 0.35rem 0.6rem;
    border-radius: 999px;
}

.calendar-nav-row {
    background: var(--calendar-nav-bg);
    border: none;
    padding: 0.5rem 0.75rem;
    border-radius: 16px;
}

.calendar-nav-btn {
    background: var(--calendar-accent-blue);
    border: none;
    border-radius: 10px;
    width: 34px;
    height: 34px;
    color: #ffffff;
}

.calendar-nav-btn:hover {
    background: #2563eb;
    color: #ffffff;
}

.calendar-nav-box .form-control {
    background-color: #ffffff;
    border: none;
    color: #111827;
    font-weight: 600;
    padding-right: 2rem;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%233b82f6'%3E%3Cpath d='M5.75 7.75L10 12l4.25-4.25' stroke='%233b82f6' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.65rem center;
    background-size: 0.7rem;
}

.calendar-status-legend {
    background: var(--calendar-nav-bg);
    border: none;
    padding: 0.35rem 0.6rem;
    border-radius: 999px;
    margin-left: 0;
    font-size: 0.9rem;
    color: #4b5563;
}

.calendar-status-legend .legend-item {
    background: #ffffff;
    border: none;
    border-radius: 10px;
    padding: 0.25rem 1.1rem;
    font-size: 0.92rem;
    font-weight: 600;
}

.calendar-status-legend .legend-today {
    border: none;
}

.today-class-section {
    width: 100%;
    background: transparent;
    border: none;
    padding: 0;
}

.today-class-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.today-class-header.no-title {
    justify-content: flex-end;
}

.today-class-header.no-title .today-class-title {
    display: none;
}

.today-class-header.no-title .today-class-actions-bar {
    margin-left: auto;
    justify-content: flex-end;
}

.today-class-title {
    font-weight: 700;
    font-size: 1.35rem;
    color: #1e293b;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.today-class-title .today-class-date {
    font-size: 0.85rem;
    font-weight: 600;
    color: #64748b;
    margin-left: 0.6rem;
}

.today-class-title i {
    color: #6366f1;
}

.today-class-date {
    font-size: 0.85rem;
    color: #64748b;
    font-weight: 600;
}

.today-class-actions-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.today-class-join-quick {
    border: none;
    background: #10b981;
    color: #ffffff;
    padding: 0.65rem 1.5rem;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 8px 18px rgba(16, 185, 129, 0.28);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.today-class-join-quick:hover {
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(16, 185, 129, 0.32);
}

.today-class-join-quick:disabled {
    background: #cbd5e1;
    color: #64748b;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.calendar-action-group {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.8rem 0.6rem 0.45rem;
    border-radius: 12px;
    border: 1px solid #d7dde6;
    background: #ffffff;
    position: relative;
}

.calendar-action-group-title {
    position: absolute;
    top: -0.55rem;
    left: 0.75rem;
    font-size: 0.7rem;
    font-weight: 700;
    color: #64748b;
    background: #ffffff;
    padding: 0 0.35rem;
    white-space: nowrap;
}

.today-class-actions-bar button {
    border: none;
    background: #4ea2ee;
    color: #ffffff;
    padding: 0.6rem 1.4rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
}

#calendarTimeChangeBtn {
    border: none;
    background: #4ea2ee;
    color: #ffffff;
}

#calendarPostponeGuideBtn {
    border: none;
    background: #4ea2ee;
    color: #ffffff;
}

#calendarMakeupGuideBtn {
    border: none;
    background: #4ea2ee;
    color: #ffffff;
}

.today-class-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    background: #f8f8f8;
    border: none;
    border-radius: 16px;
    padding: 1rem 1.25rem;
}

.today-class-empty {
    padding: 0.75rem 0;
    text-align: center;
    color: #94a3b8;
    font-weight: 600;
}

.today-class-item {
    display: flex;
    gap: 0.9rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px dashed #e2e8f0;
    align-items: flex-start;
}

.today-class-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.today-class-avatar {
    width: 110px;
    height: 150px;
    border-radius: 16px;
    background: #e2e8f0;
    overflow: hidden;
    flex-shrink: 0;
}

.today-class-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 16px;
}

.today-class-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    position: relative;
    --today-label-width: 120px;
    --today-label-gap: 40px;
}

.today-class-body::before {
    content: '';
    position: absolute;
    top: 0.2rem;
    bottom: 0.2rem;
    left: calc(var(--today-label-width) + (var(--today-label-gap) / 2));
    width: 1px;
    background: #e2e8f0;
    pointer-events: none;
}

.today-class-line {
    display: grid;
    grid-template-columns: var(--today-label-width) 1fr;
    align-items: center;
    column-gap: var(--today-label-gap);
    font-size: 0.92rem;
    color: #334155;
    padding: 0.15rem 0;
    border-bottom: 1px dotted #e2e8f0;
}

.today-class-body .today-class-line:last-of-type {
    border-bottom: none;
}

.today-class-label {
    font-weight: 700;
    color: #7d8694;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9rem;
}

.today-class-label::before {
    content: '•';
    color: #7d8694;
    font-size: 0.9rem;
}

.today-class-value-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-left: none;
    padding-left: 0;
}

.today-class-value {
    color: #7d8694;
    font-weight: 600;
    font-size: 0.9rem;
}

.today-class-change {
    border: none;
    background: #cfd6e6;
    color: #374151;
    font-size: 0.6rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.25rem 0.6rem;
    border-radius: 8px;
    transition: background 0.2s;
    line-height: 1;
}

.today-class-change:hover {
    background: #c2cada;
}

.textbook-change-modal {
    background: #ffffff;
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    width: 900px;
    max-width: 95vw;
}

.textbook-change-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.textbook-change-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1f2937;
}

.textbook-change-close {
    border: none;
    background: #e5e7eb;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    font-size: 1.2rem;
    cursor: pointer;
    color: #374151;
}

.textbook-change-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.textbook-change-selects {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    align-items: flex-start;
}

.textbook-change-field {
    flex: 1;
    min-width: 200px;
}

.textbook-change-field label {
    display: block;
    margin-bottom: 0.4rem;
    color: #6b7280;
    font-size: 0.85rem;
    font-weight: 600;
}

.textbook-change-chapter {
    display: flex;
    gap: 0.5rem;
}

.textbook-change-preview {
    padding: 0.6rem 0.9rem;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.textbook-change-info {
    margin-top: 0.5rem;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

.textbook-change-info-inner {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.textbook-change-image {
    width: 140px;
    height: 196px;
    border-radius: 12px;
    overflow: hidden;
    background: #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.textbook-change-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #ffffff;
}

.textbook-change-image-placeholder {
    color: #94a3b8;
    font-size: 2rem;
}

.textbook-change-level {
    display: inline-flex;
    align-items: center;
    gap: 0.1rem;
    padding: 0.35rem 0.75rem;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: #ffffff;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.textbook-change-info-content p {
    color: #475569;
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0;
}

.textbook-change-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.5rem;
}

.textbook-change-save {
    border: none;
    background: #4f46e5;
    color: #ffffff;
    padding: 0.6rem 1.2rem;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
}

.today-class-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-end;
    min-width: 140px;
}

.today-class-actions.leveltest-actions {
    align-items: center;
    align-self: center;
}

.today-class-action {
    border-radius: 12px;
    padding: 0.65rem 1.25rem;
    font-size: 0.85rem;
    font-weight: 700;
    border: 1px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    width: 140px;
    text-align: center;
}

.today-class-join {
    background: #de605e;
    color: #ffffff;
    box-shadow: none;
}

.today-class-postpone {
    background: #fcce40;
    color: #1f2937;
    border: none;
}

.today-class-makeup {
    background: #22c55e;
    color: #ffffff;
    border: none;
}

.today-class-detail {
    background: #685982;
    color: #ffffff;
    border: none;
}

.today-class-status {
    padding: 0.4rem 0.9rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 700;
    background: #f8fafc;
    color: #64748b;
    border: none;
    width: 140px;
    text-align: center;
}

.today-class-status.absent {
    background: #f0f0f5;
    color: #111827;
    border: none;
}

.today-class-status.completed {
    background: #dcfce7;
    color: #166534;
    border-color: #bbf7d0;
}

.today-class-action:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    box-shadow: none;
}

/* ===== Enhanced Chat Section Styles ===== */
.chat-container {
    display: flex;
    height: calc(100vh - 150px);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    overflow: hidden;
}

.chat-list {
    width: 300px;
    border-right: 1px solid var(--border);
    overflow-y: auto;
    background: var(--bg-card);
}

.chat-list-header {
    padding: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-dark);
    border-bottom: 1px solid var(--border);
}

.chat-list-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: all var(--transition-fast);
    background: var(--bg-card);
}

.chat-list-item:hover {
    background: var(--bg-dark);
}

.chat-list-item.active {
    background: linear-gradient(135deg, var(--primary), #8b5cf6) !important;
    color: white !important;
}

.chat-list-item.active * {
    color: white !important;
}

.chat-list-item.active [data-chat-icon="true"] i {
    color: #111827 !important;
}

.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
}

.chat-messages {
    flex: 1;
    padding: var(--spacing-lg);
    overflow-y: auto;
    background: var(--bg-card);
}

.chat-messages-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-secondary);
    text-align: center;
}

.chat-messages-empty i {
    font-size: 3rem;
    opacity: 0.5;
    margin-bottom: 1rem;
    color: var(--text-muted);
}

.chat-input-area {
    display: flex;
    gap: var(--spacing-md);
    padding: var(--spacing-md);
    border-top: 1px solid var(--border);
    background: var(--bg-dark);
}

.chat-input {
    flex: 1;
    padding: var(--spacing-md);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.95rem;
}

.chat-input:focus {
    outline: none;
    border-color: var(--primary);
}

/* Chat Bubbles */
.chat-bubble {
    max-width: 70%;
    padding: 0.75rem 1rem;
    margin-bottom: 0.75rem;
    border-radius: 1rem;
}

.chat-bubble.sent {
    margin-left: auto;
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    color: white;
    border-bottom-right-radius: 0.25rem;
}

.chat-bubble.received {
    margin-right: auto;
    background: var(--bg-dark);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-bottom-left-radius: 0.25rem;
}

/* ===== Order Cards ===== */
.order-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    overflow: hidden;
    margin-bottom: var(--spacing-md);
}

.order-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--bg-dark);
    border-bottom: 1px solid var(--border);
}

.order-card-body {
    padding: var(--spacing-lg);
}

/* ===== AI App Cards ===== */
.app-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--spacing-lg);
}

.app-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: var(--spacing-lg);
    text-align: center;
    transition: all var(--transition-fast);
}

.app-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
}

.app-card-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto var(--spacing-md);
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: white;
}

.app-card-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
}

.app-card-desc {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ===== Profile Section ===== */
.profile-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-xl);
    margin-bottom: var(--spacing-xl);
}

.profile-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: white;
}

.profile-info h2 {
    margin-bottom: var(--spacing-sm);
}

.profile-info p {
    color: var(--text-secondary);
}

/* ===== Utility Classes ===== */
.text-muted {
    color: var(--text-muted);
}

.text-success {
    color: var(--success);
}

.text-danger {
    color: var(--danger);
}

.text-warning {
    color: var(--warning);
}

.text-primary {
    color: var(--primary);
}

.mt-1 {
    margin-top: var(--spacing-sm);
}

.mt-2 {
    margin-top: var(--spacing-md);
}

.mt-3 {
    margin-top: var(--spacing-lg);
}

.mb-1 {
    margin-bottom: var(--spacing-sm);
}

.mb-2 {
    margin-bottom: var(--spacing-md);
}

.mb-3 {
    margin-bottom: var(--spacing-lg);
}

.d-flex {
    display: flex;
}

.flex-wrap {
    flex-wrap: wrap;
}

.gap-1 {
    gap: var(--spacing-sm);
}

.gap-2 {
    gap: var(--spacing-md);
}

.gap-3 {
    gap: var(--spacing-lg);
}

.justify-between {
    justify-content: space-between;
}

.justify-center {
    justify-content: center;
}

.align-center {
    align-items: center;
}

.hidden {
    display: none !important;
}

/* ===== Responsive Design ===== */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform var(--transition-normal);
        background: #ffffff;
        box-shadow: 12px 0 24px rgba(15, 23, 42, 0.12);
        z-index: 2500;
        top: 0;
        bottom: 0;
        padding-top: calc(var(--header-height, 70px) + 10px);
    }

    .sidebar::before {
        box-shadow: none;
    }

    .sidebar-overlay {
        display: block;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .mobile-menu-btn {
        display: block !important;
    }

    .calendar-day .class-item {
        flex-wrap: nowrap;
        overflow: hidden;
    }

    .calendar-day .class-status-row {
        display: flex;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 60px;
    }
}

@media (max-width: 768px) {
    .nav-links {
        gap: 0.4rem;
    }

    .nav-link {
        padding: 0.35rem 0.5rem;
        font-size: 0.9rem;
    }

    .mobile-menu-btn {
        width: 48px;
        height: 48px;
        font-size: 1.4rem;
    }

    .header-menu-ai,
    .header-menu-uid,
    .header-menu-sep-order,
    .header-menu-sep-ai {
        display: none;
    }

    .nav-center {
        display: none;
    }

    .top-gift-banner {
        margin-top: 0;
        padding: 0;
    }

    .top-gift-banner-icon {
        display: none;
    }

    .top-gift-banner-title {
        font-size: 0.9rem;
    }

    .top-gift-banner-detail {
        font-size: 0.86rem;
    }

    .order-coupon-item {
        padding: 0.62rem 0.72rem;
    }

    .order-coupon-main {
        font-size: 0.84rem;
    }

    .order-coupon-benefit-key {
        font-size: 0.96rem;
    }

    .order-coupon-benefit-tail {
        font-size: 0.86rem;
    }

    .order-coupon-meta {
        font-size: 0.76rem;
    }

    .order-price-meta {
        font-size: 0.86em;
    }

    .container {
        padding: 0;
    }

    .main-content {
        padding: 0;
    }

    .profile-header {
        flex-direction: column;
        text-align: center;
    }

    .chat-container {
        flex-direction: column;
        height: auto;
    }

    .chat-list {
        width: 100%;
        max-height: 200px;
    }

    .app-grid {
        grid-template-columns: 1fr;
    }

    .class-card-info {
        flex-direction: column;
        gap: var(--spacing-sm);
    }

    .calendar-card {
        padding: 0;
        margin-top: 10px;
        margin-bottom: 0;
        border-radius: 0;
        width: 100%;
        border-left: 0;
        border-right: 0;
        box-shadow: none;
    }

    .calendar-card .card-header {
        padding: 0.75rem 0.75rem 0.5rem 0.75rem;
        margin-bottom: 0.5rem;
    }

    .calendar-day .class-item {
        flex-wrap: wrap;
    }

    .calendar-day .class-status {
        display: none;
    }

    .calendar-day .class-type-label,
    .calendar-day .class-comment {
        display: none;
    }

    .today-class-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .today-class-actions-bar {
        width: 100%;
        justify-content: flex-start;
    }

    .today-class-join-quick {
        width: 100%;
        text-align: center;
    }

    .today-class-item {
        flex-direction: column;
        align-items: stretch;
    }

    .today-class-avatar {
        width: 72px;
        height: 104px;
        border-radius: 12px;
    }

    .today-class-line {
        grid-template-columns: 110px 1fr;
        column-gap: 0.6rem;
        border-bottom: none;
        align-items: center;
    }

    .today-class-body::before {
        display: none;
    }

    .today-class-value-group {
        border-left: none;
        padding-left: 0;
    }

    .today-class-action {
        width: 100%;
        text-align: center;
    }

    .today-class-actions {
        width: 100%;
        align-items: stretch;
    }

    .calendar-nav-row {
        flex-direction: column;
        align-items: flex-start;
    }

    .calendar-nav-box,
    .calendar-status-legend {
        width: 100%;
        justify-content: flex-start;
    }

    .calendar-status-legend {
        display: flex;
    }

    .calendar {
        padding: 0;
        border-radius: 0;
        width: 100%;
    }

    .calendar-grid {
        gap: 2px;
    }

    .calendar-weekday {
        padding: 0.4rem 0;
        font-size: 0.8rem;
        border-radius: 6px;
        border: none;
        background: var(--calendar-weekday-bg);
        color: #ffffff;
    }

    .textbook-change-selects {
        flex-direction: column;
    }

    .textbook-change-chapter {
        flex-direction: column;
    }

    .textbook-change-preview {
        width: 100%;
        justify-content: center;
    }

    .textbook-change-info-inner {
        flex-direction: column;
    }

    .textbook-change-image {
        width: 128px;
        height: 180px;
        margin: 0 auto;
    }

    .calendar-day {
        min-height: 100px;
        padding: 0.45rem;
        border-radius: 8px;
        border: none;
        background: var(--calendar-nav-bg);
        overflow: hidden;
    }

    .calendar-day.today {
        border: none;
        box-shadow: inset 0 0 0 2px #488cef;
    }

    .calendar-day .day-number {
        top: 6px;
        left: 6px;
        font-size: 0.72rem;
    }

    .calendar-day .class-items {
        padding-top: 34px;
        margin-top: 8px;
    }

    .calendar-day .class-item {
        padding: 0.2rem 0.28rem;
        border-radius: 8px;
        font-size: 0.6rem;
        box-shadow: none;
        gap: 0.3rem;
    }

    .calendar-day .class-time {
        font-size: 0.6rem;
        white-space: nowrap;
    }

    .orders-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.6rem;
        border-bottom: none;
        padding-bottom: 0;
    }

    .ai-apps-card .card-header {
        border-bottom: none;
        padding-bottom: 0;
    }

    .orders-header .btn {
        width: 100%;
        justify-content: center;
    }

    .orders-table {
        display: block;
        width: 100%;
        border: 0;
    }

    .orders-table thead {
        display: none;
    }

    .orders-table tbody {
        display: block;
        width: 100%;
    }

    .orders-table tr {
        display: block;
        background: transparent;
        border: 0;
        border-radius: 0;
        padding: 0;
        margin-bottom: 1.4rem;
        box-shadow: none;
    }

    .orders-table td[data-label="영수증"] {
        display: none;
    }

    .orders-table td {
        --label-col: 50%;
        position: relative;
        display: flex;
        align-items: center;
        padding: 0.7rem 0.75rem 0.7rem calc(var(--label-col) + 0.75rem);
        border-bottom: 1px solid #e5e7eb;
        text-align: left;
        font-size: 0.9rem;
        white-space: nowrap;
    }

    .orders-table td::before {
        content: attr(data-label);
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        width: var(--label-col);
        display: flex;
        align-items: center;
        padding-left: 0.75rem;
        padding-right: 0.6rem;
        font-size: 0.9rem;
        font-weight: 700;
        color: #64748b;
        background: #f8f6f6;
        white-space: nowrap;
        text-transform: none;
    }

    .orders-table td::after {
        content: '';
        position: absolute;
        left: var(--label-col);
        top: 0;
        bottom: 0;
        width: 1px;
        background: #e5e7eb;
    }

    .orders-table td[data-label="영수증"] {
        padding: 0.85rem 0.75rem;
        justify-content: center;
        text-align: center;
    }

    .orders-table td[data-label="영수증"]::before,
    .orders-table td[data-label="영수증"]::after {
        content: none;
    }

    .ai-apps-table {
        display: block;
        width: 100%;
        border: 0;
    }

    .ai-apps-table thead {
        display: none;
    }

    .ai-apps-table tbody {
        display: block;
        width: 100%;
    }

    .ai-apps-table tr {
        display: block;
        background: transparent;
        border: 0;
        border-radius: 0;
        padding: 0;
        margin-bottom: 1.4rem;
        box-shadow: none;
    }

    .ai-apps-table td {
        --label-col: 50%;
        position: relative;
        display: flex;
        align-items: center;
        padding: 0.7rem 0.75rem 0.7rem calc(var(--label-col) + 0.75rem);
        border-bottom: 1px solid #e5e7eb;
        text-align: left;
        font-size: 0.9rem;
        white-space: nowrap;
    }

    .ai-apps-table td::before {
        content: attr(data-label);
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        width: var(--label-col);
        display: flex;
        align-items: center;
        padding-left: 0.75rem;
        padding-right: 0.6rem;
        font-size: 0.9rem;
        font-weight: 700;
        color: #64748b;
        background: #f8f6f6;
        white-space: nowrap;
        text-transform: none;
    }

    .ai-apps-table td::after {
        content: '';
        position: absolute;
        left: var(--label-col);
        top: 0;
        bottom: 0;
        width: 1px;
        background: #e5e7eb;
    }

    .ai-apps-table td[data-label="QR"] {
        padding: 0.85rem 0.75rem;
        justify-content: center;
        text-align: center;
    }

    .ai-apps-table td[data-label="QR"]::before,
    .ai-apps-table td[data-label="QR"]::after {
        content: none;
    }

    .orders-table .badge {
        font-size: 0.72rem;
        padding: 0.2rem 0.55rem;
    }

    .orders-table .btn {
        padding: 0.35rem 0.7rem;
        font-size: 0.8rem;
    }

    .chat-list-panel {
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        max-width: 80vw;
        transform: translateX(-105%);
        z-index: 20;
        box-shadow: 12px 0 30px rgba(15, 23, 42, 0.18);
    }

    .chat-list-panel.active {
        transform: translateX(0);
    }

    .chat-list-overlay {
        display: block;
        position: absolute;
        inset: 0;
        background: rgba(15, 23, 42, 0.35);
        opacity: 0;
        pointer-events: none;
        transition: opacity var(--transition-fast);
        z-index: 15;
    }

    .chat-list-overlay.active {
        opacity: 1;
        pointer-events: auto;
    }

    .chat-toggle-desktop {
        display: none;
    }

    .chat-toggle-mobile {
        display: inline-block;
    }

    .chat-page-card {
        height: calc(100vh - 80px);
        margin-bottom: 0;
    }

    .ai-apps-table-container {
        margin: 0;
    }

    .calendar-day .class-status,
    .calendar-day .class-type-label,
    .calendar-day .class-comment {
        display: none;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0;
    }

    .main-content {
        padding: 0;
    }

    .card {
        padding: var(--spacing-md);
    }

    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.25rem;
    }

    h3 {
        font-size: 1.1rem;
    }

    .calendar-card .card-header {
        padding: 0.6rem 0.6rem 0.4rem 0.6rem;
    }

    .ai-apps-table-container {
        margin: 0;
    }
}

/* ===== Class History Card Redesign ===== */
.class-history-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.class-history-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 1rem 1.25rem;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.class-history-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.class-history-card.active {
    border: 1px solid var(--border);
    background: var(--bg-card);
}

.class-history-card.active::before {
    content: attr(data-index);
    position: absolute;
    top: 0;
    left: 0;
    width: 60px;
    height: 100%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 700;
    font-style: italic;
    color: white;
    border-radius: 20px 0 0 20px;
}

.class-history-card.active > * {
    margin-left: 60px;
}

.class-history-card.with-index::before {
    content: attr(data-index);
    position: absolute;
    top: 0;
    left: 0;
    width: 60px;
    height: 100%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    font-weight: 700;
    font-style: italic;
    color: white;
    border-radius: 20px 0 0 20px;
}

.class-history-card.with-index > * {
    margin-left: 60px;
}

.class-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.class-history-badges {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.class-type-badge {
    padding: 0.35rem 0.8rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.class-lang-badge {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.class-duration-badge {
    font-size: 0.85rem;
    color: var(--text-secondary);
    background: var(--bg-darker);
    padding: 0.2rem 0.6rem;
    border-radius: 8px;
    font-weight: 500;
}

.class-status-badge {
    padding: 0.4rem 1rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 700;
    border: 1px solid transparent;
}

.class-history-info {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.8rem;
    flex-wrap: wrap;
}

.class-info-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-weight: 500;
}

.class-history-stats {
    display: grid;
    gap: 0.5rem;
}

.stat-item {
    background: var(--bg-darker);
    border-radius: 10px;
    padding: 0.5rem 0.4rem;
    text-align: center;
    transition: background 0.2s;
    border: 1px solid transparent;
}

.stat-item:hover {
    background: #f1f5f9;
    border-color: var(--border);
}

.stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 0.2rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.stat-value {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
}

/* Action Button for Active Classes */
.class-action-btn {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: white;
    border: none;
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.2);
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.class-action-group {
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.6);
    padding: 0.2rem;
    border-radius: 10px;
}

.leveltest-action-btn {
    background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
    color: #111827;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.25);
}

.class-action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
}

.class-action-btn:active {
    transform: translateY(0);
}

/* Pagination Redesign */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
}

.pagination-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    transition: all var(--transition-fast);
    cursor: pointer;
    font-size: 1rem;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--bg-dark);
    color: var(--text-muted);
}

.pagination-info {
    font-weight: 700;
    color: var(--text-secondary);
    font-size: 1rem;
    font-feature-settings: "tnum";
    font-variant-numeric: tabular-nums;
}

@media (max-width: 640px) {
    .class-history-info {
        flex-direction: column;
        gap: 0.75rem;
    }

    .class-history-stats {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .class-history-header {
        align-items: flex-start;
    }

    .class-status-badge {
        margin-left: auto;
    }
}

/* ===== Floating Chat Button & Popup ===== */

/* Floating Button Container */
.floating-chat-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9998;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

/* Floating Button */
.floating-chat-btn {
    position: relative;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.floating-chat-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: #6366f1;
    white-space: nowrap;
    text-shadow: 0 1px 3px rgba(255, 255, 255, 0.9);
}

.floating-chat-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(99, 102, 241, 0.5);
}

.floating-chat-btn:active {
    transform: scale(0.95);
}

.floating-chat-btn.active {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.4);
}

.floating-chat-btn.active i::before {
    content: "\f00d"; /* fa-xmark */
}

.floating-chat-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 22px;
    height: 22px;
    background: #ef4444;
    color: white;
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    border: 2px solid white;
    opacity: 0;
    transform: scale(0);
    transition: all 0.3s ease;
}

.floating-chat-badge.show {
    opacity: 1;
    transform: scale(1);
}

/* Chat Popup */
.chat-popup {
    position: fixed;
    bottom: 90px;
    right: 16px;
    width: 700px;
    height: 700px;
    min-width: 400px;
    min-height: 500px;
    background: white;
    border-radius: 1rem;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.25);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.8) translateY(20px);
    transform-origin: bottom right;
    transition: opacity 0.3s, visibility 0.3s, transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chat-popup.open {
    opacity: 1;
    visibility: visible;
    transform: scale(1) translateY(0);
}

.chat-popup.dragging {
    transition: none;
    user-select: none;
}

/* Resize Handles */
.chat-popup-resize {
    position: absolute;
    z-index: 10;
}

.chat-popup-resize-n {
    top: 0;
    left: 10px;
    right: 10px;
    height: 6px;
    cursor: n-resize;
}

.chat-popup-resize-s {
    bottom: 0;
    left: 10px;
    right: 10px;
    height: 6px;
    cursor: s-resize;
}

.chat-popup-resize-e {
    right: 0;
    top: 10px;
    bottom: 10px;
    width: 6px;
    cursor: e-resize;
}

.chat-popup-resize-w {
    left: 0;
    top: 10px;
    bottom: 10px;
    width: 6px;
    cursor: w-resize;
}

.chat-popup-resize-ne {
    top: 0;
    right: 0;
    width: 12px;
    height: 12px;
    cursor: ne-resize;
}

.chat-popup-resize-se {
    bottom: 0;
    right: 0;
    width: 12px;
    height: 12px;
    cursor: se-resize;
}

.chat-popup-resize-sw {
    bottom: 0;
    left: 0;
    width: 12px;
    height: 12px;
    cursor: sw-resize;
}

.chat-popup-resize-nw {
    top: 0;
    left: 0;
    width: 12px;
    height: 12px;
    cursor: nw-resize;
}

/* Popup Header - Draggable */
.chat-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    flex-shrink: 0;
    cursor: move;
    user-select: none;
}

.chat-popup-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 1rem;
}

.chat-popup-drag-icon {
    opacity: 0.7;
    font-size: 0.9rem;
}

.chat-popup-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chat-popup-admin-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.85rem;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 0.5rem;
    color: white;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.chat-popup-admin-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.chat-popup-admin-btn.active {
    background: white;
    color: #6366f1;
}

.chat-popup-close {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.chat-popup-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* Chat Layout - Sidebar + Main */
.chat-popup-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar */
.chat-popup-sidebar {
    width: 200px;
    min-width: 160px;
    background: white;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.chat-popup-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.chat-popup-list-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.75rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 0.25rem;
    background: white;
    border: 1px solid transparent;
}

.chat-popup-list-item:hover {
    background: #f8fafc;
    border-color: var(--border);
}

.chat-popup-list-item.active {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    border-color: transparent;
}

.chat-popup-list-item.active .list-item-icon {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.chat-popup-list-item.active .list-item-icon i {
    color: white;
}

.chat-popup-list-item.active .list-item-name,
.chat-popup-list-item.active .list-item-type {
    color: white;
}

.list-item-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.list-item-icon.teacher {
    background: linear-gradient(135deg, #10b981, #059669);
}

.list-item-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.list-item-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.list-item-type {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.list-item-badge {
    min-width: 18px;
    height: 18px;
    background: #ef4444;
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* System Notification Style */
.chat-popup-list-item.system-notification {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(217, 119, 6, 0.05));
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.chat-popup-list-item.system-notification:hover {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(217, 119, 6, 0.1));
    border-color: rgba(245, 158, 11, 0.3);
}

.chat-popup-list-item.system-notification .list-item-type {
    color: #d97706;
}

/* System Notification Active State - same as teacher selection */
.chat-popup-list-item.system-notification.active {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-color: transparent;
}

.chat-popup-list-item.system-notification.active .list-item-name,
.chat-popup-list-item.system-notification.active .list-item-type {
    color: white;
}

.chat-popup-list-item.system-notification.active .list-item-icon {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.chat-popup-list-item.system-notification.active .list-item-icon i {
    color: white;
}

/* AI Footer Button */
.chat-popup-ai-footer {
    padding: 0.5rem;
    border-top: 1px solid var(--border);
    background: white;
    flex-shrink: 0;
}

.chat-popup-ai-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 0.75rem;
    background: linear-gradient(135deg, #10b981, #059669);
    border: none;
    border-radius: 0.5rem;
    color: white;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
}

.chat-popup-ai-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.chat-popup-ai-btn.active {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

/* Main Content */
.chat-popup-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

/* Timezone Info */
.chat-popup-timezone {
    padding: 0.4rem 0.75rem;
    background: #f0f9ff;
    border-bottom: 1px solid #e0f2fe;
    font-size: 0.7rem;
    color: #6366f1;
    text-align: center;
    display: none;
    flex-shrink: 0;
}

.chat-popup-timezone.show {
    display: block;
}

/* Messages Area */
.chat-popup-messages {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
}

.chat-popup-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    text-align: center;
}

.chat-popup-placeholder i {
    font-size: 2.5rem;
    opacity: 0.3;
    margin-bottom: 0.75rem;
}

.chat-popup-placeholder p {
    font-size: 0.85rem;
    margin: 0;
}

/* Input Area */
.chat-popup-input-area {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.75rem;
    background: white;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.chat-popup-attach-btn {
    width: 36px;
    height: 36px;
    border-radius: 0.4rem;
    border: 1px solid var(--border);
    background: white;
    color: var(--text-secondary);
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.chat-popup-attach-btn:hover {
    background: var(--bg-dark);
    color: var(--primary);
}

.chat-popup-input {
    flex: 1;
    height: 36px;
    border-radius: 1rem;
    border: 1px solid var(--border);
    padding: 0 0.85rem;
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s;
}

.chat-popup-input:focus {
    border-color: var(--primary);
}

.chat-popup-send-btn {
    width: 36px;
    height: 36px;
    border-radius: 0.4rem;
    border: none;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    font-size: 0.85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.chat-popup-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* Send Button Wrapper (for translate popup positioning) */
.chat-popup-send-wrapper {
    position: relative;
    display: flex;
    flex-shrink: 0;
}

/* Translate Toggle Popup (floating above send button) */
.chat-popup-translate-popup {
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    background: white;
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 0.5rem;
    z-index: 10;
    animation: translatePopupFadeIn 0.2s ease;
}

.chat-popup-translate-popup::after {
    content: '';
    position: absolute;
    bottom: -6px;
    right: 12px;
    width: 12px;
    height: 12px;
    background: white;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    transform: rotate(45deg);
}

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

.chat-popup-translate-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.75rem;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 0.5rem;
    font-size: 0.8rem;
    color: #6366f1;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.chat-popup-translate-label:hover {
    background: rgba(99, 102, 241, 0.15);
}

.chat-popup-translate-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: #6366f1;
}

.chat-popup-translate-label i {
    font-size: 1rem;
}

/* File Preview */
.chat-popup-file-preview {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    background: #f8fafc;
    border-top: 1px solid var(--border);
    font-size: 0.8rem;
    flex-shrink: 0;
}

.chat-popup-file-preview span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.chat-popup-file-preview button {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.25rem;
}

.chat-popup-file-preview button:hover {
    color: #ef4444;
}

/* Mobile Menu Button (hidden on desktop) */
.chat-popup-mobile-menu-btn {
    display: none;
    width: 32px;
    height: 32px;
    border-radius: 0.4rem;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 0.9rem;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    margin-right: 0.5rem;
}

.chat-popup-mobile-menu-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Mobile Sidebar Overlay */
.chat-popup-sidebar-overlay {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 5;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.chat-popup-sidebar-overlay.active {
    opacity: 1;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .chat-popup {
        width: calc(100vw - 16px);
        height: calc(100vh - 100px);
        bottom: 80px;
        right: 8px;
        left: 8px;
        min-width: auto;
    }

    .chat-popup-sidebar {
        width: 200px;
        min-width: 180px;
    }

    .chat-popup-admin-btn span {
        display: none;
    }

    .chat-popup-ai-btn span {
        display: none;
    }
}

@media (max-width: 600px) {
    /* Full screen chat popup on mobile */
    .chat-popup {
        position: fixed;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        height: 100dvh !important;
        border-radius: 0;
        min-width: auto;
        min-height: auto;
        max-width: none;
        max-height: none;
    }

    /* Show mobile menu button */
    .chat-popup-mobile-menu-btn {
        display: flex;
    }

    /* Hide drag icon on mobile */
    .chat-popup-drag-icon {
        display: none;
    }

    /* Sidebar overlay visible on mobile */
    .chat-popup-sidebar-overlay {
        display: block;
        pointer-events: auto;
    }

    /* Sidebar hidden by default, slide in from left */
    .chat-popup-sidebar {
        position: absolute;
        top: 0;
        left: 0;
        bottom: 0;
        width: 280px;
        max-width: 80vw;
        z-index: 10;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
        border-right: none;
    }

    /* Sidebar open state */
    .chat-popup-sidebar.open {
        transform: translateX(0);
    }

    /* Messages area takes full width */
    .chat-popup-main {
        width: 100%;
        pointer-events: auto;
    }

    /* Adjust header for mobile */
    .chat-popup-header {
        padding: 0.65rem 0.75rem;
        pointer-events: auto;
    }

    .chat-popup-title {
        font-size: 0.95rem;
    }

    /* Smaller admin button on mobile */
    .chat-popup-admin-btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.75rem;
        pointer-events: auto;
    }

    /* Better input area on mobile */
    .chat-popup-input-area {
        padding: 0.5rem;
        gap: 0.35rem;
        pointer-events: auto;
    }

    .chat-popup-input {
        height: 44px;
        font-size: 16px; /* Prevent zoom on iOS */
        pointer-events: auto;
        -webkit-appearance: none;
        appearance: none;
    }

    .chat-popup-attach-btn,
    .chat-popup-send-btn {
        width: 44px;
        height: 44px;
        pointer-events: auto;
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
        touch-action: manipulation;
    }

    /* AI button shows text on mobile sidebar */
    .chat-popup-ai-btn span {
        display: inline;
    }

    /* Ensure all clickable elements work on mobile */
    .chat-popup-close,
    .chat-popup-mobile-menu-btn,
    .chat-popup-list-item,
    .chat-popup-ai-btn {
        pointer-events: auto;
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
        touch-action: manipulation;
    }

    /* Chat popup layout */
    .chat-popup-layout {
        position: relative;
        pointer-events: auto;
    }

    /* Messages area scrollable on mobile */
    .chat-popup-messages {
        -webkit-overflow-scrolling: touch;
        pointer-events: auto;
    }
}

@media (max-width: 480px) {
    .floating-chat-btn {
        width: 56px;
        height: 56px;
        font-size: 1.3rem;
    }

    .floating-chat-container {
        bottom: 20px;
        right: 20px;
    }
}

/* Leveltest Result Modal */
.leveltest-result-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    z-index: 3000;
    display: none;
    align-items: flex-start;
    justify-content: flex-start;
}
.leveltest-result-modal {
    width: 820px;
    max-width: 92vw;
    max-height: 92vh;
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 25px 60px rgba(15, 23, 42, 0.35);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}
.leveltest-result-header {
    padding: 1rem 1.5rem;
    background: linear-gradient(135deg, #0ea5e9, #2563eb);
    color: #ffffff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: move;
}
.leveltest-result-title {
    font-weight: 700;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.leveltest-result-close {
    background: rgba(255,255,255,0.2);
    border: none;
    color: #ffffff;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    font-size: 1.4rem;
    cursor: pointer;
}
.leveltest-result-body {
    padding: 1.2rem 1.5rem 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.4rem;
}
.leveltest-resize-handle {
    position: absolute;
    right: 10px;
    bottom: 10px;
    width: 16px;
    height: 16px;
    cursor: se-resize;
    background: linear-gradient(135deg, transparent 50%, #94a3b8 50%);
    opacity: 0.6;
}
.leveltest-result-loading,
.leveltest-result-error {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #475569;
    font-weight: 600;
    justify-content: center;
    padding: 2rem 0;
}
.leveltest-result-top {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.2rem;
    align-items: stretch;
}
.leveltest-summary-card {
    background: #ffffff;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
    padding: 1.2rem 1.4rem;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 1rem;
}
.leveltest-summary-top {
    font-size: 0.95rem;
    font-weight: 800;
    color: #334155;
    margin-bottom: 50px;
}
.leveltest-summary-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 50px;
}
.leveltest-summary-block {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.leveltest-summary-time-label {
    font-size: 0.9rem;
    font-weight: 800;
    color: #64748b;
}
.leveltest-summary-time {
    font-size: 1.9rem;
    font-weight: 900;
    color: #0f172a;
    letter-spacing: -0.5px;
}
.leveltest-summary-sub {
    font-size: 0.85rem;
    color: #94a3b8;
}
.leveltest-summary-level {
    display: flex;
    align-items: center;
    justify-content: center;
}
.leveltest-level-ring {
    --level: 1;
    width: 130px;
    height: 130px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 0.1rem;
    background:
        conic-gradient(
            rgba(249, 115, 22, 0.95) 0deg calc(var(--level) * 30deg),
            rgba(249, 115, 22, 0.18) 0deg
        );
    position: relative;
    font-weight: 800;
    color: #0f172a;
}
.leveltest-level-ring::before {
    content: '';
    position: absolute;
    inset: 18px;
    background: #ffffff;
    border-radius: 50%;
    box-shadow: inset 0 0 0 1px #e2e8f0;
}
.leveltest-level-label {
    position: relative;
    font-size: 1.25rem;
    font-weight: 800;
}
.leveltest-level-subject {
    position: relative;
    font-size: 0.85rem;
    font-weight: 700;
    color: #475569;
}
.leveltest-radar {
    background: #f8fafc;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.leveltest-score-vertical {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}
.leveltest-score-row {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 1rem;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 0.9rem 1rem;
    align-items: center;
}
.leveltest-score-mini-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 0.35rem;
}
.leveltest-score-mini-bar {
    width: 100%;
    height: 6px;
    background: #e2e8f0;
    border-radius: 999px;
    overflow: hidden;
}
.leveltest-score-mini-fill {
    height: 100%;
    background: linear-gradient(90deg, #38bdf8, #2563eb);
}
.leveltest-score-mini-percent {
    margin-top: 0.35rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: #1d4ed8;
}
.leveltest-score-text {
    font-size: 0.95rem;
    color: #475569;
    line-height: 1.5;
}
.leveltest-ai-block {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.leveltest-ai-section {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.leveltest-ai-section-title {
    font-weight: 800;
    font-size: 0.95rem;
    color: #7c2d12;
}
.leveltest-ai-section-body {
    font-size: 0.95rem;
    color: #7c2d12;
    line-height: 1.6;
}
.leveltest-score-list {
    margin: 0;
    padding-left: 1.1rem;
    color: #7c2d12;
    font-size: 0.95rem;
    line-height: 1.6;
}
.leveltest-correction-card {
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    background: #ffffff;
    overflow: hidden;
    box-shadow: 0 6px 14px rgba(15, 23, 42, 0.06);
    display: flex;
    flex-direction: column;
    gap: 0;
}
.leveltest-correction-head {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    font-size: 0.85rem;
    font-weight: 800;
    color: #334155;
    background: #f1f5f9;
    border-bottom: 1px solid #e5e7eb;
    padding: 0.55rem 0;
}
.leveltest-correction-head > div {
    padding: 0 1rem;
}
.leveltest-correction-head > div:first-child {
    border-right: 1px solid #e5e7eb;
}
.leveltest-correction-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}
.leveltest-correction-col {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.85rem 1rem;
}
.leveltest-correction-col:first-child {
    border-right: 1px solid #e5e7eb;
}
.leveltest-correction-text-large {
    font-size: 1rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.5;
}
.leveltest-diff {
    color: #dc2626;
    font-weight: 800;
    background: rgba(220, 38, 38, 0.08);
    padding: 0 2px;
    border-radius: 3px;
}
.leveltest-correction-meta {
    display: grid;
    gap: 0.35rem;
    font-size: 0.9rem;
    color: #0f172a;
    border-top: 1px solid #e5e7eb;
    background: #f8fafc;
    padding: 0.7rem 1rem;
}
.leveltest-overall {
    background: #0f172a;
    color: #f8fafc;
    border-radius: 16px;
    padding: 1rem 1.2rem;
    border: 1px solid rgba(148, 163, 184, 0.2);
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.2);
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}
.leveltest-overall-icon {
    font-size: 1.8rem;
    color: #fbbf24;
    line-height: 1;
    margin-top: 0.1rem;
}
.leveltest-overall-content {
    flex: 1;
}
.leveltest-overall-title {
    font-size: 1rem;
    font-weight: 800;
    margin-bottom: 0.35rem;
}
.leveltest-overall-body {
    margin: 0;
    font-size: 1rem;
    line-height: 1.7;
    color: #e2e8f0;
}
.leveltest-recommend-group {
    position: relative;
    margin: 1.2rem 0;
    padding: 1.4rem 1.5rem 1.2rem;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
}
.leveltest-recommend-group-title {
    position: absolute;
    top: -0.7rem;
    left: 1.2rem;
    padding: 0 0.6rem;
    background: #f8fafc;
    font-weight: 800;
    color: #0f172a;
    font-size: 0.95rem;
}
.leveltest-recommend-card {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr) auto;
    align-items: flex-start;
    gap: 1.2rem;
    padding: 0.2rem 0;
}
.leveltest-recommend-media img,
.leveltest-recommend-placeholder {
    width: 120px;
    height: 170px;
    border-radius: 12px;
}
.leveltest-recommend-media img {
    object-fit: cover;
}
.leveltest-recommend-placeholder {
    background: #e2e8f0;
    border: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    font-size: 2rem;
}
.leveltest-recommend-media {
    display: flex;
    align-items: center;
    justify-content: center;
}
.leveltest-recommend-info {
    flex: 1;
    min-width: 0;
}
.leveltest-recommend-name {
    font-weight: 800;
    color: #0f172a;
    font-size: 1.1rem;
    margin-bottom: 0.3rem;
}
.leveltest-recommend-chapter {
    font-size: 0.9rem;
    color: #334155;
    margin-bottom: 0.4rem;
    font-weight: 600;
}
.leveltest-recommend-level {
    display: inline-flex;
    align-items: center;
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
    background: #e0f2fe;
    color: #0f172a;
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}
.leveltest-recommend-desc {
    font-size: 0.85rem;
    color: #475569;
    line-height: 1.7;
    word-break: keep-all;
    white-space: normal;
}
.leveltest-recommend-actions {
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
}
.leveltest-recommend-btn {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #ffffff;
    border: none;
    border-radius: 10px;
    padding: 0.6rem 1.1rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 6px 14px rgba(37, 99, 235, 0.25);
}
.leveltest-corrections {
    background: transparent;
    border-radius: 0;
    border: none;
    padding: 0;
}
.leveltest-corrections-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.8rem;
}
.leveltest-view-toggle {
    display: inline-flex;
    background: #e2e8f0;
    border-radius: 999px;
    padding: 0.25rem;
    gap: 0.25rem;
}
.leveltest-view-toggle button {
    border: none;
    background: transparent;
    padding: 0.35rem 0.8rem;
    border-radius: 999px;
    font-size: 0.75rem;
    cursor: pointer;
    color: #475569;
    font-weight: 600;
}
.leveltest-view-toggle button.active {
    background: #ffffff;
    color: #0f172a;
    box-shadow: 0 2px 6px rgba(15,23,42,0.12);
}
.leveltest-correction-list {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}
.leveltest-correction-item {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    width: 100%;
}
.leveltest-correction-question {
    font-weight: 700;
    color: #0f172a;
    font-size: 0.85rem;
}
.leveltest-question-sep {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.75rem;
    font-weight: 700;
    color: #0f172a;
}
.leveltest-question-sep::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e2e8f0;
}
.leveltest-conversation {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}
.leveltest-bubble {
    max-width: 80%;
    padding: 0.7rem 0.9rem;
    border-radius: 16px;
    font-size: 0.95rem;
    line-height: 1.5;
    position: relative;
}
.leveltest-bubble.teacher {
    align-self: flex-start;
    background: #f1f5f9;
    color: #0f172a;
    border-bottom-left-radius: 4px;
}
.leveltest-bubble.student {
    align-self: flex-end;
    background: #e0f2fe;
    color: #0f172a;
    border-bottom-right-radius: 4px;
}
.leveltest-bubble-meta {
    font-size: 0.7rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    color: #64748b;
}
.leveltest-bubble-body {
    white-space: pre-wrap;
}
.leveltest-correction-block {
    margin-top: 0.6rem;
    background: #f8f8f8;
    border: none;
    padding: 0.7rem 0.8rem;
    border-radius: 10px;
    color: #0f172a;
    font-size: 0.95rem;
    line-height: 1.6;
}
.leveltest-correction-text {
    font-size: 0.95rem;
    color: #0f172a;
    line-height: 1.6;
    background: #f8f8f8;
    padding: 0.6rem 0.7rem;
    border-radius: 10px;
}
.leveltest-correction-block .leveltest-ai-section-title,
.leveltest-correction-block .leveltest-ai-section-body,
.leveltest-correction-block .leveltest-score-list,
.leveltest-correction-block .leveltest-correction-text-large,
.leveltest-correction-block .leveltest-correction-meta,
.leveltest-correction-block .leveltest-correction-head {
    color: #0f172a;
}
.leveltest-correction-block .leveltest-correction-card {
    border: 1px solid #e5e7eb;
    background: #ffffff;
    padding: 0;
}
.leveltest-correction-block .leveltest-correction-card + .leveltest-correction-card {
    margin-top: 0.9rem;
}
.leveltest-md-heading {
    font-weight: 800;
    margin-bottom: 0.35rem;
}
.leveltest-md-item,
.leveltest-md-line {
    margin-bottom: 0.3rem;
}
.leveltest-md-item:last-child,
.leveltest-md-line:last-child {
    margin-bottom: 0;
}
.leveltest-muted {
    color: #94a3b8;
}
.leveltest-empty {
    font-size: 0.75rem;
    color: #94a3b8;
    padding: 0.5rem 0;
}

@media (max-width: 900px) {
    .leveltest-result-top {
        grid-template-columns: 1fr;
    }
    .leveltest-summary-top {
        margin-bottom: 1.4rem;
    }
    .leveltest-summary-content {
        gap: 1.4rem;
    }
    .leveltest-recommend-card {
        grid-template-columns: 1fr;
        align-items: flex-start;
    }
    .leveltest-recommend-actions {
        width: 100%;
        justify-content: flex-end;
    }
    .leveltest-summary-content {
        flex-direction: column;
        align-items: flex-start;
    }
    .leveltest-correction-row {
        grid-template-columns: 1fr;
    }
    .leveltest-score-row {
        grid-template-columns: 1fr;
    }
}
