/* ============================================================
   TPU Survey — คณะนวัตกรรมดิจิทัลเทคโนโลยี มหาวิทยาลัยตาปี
   Theme Color System (Blue 900–600 + Yellow/Amber Accent 500–300)
   Reference: https://project.tapee.ac.th/
   ============================================================ */

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

:root {
    /* 🔵 Primary = Navy & Deep Blue (Blue 900–500) */
    --primary-50:  #eff6ff;
    --primary-100: #dbeafe;
    --primary-200: #bfdbfe;
    --primary-300: #93c5fd;
    --primary-400: #60a5fa;
    --primary-500: #3b82f6;
    --primary-600: #2563eb;
    --primary-700: #1d4ed8;
    --primary-800: #1e40af;
    --primary-900: #1e3a8a;

    --primary-color: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: rgba(37, 99, 235, 0.08);
    --primary-dark: #1e3a8a;

    /* 🟡 Accent = Tapee Gold / Amber (Amber 500–300) */
    --accent-50:  #fffbeb;
    --accent-100: #fef3c7;
    --accent-200: #fde68a;
    --accent-300: #fcd34d;
    --accent-400: #fbbf24;
    --accent-500: #f59e0b;
    --accent-600: #d97706;
    --accent-700: #b45309;
    --accent-800: #92400e;
    --accent-900: #78350f;

    --secondary-color: #fbbf24;
    --secondary-dark: #f59e0b;
    --secondary-light: rgba(251, 191, 36, 0.15);

    /* Layout — Light Mode */
    --bg-color: #f8fafc;
    --bg-secondary: #f1f5f9;
    --bg-card: #ffffff;
    --surface-color: #ffffff;

    /* Text */
    --text-main: #1e293b;
    --text-muted: #64748b;
    --text-on-primary: #ffffff;
    --text-secondary: #334155;
    --text-primary: #0f172a;

    /* Layout */
    --sidebar-width: 230px;
    --header-height: 70px;

    /* Borders & Radius */
    --border-color: #e2e8f0;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Semantic Colors */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #6366f1;
    --purple: #8b5cf6;
    --emerald: #059669;

    /* Shadows */
    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.06), 0 1px 2px -1px rgb(0 0 0 / 0.06);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.07), 0 2px 4px -2px rgb(0 0 0 / 0.05);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.08), 0 4px 6px -4px rgb(0 0 0 / 0.05);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.08), 0 8px 10px -6px rgb(0 0 0 / 0.04);

    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Noto Sans Thai', -apple-system, sans-serif;
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #3b82f6; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #2563eb; }

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

body {
    font-family: 'Noto Sans Thai', -apple-system, sans-serif;
    background-color: #f8fafc;
    color: var(--text-main);
    line-height: 1.6;
    font-weight: 500;
    overflow-x: hidden;
    min-height: 100vh;
}

.glass-card {
    background: #ffffff !important;
    border: 1px solid var(--border-color) !important;
    box-shadow: var(--shadow-lg) !important;
    color: #1e293b !important;
}

h1, h2, h3, h4 {
    font-family: 'Noto Sans Thai', sans-serif;
    font-weight: 800;
    line-height: 1.2;
}


/* ============================================================
   Login Page
   ============================================================ */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 50%, #1d4ed8 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 480px;
    padding: 56px;
    border-radius: 24px;
    animation: slideUp 0.6s ease-out;
}

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

.login-logo {
    text-align: center;
    margin-bottom: 48px;
}

.logo-icon {
    font-size: 56px;
    margin-bottom: 20px;
}

/* ============================================================
   Components
   ============================================================ */
.card {
    background: var(--surface-color);
    border-radius: var(--border-radius);
    padding: 32px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    transition: var(--transition);
}

.btn {
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border: none;
    outline: none;
}

.btn-primary {
    background: #2563eb;
    color: #ffffff;
}

.btn-primary:hover {
    background: #1d4ed8;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.3);
}

.btn-warning, .btn-gold {
    background: #fbbf24;
    color: #0f172a;
    font-weight: 700;
}

.btn-warning:hover, .btn-gold:hover {
    background: #f59e0b;
    color: #0f172a;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(245, 158, 11, 0.35);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
}

.btn-ghost:hover {
    background: var(--primary-light);
    color: var(--primary-dark);
}

.btn-block { width: 100%; }
.btn-lg { padding: 16px 32px; font-size: 1.05rem; }

.form-group {
    margin-bottom: 24px;
}

.form-label {
    display: block;
    font-weight: 700;
    margin-bottom: 10px;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.form-input {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-family: inherit;
    transition: var(--transition);
    outline: none;
    background: #FFFFFF;
}

input:focus, select:focus, textarea:focus, .form-input:focus {
    outline: none !important;
    border-color: #fbbf24 !important;
    box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.3) !important;
}
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-md);
}

/* ============================================================
   Dashboard Layout
   ============================================================ */
.dashboard {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, #1e3a8a 0%, #1e40af 100%);
    border-right: none;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: transform 0.3s ease;
}

.sidebar-header {
    padding: 20px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.15);
}

.sidebar-header h2 {
    font-size: 0.95rem;
    color: #FFFFFF;
    letter-spacing: -0.02em;
}

.sidebar-header span {
    color: rgba(255,255,255,0.7) !important;
}

.sidebar-header small {
    color: rgba(255,255,255,0.7);
    display: block;
    font-size: 11px;
}

.sidebar-logo-img {
    height: 32px;
    width: auto;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 8px;
    overflow-y: auto;
}

.nav-section-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255,255,255,0.5);
    padding: 8px 10px 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: rgba(255,255,255,0.75);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 3px;
}

.nav-item:hover {
    background: rgba(255,255,255,0.12);
    color: var(--accent-300);
}

.nav-item.active {
    background: rgba(255,255,255,0.18);
    color: #ffffff;
    font-weight: 700;
    border-left: 3px solid var(--accent-400);
    padding-left: 10px;
}

.nav-item .nav-icon {
    font-size: 16px;
    width: 20px;
    text-align: center;
}

.nav-item .nav-badge {
    margin-left: auto;
    background: var(--primary-500);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: var(--radius-full);
}

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid rgba(255,255,255,0.15);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px;
    border-radius: var(--radius-sm);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent-500);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-weight: 700;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.user-info .user-detail h4 {
    font-size: 13px;
    font-weight: 700;
    color: #FFFFFF;
}

.user-info .user-detail span {
    font-size: 12px;
    color: rgba(255,255,255,0.6);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    max-width: calc(100vw - var(--sidebar-width));
    overflow-x: hidden;
}

.main-header {
    height: var(--header-height);
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.main-header h1 {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary-dark);
}

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

.main-body {
    padding: 24px;
    max-width: 100%;
    box-sizing: border-box;
}

/* ============================================================
   Welcome Portal
   ============================================================ */
.welcome-banner {
    background: linear-gradient(135deg, var(--primary-light) 0%, #FFFFFF 100%);
    padding: 40px;
    border-radius: var(--radius-xl);
    margin-bottom: 32px;
    border: 1px solid var(--border-color);
}

.welcome-banner h1 {
    font-size: 2.2rem;
    color: var(--primary-dark);
    margin-bottom: 12px;
}

.welcome-banner p {
    font-size: 1.1rem;
    color: var(--text-muted);
}

.portal-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.portal-card {
    background: var(--bg-card);
    padding: 40px;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-color);
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-normal);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

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

.portal-icon {
    font-size: 48px;
    width: 80px;
    height: 80px;
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
    transition: var(--transition-normal);
}

.portal-card:hover .portal-icon {
    background: var(--primary-light);
    transform: scale(1.1);
}

.portal-card h3 {
    font-size: 1.5rem;
    color: var(--text-main);
}

.portal-card p {
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1.5;
}

.portal-btn {
    margin-top: auto;
    color: var(--primary-dark);
    font-weight: 700;
    font-size: 1.1rem;
}

/* ============================================================
   Cards
   ============================================================ */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h3 {
    font-size: 20px;
    font-weight: 800;
}

.card-body {
    padding: 24px;
}

.card-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

/* Stat Cards */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-color);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

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

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.stat-icon.purple { background: var(--primary-light); color: var(--primary-dark); }
.stat-icon.yellow { background: var(--primary-light); color: var(--primary-dark); }
.stat-icon.teal { background: rgba(20, 184, 166, 0.1); color: #008080; }
.stat-icon.green { background: rgba(34, 197, 94, 0.1); color: var(--success); }
.stat-icon.orange { background: rgba(245, 158, 11, 0.1); color: #E67E22; }

.stat-content h4 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.stat-content .stat-value {
    font-size: 32px;
    font-weight: 800;
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    line-height: 1;
}

.stat-content .stat-change {
    font-size: 12px;
    margin-top: 6px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.stat-change.up { color: var(--success-500); }
.stat-change.down { color: var(--danger-500); }

/* ============================================================
   Tables
   ============================================================ */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-md);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
}

thead {
    background: #f8fafc;
}

th {
    padding: 10px 14px;
    text-align: left;
    font-weight: 800;
    color: var(--text-secondary);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    vertical-align: middle;
}

tbody tr {
    transition: background var(--transition-fast);
}

tbody tr:hover {
    background: var(--primary-light);
}

/* ActivityTapee Advisor Dashboard Styles (activity.tapee.ac.th) */
.card-tapi {
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}

.btn-yellow {
    background-color: #facc15;
    border: 1px solid #000000;
    color: #000000;
    font-weight: bold;
}

.btn-yellow:hover {
    background-color: #eab308;
}

.action-btn-compact {
    padding: 4px 8px;
    font-size: 12px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #f1f5f9;
    color: #1e293b;
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
    cursor: pointer;
}

.action-btn-compact:hover {
    background: #2563eb;
    color: #ffffff;
    border-color: #2563eb;
}

/* ============================================================
   Badges / Tags
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
}

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

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

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

.badge-admin {
    background: var(--primary-light);
    color: var(--primary-dark);
}

.badge-teacher {
    background: rgba(234,179,8,0.1);
    color: var(--accent-600);
}

/* ============================================================
   Modal
   ============================================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.active {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    animation: modalSlide 0.3s ease;
}

.modal-lg { max-width: 800px; }
.modal-xl { max-width: 1000px; }

@keyframes modalSlide {
    from { opacity: 0; transform: translateY(-20px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 700;
}

.modal-close {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--gray-100);
    border-radius: var(--radius-full);
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--danger-500);
    color: white;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* ============================================================
   Toast / Notifications
   ============================================================ */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 14px 20px;
    box-shadow: var(--shadow-xl);
    border-left: 4px solid var(--primary-500);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    max-width: 450px;
    animation: toastIn 0.3s ease;
    font-size: 14px;
}

.toast.success { border-left-color: var(--success-500); }
.toast.error { border-left-color: var(--danger-500); }
.toast.warning { border-left-color: var(--warning-500); }

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

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

/* ============================================================
   Survey Response Page
   ============================================================ */
.survey-page {
    min-height: 100vh;
    background: linear-gradient(180deg, #eff6ff 0%, #f9fafb 30%);
    padding: 40px 20px;
    color: #000000;
}

.survey-container {
    max-width: 720px;
    margin: 0 auto;
}

.survey-header {
    text-align: center;
    margin-bottom: 40px;
    animation: slideUp 0.6s ease;
}

.survey-header h1 {
    font-size: 28px;
    font-weight: 800;
    color: #000000;
    margin-bottom: 8px;
}

.survey-header p {
    color: #000000;
    font-size: 16px;
}

.survey-section {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-color);
    overflow: hidden;
    margin-bottom: 24px;
    animation: slideUp 0.6s ease;
}

.survey-section-header {
    padding: 24px;
    background: var(--primary-light);
    border-bottom: 1px solid var(--border-color);
}

.survey-section-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #000000;
}

.survey-section-header p {
    font-size: 14px;
    color: #000000;
    margin-top: 4px;
}

.survey-question {
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.survey-question:last-child {
    border-bottom: none;
}

.survey-question .q-label {
    font-size: 15px;
    font-weight: 600;
    color: #000000;
    margin-bottom: 14px;
    display: flex;
    gap: 6px;
}

.survey-question .q-label .required {
    color: #ef4444;
}

.survey-question .q-number {
    color: #000000;
    font-weight: 700;
}

/* Rating Scale (1-5) */
.rating-scale {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.rating-scale label {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: var(--transition);
    min-width: 70px;
    text-align: center;
    color: #1e293b;
}

.rating-scale label:hover {
    border-color: var(--primary-color);
    background: var(--primary-light);
}

.rating-scale input[type="radio"] {
    display: none;
}

.rating-scale input[type="radio"]:checked + .rating-number {
    background: var(--primary-color);
    color: #fff;
}

.rating-scale input[type="radio"]:checked ~ .rating-label {
    color: var(--primary-color);
    font-weight: 700;
}

.rating-number {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 16px;
    color: #000000;
    transition: var(--transition);
}

.rating-label {
    font-size: 12px;
    color: #000000;
    font-weight: 500;
}

/* Radio Options */
.radio-option {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    color: #000000;
    font-size: 15px;
}

.radio-option input[type="radio"] {
    accent-color: var(--primary-color);
    width: 18px;
    height: 18px;
}

/* Checkbox Options */
.form-checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.checkbox-option {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    color: #1e293b;
    font-size: 15px;
}

.checkbox-option input[type="checkbox"] {
    accent-color: var(--primary-color);
    width: 18px;
    height: 18px;
}

/* ============================================================
   Survey Builder (Question Editor)
   ============================================================ */
.question-builder {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 24px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-fast);
    position: relative;
}

.question-builder:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-md);
}

.question-builder .qb-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--bg-secondary);
}

.question-builder .qb-handle {
    cursor: grab;
    color: var(--text-muted);
    font-size: 18px;
}

.question-builder .q-number-label {
    font-weight: 700;
    color: var(--primary-dark);
}

.question-builder .qb-actions {
    margin-left: auto;
    display: flex;
    gap: 8px;
}

/* ============================================================
   Loading & Empty States
   ============================================================ */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px;
    gap: 16px;
    color: #475569;
}

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

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

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

/* ============================================================
   Tooltip & Copy Link
   ============================================================ */
.link-display {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--input-bg);
    padding: 10px 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    font-family: monospace;
    font-size: 13px;
    word-break: break-all;
}

.link-display .copy-btn {
    flex-shrink: 0;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: var(--border-radius-sm);
    background: var(--primary-color);
    color: var(--text-on-primary);
    border: none;
    font-size: 12px;
    font-weight: 600;
    transition: var(--transition);
}

.link-display .copy-btn:hover {
    background: var(--primary-hover);
}

/* ============================================================
   QR Code Section (in Link Modal)
   ============================================================ */
.qr-link-container {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.qr-link-section {
    width: 100%;
}

.qr-link-label {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.qr-code-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px 24px;
    background: linear-gradient(135deg, var(--primary-light) 0%, rgba(255,215,0,0.05) 100%);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-color);
}



.qr-code-wrapper {
    padding: 16px;
    background: #ffffff;
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1), 0 2px 8px rgba(0,0,0,0.05);
    position: relative;
    display: inline-block;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.qr-code-wrapper:hover {
    transform: scale(1.03);
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15), 0 4px 12px rgba(0,0,0,0.08);
}

.qr-code-wrapper::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: calc(var(--radius-lg) + 3px);
    background: linear-gradient(135deg, var(--primary-color), #f59e0b, var(--primary-color));
    z-index: -1;
    opacity: 0.6;
}

.qr-code-wrapper canvas {
    display: block;
    border-radius: 8px;
}

.qr-survey-title {
    margin-top: 16px;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-main);
    text-align: center;
    max-width: 320px;
    line-height: 1.4;
}

.qr-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.qr-actions .btn {
    font-size: 13px;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-weight: 700;
}

.qr-actions .btn-primary {
    background: linear-gradient(135deg, var(--primary-color), #f0c040);
    box-shadow: 0 4px 12px rgba(254, 215, 0, 0.3);
}

.qr-actions .btn-primary:hover {
    box-shadow: 0 6px 20px rgba(254, 215, 0, 0.5);
    transform: translateY(-2px);
}

.qr-actions .btn-secondary {
    background: var(--bg-card);
    color: var(--text-main);
    border: 2px solid var(--border-color);
}

.qr-actions .btn-secondary:hover {
    border-color: var(--primary-color);
    background: var(--primary-light);
}

/* ============================================================
   Tabs
   ============================================================ */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 24px;
    gap: 4px;
}

.tab {
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all var(--transition-fast);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.tab:hover {
    color: var(--primary-dark);
    background: var(--primary-light);
}

.tab.active {
    color: var(--text-main);
    border-bottom-color: var(--primary-color);
}

/* ============================================================
   Progress Bar
   ============================================================ */
.progress-bar {
    height: 10px;
    background: #EEEEEE;
    border-radius: 20px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary-color);
    border-radius: 20px;
    transition: width 1s ease;
}

/* ============================================================
   Statistics / Charts
   ============================================================ */
.chart-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
}

.chart-bar .bar-label {
    min-width: 100px;
    font-size: 0.9rem;
    text-align: right;
    color: var(--text-muted);
}

.chart-bar .bar-track {
    flex: 1;
    height: 32px;
    background: #F1F1F1;
    border-radius: var(--border-radius-sm);
    overflow: hidden;
    position: relative;
}

.chart-bar .bar-fill {
    height: 100%;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    padding: 0 12px;
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--text-on-primary);
    transition: width 1s ease;
}

.chart-bar .bar-value {
    min-width: 60px;
    font-size: 0.9rem;
    font-weight: 700;
}

/* ============================================================
   Success Page
   ============================================================ */
.success-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: #FFFFFF;
    padding: 40px;
}

.success-icon {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 32px;
    font-size: 48px;
    color: var(--text-on-primary);
    box-shadow: 0 10px 30px rgba(254, 192, 1, 0.4);
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .main-header { padding: 0 16px; }
    .main-body { padding: 24px 16px; }
    .login-card { padding: 40px 24px; }
}

/* ============================================================
   Utility Classes
   ============================================================ */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 0.9rem; }
.text-primary { color: var(--primary-dark); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.fw-700 { font-weight: 700; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mb-16 { margin-bottom: 16px; }
.d-flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }

/* Sidebar overlay for mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 99;
}

.sidebar-overlay.active {
    display: block;
}
.password-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-wrapper .form-input {
    padding-right: 48px;
}

.toggle-password {
    position: absolute;
    right: 14px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 18px;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color var(--transition-fast);
}

.toggle-password:hover {
    color: var(--primary-500);
}

.label-lg {
    font-size: 16px;
    margin-bottom: 10px;
}

/* ============================================================
   Admin Dashboard Redesign — Enhanced Stat Cards
   ============================================================ */
.stat-grid-enhanced {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card-enhanced {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-color);
    padding: 28px 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.stat-card-enhanced::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

.stat-card-enhanced.purple::before { background: linear-gradient(90deg, #8B5CF6, #A78BFA); }
.stat-card-enhanced.teal::before { background: linear-gradient(90deg, #14B8A6, #5EEAD4); }
.stat-card-enhanced.green::before { background: linear-gradient(90deg, #22C55E, #86EFAC); }
.stat-card-enhanced.orange::before { background: linear-gradient(90deg, #F59E0B, #FCD34D); }

.stat-card-enhanced:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary-color);
}

.stat-icon-enhanced {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.stat-card-enhanced:hover .stat-icon-enhanced {
    transform: scale(1.15) rotate(5deg);
}

.stat-icon-enhanced.purple { background: linear-gradient(135deg, #EDE9FE, #DDD6FE); color: #7C3AED; }
.stat-icon-enhanced.teal { background: linear-gradient(135deg, #CCFBF1, #99F6E4); color: #0D9488; }
.stat-icon-enhanced.green { background: linear-gradient(135deg, #DCFCE7, #BBF7D0); color: #16A34A; }
.stat-icon-enhanced.orange { background: linear-gradient(135deg, #FEF3C7, #FDE68A); color: #D97706; }



.stat-content-enhanced h4 {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-content-enhanced .stat-value {
    font-size: 34px;
    font-weight: 800;
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    line-height: 1;
}

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

/* ============================================================
   Dashboard Layout — Two Column
   ============================================================ */
.dashboard-grid-2col {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 24px;
    margin-bottom: 32px;
}

@media (max-width: 900px) {
    .dashboard-grid-2col {
        grid-template-columns: 1fr;
    }
}

/* ============================================================
   Status Chart
   ============================================================ */
.status-chart-container {
    padding: 8px 0;
}

.status-chart-row {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
}

.status-chart-row:last-child {
    margin-bottom: 0;
}

.status-chart-label {
    min-width: 80px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    text-align: right;
}

.status-chart-bar-track {
    flex: 1;
    height: 28px;
    background: var(--bg-secondary);
    border-radius: var(--radius-full);
    overflow: hidden;
    position: relative;
}

.status-chart-bar-fill {
    height: 100%;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    padding: 0 14px;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    min-width: fit-content;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.status-chart-bar-fill.active { background: linear-gradient(90deg, #22C55E, #4ADE80); }
.status-chart-bar-fill.draft { background: linear-gradient(90deg, #F59E0B, #FBBF24); color: #1E293B; }
.status-chart-bar-fill.closed { background: linear-gradient(90deg, #EF4444, #F87171); }

.status-chart-count {
    min-width: 50px;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-main);
}

/* ============================================================
   Activity List
   ============================================================ */
.activity-list {
    list-style: none;
    padding: 0;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s ease;
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    background: var(--bg-secondary);
}

.activity-text {
    flex: 1;
}

.activity-text strong {
    color: var(--text-main);
    font-weight: 600;
}

.activity-text span {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ============================================================
   Section Header Bar (Search + Actions)
   ============================================================ */
.section-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.section-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.section-header-left h2 {
    font-size: 20px;
    font-weight: 800;
    margin: 0;
    white-space: nowrap;
}

.section-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.search-box {
    position: relative;
    min-width: 220px;
}

.search-box input {
    width: 100%;
    padding: 10px 16px 10px 40px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-full);
    font-size: 14px;
    font-family: inherit;
    background: var(--bg-card);
    color: var(--text-main);
    transition: all 0.2s ease;
    outline: none;
}

.search-box input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px var(--primary-light);
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.search-box .search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    color: var(--text-muted);
    pointer-events: none;
}

/* ============================================================
   Filter Tabs
   ============================================================ */
.filter-tabs {
    display: flex;
    gap: 6px;
    border-radius: var(--radius-full);
    background: var(--bg-secondary);
    padding: 4px;
    flex-shrink: 0;
}

.filter-tab {
    padding: 8px 16px;
    border-radius: var(--radius-full);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    background: transparent;
    color: var(--text-muted);
    white-space: nowrap;
}

.filter-tab:hover {
    color: var(--text-main);
    background: var(--bg-card);
}

.filter-tab.active {
    background: var(--primary-color);
    color: var(--text-on-primary);
    box-shadow: var(--shadow-sm);
}

.filter-tab .tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    border-radius: var(--radius-full);
    background: rgba(0,0,0,0.1);
    font-size: 11px;
    font-weight: 700;
    margin-left: 6px;
    padding: 0 6px;
}

.filter-tab.active .tab-count {
    background: rgba(0,0,0,0.15);
}

/* ============================================================
   User Cards Grid
   ============================================================ */
.user-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.user-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-color);
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.user-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--bg-secondary) 100%);
    z-index: 0;
}



.user-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary-color);
}

.user-card-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 800;
    color: #fff;
    margin-bottom: 16px;
    position: relative;
    z-index: 1;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    border: 3px solid var(--bg-card);
}

.user-card-avatar.admin { background: linear-gradient(135deg, #8B5CF6, #6D28D9); }
.user-card-avatar.teacher { background: linear-gradient(135deg, #F59E0B, #D97706); }

.user-card-name {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 6px;
    position: relative;
    z-index: 1;
}

.user-card-code {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 4px;
    position: relative;
    z-index: 1;
}

.user-card-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 14px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 16px;
    position: relative;
    z-index: 1;
}

.user-card-badge.admin {
    background: linear-gradient(135deg, #EDE9FE, #DDD6FE);
    color: #7C3AED;
}

.user-card-badge.teacher {
    background: linear-gradient(135deg, #FEF3C7, #FDE68A);
    color: #92400E;
}



.user-card-actions {
    display: flex;
    gap: 8px;
    width: 100%;
    justify-content: center;
    position: relative;
    z-index: 1;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.user-card-actions .btn {
    padding: 8px 16px;
    font-size: 13px;
    border-radius: var(--radius-sm);
}

/* ============================================================
   Survey Cards Grid
   ============================================================ */
.survey-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.survey-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-color);
    padding: 0;
    display: flex;
    flex-direction: column;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

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

.survey-card-top {
    padding: 24px 24px 0;
    flex: 1;
}

.survey-card-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.survey-card-status.active {
    background: rgba(34, 197, 94, 0.1);
    color: #16A34A;
}

.survey-card-status.draft {
    background: rgba(245, 158, 11, 0.1);
    color: #D97706;
}

.survey-card-status.closed {
    background: rgba(239, 68, 68, 0.1);
    color: #DC2626;
}



.survey-card-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 12px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.survey-card-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-bottom: 20px;
}

.survey-card-meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-muted);
}

.survey-card-meta-item .meta-icon {
    font-size: 14px;
    width: 20px;
    text-align: center;
}

.survey-card-meta-item .meta-value {
    font-weight: 600;
    color: var(--text-main);
}

.survey-card-actions {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    background: var(--bg-secondary);
}

.survey-card-actions .btn {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: var(--radius-sm);
    font-weight: 600;
}

/* ============================================================
   Summary Footer
   ============================================================ */
.summary-footer {
    text-align: center;
    padding: 16px;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 600;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

/* ============================================================
   Animated Counter
   ============================================================ */
@keyframes countUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-count {
    animation: countUp 0.6s ease-out forwards;
}

/* ============================================================
   Empty State Enhanced
   ============================================================ */
.empty-state-enhanced {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state-enhanced .empty-icon {
    font-size: 56px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state-enhanced h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.empty-state-enhanced p {
    font-size: 14px;
    color: var(--text-muted);
    max-width: 300px;
    margin: 0 auto;
}

/* ============================================================
   Gap and Flex utilities
   ============================================================ */
.gap-8 { gap: 8px; }
.gap-16 { gap: 16px; }
.gap-12 { gap: 12px; }
.mb-24 { margin-bottom: 24px; }
.mt-8 { margin-top: 8px; }
.flex-wrap { flex-wrap: wrap; }
.text-xs { font-size: 12px; }
.hidden { display: none !important; }
.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-main);
    border: 1px solid var(--border-color);
}
.btn-secondary:hover {
    background: var(--border-color);
}

/* ============================================================
   Welcome Banner Enhanced
   ============================================================ */
.welcome-banner-enhanced {
    background: linear-gradient(135deg, #1e3a8a 0%, #1d4ed8 60%, #fbbf24 100%);
    border-radius: var(--radius-xl);
    padding: 40px 44px;
    margin-bottom: 32px;
    border: none;
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(30, 58, 138, 0.2);
}

.welcome-banner-enhanced::after {
    content: '';
    position: absolute;
    top: -30px;
    right: -30px;
    width: 200px;
    height: 200px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
}

.welcome-banner-enhanced h1 {
    font-size: 2.2rem;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 8px;
    position: relative;
    z-index: 1;
}

.welcome-banner-enhanced p {
    font-size: 1.05rem;
    color: rgba(255,255,255,0.85);
    font-weight: 500;
    position: relative;
    z-index: 1;
}

.welcome-date {
    font-size: 14px;
    color: var(--accent-300);
    margin-top: 8px;
    font-weight: 600;
    position: relative;
    z-index: 1;
}

/* ============================================================
   Auto-Responsive System for All Devices (Mobile, Tablet, Laptop, Desktop)
   ============================================================ */

/* 1. Fluid Base Typography & Box Model */
html {
    font-size: clamp(14px, 0.95vw + 10px, 16.5px);
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

@media (min-width: 1440px) {
    html { font-size: 17px; }
}

@media (max-width: 1024px) {
    html { font-size: 15px; }
}

@media (max-width: 640px) {
    html { font-size: 14px; }
}

/* 2. Responsive Grid Utilities */
.grid {
    display: grid;
}

.grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.gap-32 { gap: 32px; }

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

@media (max-width: 768px) {
    .grid-2,
    .grid-3,
    .grid-4 {
        grid-template-columns: 1fr !important;
        gap: 16px !important;
    }
}

/* 3. Responsive Profile Layout */
.profile-layout-grid {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 32px;
    align-items: start;
    width: 100%;
}

@media (max-width: 860px) {
    .profile-layout-grid {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }
}

/* 4. Form Controls & Inputs (prevent iOS auto-zoom) */
@media (max-width: 768px) {
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    select,
    textarea,
    .form-input {
        font-size: 16px !important;
    }
}

/* 5. Survey Page & Rating Scale (Auto-fit on all screens) */
.survey-page {
    width: 100%;
    min-height: 100vh;
    padding: clamp(16px, 4vw, 40px) clamp(12px, 3vw, 24px) 80px;
}

.survey-container {
    width: 100%;
    max-width: 860px;
    margin: 0 auto;
}

.rating-scale {
    display: grid !important;
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    gap: 8px !important;
    width: 100% !important;
}

.rating-scale label {
    width: 100% !important;
    min-width: 0 !important;
    padding: 12px 6px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: var(--radius-md) !important;
    border: 2px solid var(--border-color) !important;
    background: #ffffff !important;
    cursor: pointer !important;
    transition: var(--transition) !important;
    user-select: none !important;
    -webkit-tap-highlight-color: transparent !important;
}

.rating-scale label:hover {
    border-color: var(--primary-color) !important;
    background: var(--primary-light) !important;
}

.rating-scale input[type="radio"] {
    position: absolute !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.rating-scale label:has(input[type="radio"]:checked),
.rating-scale label.selected {
    border-color: var(--primary-color) !important;
    background: var(--primary-light) !important;
    box-shadow: 0 0 0 2px var(--primary-color) !important;
}

.rating-number {
    width: 34px !important;
    height: 34px !important;
    border-radius: 50% !important;
    font-size: 15px !important;
    font-weight: 800 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin-bottom: 4px !important;
    background: var(--bg-secondary) !important;
    color: var(--primary-dark) !important;
}

.rating-scale label:has(input[type="radio"]:checked) .rating-number {
    background: var(--primary-color) !important;
    color: #ffffff !important;
}

.rating-label {
    font-size: 11px !important;
    line-height: 1.25 !important;
    text-align: center !important;
    word-break: break-word !important;
    color: var(--text-secondary) !important;
}

@media (max-width: 640px) {
    .survey-page {
        padding: 16px 8px 48px !important;
    }
    .survey-header {
        padding: 16px 8px !important;
        margin-bottom: 20px !important;
    }
    .survey-header h1 {
        font-size: 1.25rem !important;
        line-height: 1.35 !important;
    }
    .survey-header p {
        font-size: 0.85rem !important;
    }
    .survey-section {
        border-radius: 12px !important;
        margin-bottom: 16px !important;
    }
    .survey-section-header {
        padding: 16px 12px !important;
    }
    .survey-section-header h2 {
        font-size: 1.1rem !important;
    }
    .survey-question {
        padding: 14px 10px !important;
    }
    .rating-scale {
        gap: 4px !important;
    }
    .rating-scale label {
        padding: 8px 2px !important;
        border-radius: 8px !important;
    }
    .rating-number {
        width: 28px !important;
        height: 28px !important;
        font-size: 13px !important;
        margin-bottom: 2px !important;
    }
    .rating-label {
        font-size: 9.5px !important;
        line-height: 1.15 !important;
    }
    .radio-option, .checkbox-option {
        padding: 12px 14px !important;
        border: 1px solid var(--border-color) !important;
        border-radius: 10px !important;
        background: #f8fafc !important;
        margin-bottom: 8px !important;
        width: 100% !important;
    }
    .btn-lg {
        width: 100% !important;
        min-width: unset !important;
        padding: 14px 20px !important;
        font-size: 1rem !important;
    }
}

/* 6. Dashboard (Admin & Teacher) Responsiveness */
@media (max-width: 1024px) {
    .stat-grid-enhanced {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 14px !important;
    }
    .dashboard-grid-2col {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 768px) {
    .stat-grid-enhanced {
        grid-template-columns: 1fr 1fr !important;
        gap: 10px !important;
    }
    .stat-card-enhanced {
        padding: 16px 12px !important;
        gap: 12px !important;
    }
    .stat-icon-enhanced {
        width: 44px !important;
        height: 44px !important;
        font-size: 20px !important;
    }
    .stat-content-enhanced .stat-value {
        font-size: 24px !important;
    }
    .stat-content-enhanced h4 {
        font-size: 11px !important;
    }
    .user-grid {
        grid-template-columns: 1fr !important;
    }
    .survey-grid {
        grid-template-columns: 1fr !important;
    }
    .section-header-bar {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
    }
    .section-header-right {
        justify-content: space-between !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
    }
    .filter-tabs {
        overflow-x: auto !important;
        white-space: nowrap !important;
        -webkit-overflow-scrolling: touch !important;
        padding-bottom: 4px !important;
    }
    .welcome-banner-enhanced {
        padding: 20px 16px !important;
        border-radius: 16px !important;
    }
    .welcome-banner-enhanced h1 {
        font-size: 1.4rem !important;
    }
    .welcome-banner-enhanced p {
        font-size: 0.9rem !important;
    }
    .main-body {
        padding: 16px 10px !important;
    }
    .main-header {
        padding: 0 12px !important;
        height: 60px !important;
    }
}

@media (max-width: 480px) {
    .stat-grid-enhanced {
        grid-template-columns: 1fr !important;
    }
    .card-tapi {
        padding: 16px 12px !important;
    }
    .card-tapi .flex-wrap {
        gap: 6px !important;
    }
}

/* 7. Modals & Popups Auto-Fit */
.modal-container {
    width: 94vw !important;
    max-width: 600px !important;
    max-height: 90vh !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    border-radius: var(--radius-xl) !important;
    padding: 24px !important;
}

@media (max-width: 640px) {
    .modal-container {
        padding: 16px 12px !important;
        border-radius: 16px !important;
    }
    .modal-header h3 {
        font-size: 1.1rem !important;
    }
    .link-display {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 8px !important;
    }
    .link-display span {
        word-break: break-all !important;
        font-size: 12px !important;
    }
    .link-display button {
        width: 100% !important;
    }
    #qrCodeContainer canvas,
    #qrCodeContainer img {
        max-width: 220px !important;
        height: auto !important;
        margin: 0 auto !important;
    }
}

/* 8. Responsive Table Wrapper */
.table-responsive {
    width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
}

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

/* ============================================================
   Action Buttons & Card Proportions (Tapee University Design System)
   ============================================================ */
.card-tapi {
    background: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.card-tapi:hover {
    border-color: #cbd5e1;
    box-shadow: 0 4px 12px rgba(30, 58, 138, 0.08);
    transform: translateY(-1px);
}

.btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 6px 10px;
    font-size: 11.5px;
    font-weight: 700;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.18s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.btn-action:active {
    transform: scale(0.96);
}

.btn-action-edit {
    background: #fbbf24;
    color: #78350f;
    border-color: #f59e0b;
}
.btn-action-edit:hover {
    background: #f59e0b;
    color: #ffffff;
}

.btn-action-copy {
    background: #3b82f6;
    color: #ffffff;
    border-color: #2563eb;
}
.btn-action-copy:hover {
    background: #1d4ed8;
}

.btn-action-link {
    background: #1e3a8a;
    color: #ffffff;
    border-color: #172554;
}
.btn-action-link:hover {
    background: #1e40af;
}

.btn-action-import {
    background: #10b981;
    color: #ffffff;
    border-color: #059669;
}
.btn-action-import:hover {
    background: #047857;
}

.btn-action-stats {
    background: #6366f1;
    color: #ffffff;
    border-color: #4f46e5;
}
.btn-action-stats:hover {
    background: #4338ca;
}

.btn-action-delete {
    background: #f43f5e;
    color: #ffffff;
    border-color: #e11d48;
}
.btn-action-delete:hover {
    background: #be123c;
}

.btn-status-select {
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    color: #334155;
    padding: 5px 8px;
    font-size: 11.5px;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.btn-status-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(37,99,235,0.15);
}

/* Standalone Editor Auto-Fit & Clean Scroll */
.editor-container {
    max-width: 960px;
    width: 100%;
    margin: 0 auto;
    padding: 84px 16px 140px;
}

.question-builder {
    background: #ffffff;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.heading-block {
    border-radius: var(--radius-lg);
    border: 2px solid rgba(37, 99, 235, 0.4);
    background: #ffffff;
    margin-bottom: 24px;
    overflow: hidden;
}

@media (max-width: 768px) {
    .editor-container {
        padding: 72px 10px 140px !important;
    }
    .question-builder {
        padding: 14px 12px !important;
    }
    .heading-header {
        padding: 12px !important;
    }
    .heading-questions {
        padding: 12px 10px !important;
    }
    .card-header {
        padding: 16px 14px !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 10px !important;
    }
    .card-body {
        padding: 16px 12px !important;
    }
}


