/* 
 * ระบบข้อสอบ O-Net - Main Stylesheet
 * Design: Glassmorphism with White Background
 * Font: Sarabun
 */

/* Import Google Fonts - Sarabun */
@import url('https://fonts.googleapis.com/css2?family=Sarabun:wght@300;400;500;600;700&display=swap');

/* CSS Variables */
:root {
    --primary-color: #4361ee;
    --primary-dark: #3a56d4;
    --primary-light: #7289f5;
    --secondary-color: #7209b7;
    --success-color: #06d6a0;
    --warning-color: #ffd166;
    --danger-color: #ef476f;
    --info-color: #118ab2;
    
    --bg-gradient-start: #f8f9ff;
    --bg-gradient-end: #e8ecff;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.5);
    --glass-shadow: 0 8px 32px rgba(67, 97, 238, 0.15);
    
    --text-primary: #1a1a2e;
    --text-secondary: #4a4a68;
    --text-muted: #8888a0;
    
    --border-radius: 20px;
    --border-radius-sm: 12px;
    --border-radius-lg: 28px;
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Sarabun', sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 16px;
}

/* Background Decorations */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    right: -20%;
    width: 60%;
    height: 100%;
    background: radial-gradient(circle, rgba(67, 97, 238, 0.1) 0%, transparent 70%);
    pointer-events: none;
    z-index: -1;
}

body::after {
    content: '';
    position: fixed;
    bottom: -30%;
    left: -20%;
    width: 50%;
    height: 80%;
    background: radial-gradient(circle, rgba(114, 9, 183, 0.08) 0%, transparent 70%);
    pointer-events: none;
    z-index: -1;
}

/* Glass Card */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    box-shadow: var(--glass-shadow);
    padding: 2rem;
    transition: var(--transition);
}

.glass-card:hover {
    box-shadow: 0 12px 40px rgba(67, 97, 238, 0.2);
    transform: translateY(-2px);
}

.glass-card-static {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    box-shadow: var(--glass-shadow);
    padding: 2rem;
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.container-fluid {
    width: 100%;
    padding: 0 1.5rem;
}

/* Navigation */
.navbar {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    padding: 1rem 2rem;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--primary-color);
    font-weight: 700;
    font-size: 1.5rem;
}

.navbar-brand i {
    font-size: 1.75rem;
}

.navbar-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    list-style: none;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    text-decoration: none;
    color: var(--text-secondary);
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
    font-weight: 500;
}

.nav-link:hover,
.nav-link.active {
    background: rgba(67, 97, 238, 0.1);
    color: var(--primary-color);
}

.nav-link i {
    font-size: 1.1rem;
}

/* Sidebar */
.sidebar {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-right: 1px solid var(--glass-border);
    width: 280px;
    min-height: calc(100vh - 73px);
    padding: 1.5rem;
    position: fixed;
    left: 0;
    top: 73px;
    overflow-y: auto;
}

.sidebar-menu {
    list-style: none;
}

.sidebar-menu li {
    margin-bottom: 0.5rem;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    text-decoration: none;
    color: var(--text-secondary);
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
    font-weight: 500;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    box-shadow: 0 4px 15px rgba(67, 97, 238, 0.3);
}

.sidebar-menu a i {
    width: 24px;
    text-align: center;
    font-size: 1.1rem;
}

.sidebar-divider {
    height: 1px;
    background: var(--glass-border);
    margin: 1.5rem 0;
}

.sidebar-heading {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0.5rem 1rem;
    margin-bottom: 0.5rem;
}

/* Main Content */
.main-content {
    margin-left: 280px;
    padding: 2rem;
    min-height: calc(100vh - 73px);
}

.main-content-full {
    padding: 2rem;
    min-height: calc(100vh - 73px);
}

/* Page Header */
.page-header {
    margin-bottom: 2rem;
}

.page-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.page-subtitle {
    color: var(--text-muted);
    font-size: 1rem;
}

/* Breadcrumb */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    list-style: none;
    padding: 0.75rem 1.25rem;
    background: var(--glass-bg);
    border-radius: var(--border-radius-sm);
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.breadcrumb-item {
    display: flex;
    align-items: center;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: '/';
    color: var(--text-muted);
    margin-right: 0.5rem;
}

.breadcrumb-item a {
    color: var(--primary-color);
    text-decoration: none;
}

.breadcrumb-item.active {
    color: var(--text-muted);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-family: 'Sarabun', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    box-shadow: 0 4px 15px rgba(67, 97, 238, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary-color));
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(67, 97, 238, 0.4);
}

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

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.9);
    color: var(--primary-color);
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color), #04b890);
    color: white;
    box-shadow: 0 4px 15px rgba(6, 214, 160, 0.3);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(6, 214, 160, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color), #d63d5e);
    color: white;
    box-shadow: 0 4px 15px rgba(239, 71, 111, 0.3);
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(239, 71, 111, 0.4);
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning-color), #e6bc5c);
    color: var(--text-primary);
    box-shadow: 0 4px 15px rgba(255, 209, 102, 0.3);
}

.btn-info {
    background: linear-gradient(135deg, var(--info-color), #0d7a9e);
    color: white;
    box-shadow: 0 4px 15px rgba(17, 138, 178, 0.3);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

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

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
}

.btn-block {
    width: 100%;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

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

.form-control {
    width: 100%;
    padding: 0.875rem 1.25rem;
    font-family: 'Sarabun', sans-serif;
    font-size: 1rem;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.8);
    border: 2px solid transparent;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
    outline: none;
}

.form-control:focus {
    background: white;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(67, 97, 238, 0.1);
}

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

.form-control-glass {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
}

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

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%234a4a68' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1rem;
    padding-right: 3rem;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.form-check-input {
    width: 20px;
    height: 20px;
    accent-color: var(--primary-color);
    cursor: pointer;
}

.form-check-label {
    cursor: pointer;
    color: var(--text-secondary);
}

.form-text {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

.form-error {
    color: var(--danger-color);
    font-size: 0.875rem;
    margin-top: 0.5rem;
}

.input-group {
    display: flex;
    align-items: stretch;
}

.input-group .form-control {
    border-radius: var(--border-radius-sm) 0 0 var(--border-radius-sm);
}

.input-group-text {
    display: flex;
    align-items: center;
    padding: 0 1.25rem;
    background: rgba(67, 97, 238, 0.1);
    border: 2px solid transparent;
    border-left: none;
    border-radius: 0 var(--border-radius-sm) var(--border-radius-sm) 0;
    color: var(--primary-color);
}

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

.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
}

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

.table th {
    background: rgba(67, 97, 238, 0.05);
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
}

.table tbody tr:hover {
    background: rgba(67, 97, 238, 0.03);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* Cards Grid */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

/* Stat Cards */
.stat-card {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    padding: 1.5rem;
}

.stat-icon {
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    font-size: 1.5rem;
    color: white;
}

.stat-icon.primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
}

.stat-icon.success {
    background: linear-gradient(135deg, var(--success-color), #04b890);
}

.stat-icon.warning {
    background: linear-gradient(135deg, var(--warning-color), #e6bc5c);
}

.stat-icon.danger {
    background: linear-gradient(135deg, var(--danger-color), #d63d5e);
}

.stat-icon.info {
    background: linear-gradient(135deg, var(--info-color), #0d7a9e);
}

.stat-content h3 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.stat-content p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Subject Cards */
.subject-card {
    position: relative;
    overflow: hidden;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
}

.subject-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, var(--subject-color) 0%, transparent 70%);
    opacity: 0.1;
    transition: var(--transition);
}

.subject-card:hover::before {
    opacity: 0.2;
}

.subject-icon {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.25rem;
    border-radius: 50%;
    font-size: 2rem;
    color: white;
    background: var(--subject-color);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.subject-card h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.subject-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Exam Card */
.exam-card {
    display: flex;
    flex-direction: column;
    height: 100%;
}

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

.exam-badge {
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-published {
    background: rgba(6, 214, 160, 0.15);
    color: var(--success-color);
}

.badge-draft {
    background: rgba(255, 209, 102, 0.15);
    color: #c9a347;
}

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

.exam-card h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.exam-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1rem;
    flex-grow: 1;
}

.exam-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--glass-border);
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.exam-meta span {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.exam-meta i {
    color: var(--primary-color);
}

/* Question Types */
.question-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
}

.question-type-badge.multiple-choice {
    background: rgba(67, 97, 238, 0.1);
    color: var(--primary-color);
}

.question-type-badge.complex-choice {
    background: rgba(114, 9, 183, 0.1);
    color: var(--secondary-color);
}

.question-type-badge.subjective {
    background: rgba(6, 214, 160, 0.1);
    color: var(--success-color);
}

.question-type-badge.ordering {
    background: rgba(255, 209, 102, 0.1);
    color: #c9a347;
}

/* Question Box */
.question-box {
    margin-bottom: 2rem;
    padding: 2rem;
}

.question-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.question-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    font-weight: 700;
    border-radius: 50%;
    margin-right: 1rem;
    flex-shrink: 0;
}

.question-score {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(6, 214, 160, 0.1);
    color: var(--success-color);
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    font-size: 0.875rem;
}

.question-text {
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
}

.question-text img {
    max-width: 100%;
    border-radius: var(--border-radius-sm);
    margin: 1rem 0;
}

.question-text table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.question-text table th,
.question-text table td {
    padding: 0.75rem 1rem;
    border: 1px solid var(--glass-border);
}

.question-text table th {
    background: rgba(67, 97, 238, 0.05);
}

/* Options */
.options-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.option-item {
    display: flex;
    align-items: center;
    padding: 1rem 1.25rem;
    background: rgba(255, 255, 255, 0.5);
    border: 2px solid transparent;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.option-item:hover {
    background: rgba(67, 97, 238, 0.05);
    border-color: var(--primary-light);
}

.option-item.selected {
    background: rgba(67, 97, 238, 0.1);
    border-color: var(--primary-color);
}

.option-item.correct {
    background: rgba(6, 214, 160, 0.1);
    border-color: var(--success-color);
}

.option-item.incorrect {
    background: rgba(239, 71, 111, 0.1);
    border-color: var(--danger-color);
}

.option-label {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: var(--glass-bg);
    border-radius: 50%;
    font-weight: 600;
    color: var(--text-secondary);
    margin-right: 1rem;
    flex-shrink: 0;
    transition: var(--transition);
}

.option-item.selected .option-label {
    background: var(--primary-color);
    color: white;
}

.option-item.correct .option-label {
    background: var(--success-color);
    color: white;
}

.option-item.incorrect .option-label {
    background: var(--danger-color);
    color: white;
}

.option-text {
    flex-grow: 1;
    color: var(--text-primary);
}

/* Complex Choice (True/False) */
.stimulus-box {
    padding: 1.5rem;
    background: rgba(114, 9, 183, 0.05);
    border-left: 4px solid var(--secondary-color);
    border-radius: 0 var(--border-radius-sm) var(--border-radius-sm) 0;
    margin-bottom: 1.5rem;
}

.stimulus-box h4 {
    color: var(--secondary-color);
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sub-items-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.sub-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    background: rgba(255, 255, 255, 0.5);
    border-radius: var(--border-radius-sm);
    gap: 1rem;
}

.sub-item-text {
    flex-grow: 1;
    color: var(--text-primary);
}

.true-false-toggle {
    display: flex;
    gap: 0.5rem;
}

.toggle-btn {
    padding: 0.5rem 1rem;
    border: 2px solid var(--glass-border);
    border-radius: var(--border-radius-sm);
    background: white;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    font-family: 'Sarabun', sans-serif;
    font-weight: 500;
}

.toggle-btn:hover {
    border-color: var(--primary-light);
}

.toggle-btn.selected-true {
    background: var(--success-color);
    border-color: var(--success-color);
    color: white;
}

.toggle-btn.selected-false {
    background: var(--danger-color);
    border-color: var(--danger-color);
    color: white;
}

/* Ordering */
.ordering-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.ordering-slot {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.5);
    border: 2px dashed var(--glass-border);
    border-radius: var(--border-radius-sm);
    min-height: 60px;
}

.ordering-slot.filled {
    border-style: solid;
    border-color: var(--primary-color);
    background: rgba(67, 97, 238, 0.05);
}

.ordering-position {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    font-weight: 700;
    border-radius: 50%;
    flex-shrink: 0;
}

.ordering-items {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.5rem;
    padding: 1.5rem;
    background: rgba(67, 97, 238, 0.03);
    border-radius: var(--border-radius-sm);
}

.ordering-item {
    padding: 0.75rem 1.25rem;
    background: white;
    border: 2px solid var(--glass-border);
    border-radius: var(--border-radius-sm);
    cursor: grab;
    transition: var(--transition);
    user-select: none;
}

.ordering-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(67, 97, 238, 0.15);
}

.ordering-item.dragging {
    opacity: 0.5;
}

.ordering-item.placed {
    opacity: 0.5;
    cursor: default;
}

/* Subjective Answer */
.subjective-answer {
    margin-top: 1rem;
}

.subjective-answer textarea {
    width: 100%;
    min-height: 150px;
    padding: 1rem;
    font-family: 'Sarabun', sans-serif;
    font-size: 1rem;
    border: 2px solid var(--glass-border);
    border-radius: var(--border-radius-sm);
    resize: vertical;
    transition: var(--transition);
}

.subjective-answer textarea:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 4px rgba(67, 97, 238, 0.1);
}

/* Timer */
.exam-timer {
    position: fixed;
    top: 90px;
    right: 2rem;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius);
    box-shadow: var(--glass-shadow);
}

.exam-timer i {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.exam-timer .time {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.exam-timer.warning {
    border-color: var(--warning-color);
}

.exam-timer.warning i,
.exam-timer.warning .time {
    color: var(--warning-color);
}

.exam-timer.danger {
    border-color: var(--danger-color);
    animation: pulse 1s infinite;
}

.exam-timer.danger i,
.exam-timer.danger .time {
    color: var(--danger-color);
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.02); }
}

/* Progress Bar */
.progress {
    height: 8px;
    background: rgba(67, 97, 238, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--primary-light));
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-bar.success {
    background: linear-gradient(90deg, var(--success-color), #04b890);
}

.progress-bar.warning {
    background: linear-gradient(90deg, var(--warning-color), #e6bc5c);
}

.progress-bar.danger {
    background: linear-gradient(90deg, var(--danger-color), #d63d5e);
}

/* Question Navigator */
.question-navigator {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--glass-shadow);
    z-index: 100;
    flex-wrap: wrap;
    max-width: 90vw;
    justify-content: center;
}

.nav-dot {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(67, 97, 238, 0.1);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
    border: none;
}

.nav-dot:hover {
    background: rgba(67, 97, 238, 0.2);
}

.nav-dot.current {
    background: var(--primary-color);
    color: white;
}

.nav-dot.answered {
    background: var(--success-color);
    color: white;
}

.nav-dot.flagged {
    background: var(--warning-color);
    color: var(--text-primary);
}

/* Alerts */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-radius: var(--border-radius-sm);
    margin-bottom: 1.5rem;
}

.alert i {
    font-size: 1.25rem;
    margin-top: 0.125rem;
}

.alert-success {
    background: rgba(6, 214, 160, 0.1);
    border: 1px solid rgba(6, 214, 160, 0.3);
    color: var(--success-color);
}

.alert-warning {
    background: rgba(255, 209, 102, 0.1);
    border: 1px solid rgba(255, 209, 102, 0.3);
    color: #c9a347;
}

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

.alert-info {
    background: rgba(17, 138, 178, 0.1);
    border: 1px solid rgba(17, 138, 178, 0.3);
    color: var(--info-color);
}

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

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

.modal {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: var(--transition);
}

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

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

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
}

.modal-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: rgba(239, 71, 111, 0.1);
    color: var(--danger-color);
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
}

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

.modal-body {
    padding: 2rem;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--glass-border);
}

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

.badge-primary {
    background: rgba(67, 97, 238, 0.15);
    color: var(--primary-color);
}

.badge-success {
    background: rgba(6, 214, 160, 0.15);
    color: var(--success-color);
}

.badge-warning {
    background: rgba(255, 209, 102, 0.15);
    color: #c9a347;
}

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

/* Avatar */
.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--glass-border);
}

.avatar-lg {
    width: 80px;
    height: 80px;
}

.avatar-sm {
    width: 32px;
    height: 32px;
}

.avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    font-weight: 700;
}

/* Dropdown */
.dropdown {
    position: relative;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 200px;
    background: white;
    border-radius: var(--border-radius-sm);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: var(--transition);
    z-index: 100;
}

.dropdown:hover .dropdown-menu,
.dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
}

.dropdown-item:hover {
    background: rgba(67, 97, 238, 0.05);
    color: var(--primary-color);
}

.dropdown-divider {
    height: 1px;
    background: var(--glass-border);
    margin: 0.5rem 0;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--glass-border);
    padding-bottom: 0;
}

.tab-btn {
    padding: 1rem 1.5rem;
    background: none;
    border: none;
    font-family: 'Sarabun', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.tab-btn::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary-color);
    transform: scaleX(0);
    transition: var(--transition);
}

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

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

.tab-btn.active::after {
    transform: scaleX(1);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Results */
.result-card {
    text-align: center;
    padding: 3rem 2rem;
}

.result-score {
    position: relative;
    width: 180px;
    height: 180px;
    margin: 0 auto 2rem;
}

.result-score-circle {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: conic-gradient(
        var(--primary-color) calc(var(--score) * 3.6deg),
        rgba(67, 97, 238, 0.1) 0
    );
    display: flex;
    align-items: center;
    justify-content: center;
}

.result-score-inner {
    width: 140px;
    height: 140px;
    background: white;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.result-score-value {
    font-size: 3rem;
    font-weight: 700;
    color: var(--text-primary);
}

.result-score-label {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.result-status {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.result-status.passed {
    color: var(--success-color);
}

.result-status.failed {
    color: var(--danger-color);
}

.result-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-top: 2rem;
    text-align: center;
}

.result-detail {
    padding: 1rem;
    background: rgba(67, 97, 238, 0.05);
    border-radius: var(--border-radius-sm);
}

.result-detail h4 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.result-detail p {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Violation Warning */
.violation-warning {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 3000;
    text-align: center;
    padding: 3rem;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: 0 25px 50px rgba(239, 71, 111, 0.3);
    animation: shake 0.5s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translate(-50%, -50%) rotate(0); }
    25% { transform: translate(-50%, -50%) rotate(-2deg); }
    75% { transform: translate(-50%, -50%) rotate(2deg); }
}

.violation-warning i {
    font-size: 4rem;
    color: var(--danger-color);
    margin-bottom: 1.5rem;
}

.violation-warning h2 {
    color: var(--danger-color);
    margin-bottom: 1rem;
}

.violation-warning p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
}

.empty-state i {
    font-size: 4rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.empty-state h3 {
    font-size: 1.5rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

/* Tooltip */
[data-tooltip] {
    position: relative;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem 0.75rem;
    background: var(--text-primary);
    color: white;
    font-size: 0.75rem;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    margin-bottom: 0.5rem;
}

[data-tooltip]:hover::after {
    opacity: 1;
    visibility: visible;
}

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

.text-primary { color: var(--primary-color); }
.text-success { color: var(--success-color); }
.text-warning { color: var(--warning-color); }
.text-danger { color: var(--danger-color); }
.text-muted { color: var(--text-muted); }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }

.w-100 { width: 100%; }
.h-100 { height: 100%; }

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        transition: var(--transition);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .question-navigator {
        bottom: 1rem;
        padding: 0.75rem 1rem;
    }
    
    .nav-dot {
        width: 30px;
        height: 30px;
        font-size: 0.75rem;
    }
}

@media (max-width: 768px) {
    .page-title {
        font-size: 1.5rem;
    }
    
    .glass-card {
        padding: 1.5rem;
    }
    
    .stat-card {
        padding: 1.25rem;
    }
    
    .stat-icon {
        width: 50px;
        height: 50px;
        font-size: 1.25rem;
    }
    
    .stat-content h3 {
        font-size: 1.5rem;
    }
    
    .exam-timer {
        top: auto;
        bottom: auto;
        right: 1rem;
        top: 90px;
        padding: 0.75rem 1rem;
    }
    
    .exam-timer .time {
        font-size: 1.25rem;
    }
    
    .cards-grid {
        grid-template-columns: 1fr;
    }
    
    .modal {
        margin: 1rem;
        width: calc(100% - 2rem);
    }
}

@media (max-width: 480px) {
    body {
        font-size: 14px;
    }
    
    .navbar {
        padding: 0.75rem 1rem;
    }
    
    .navbar-brand {
        font-size: 1.25rem;
    }
    
    .main-content,
    .main-content-full {
        padding: 1rem;
    }
    
    .btn {
        padding: 0.625rem 1.25rem;
    }
    
    .question-box {
        padding: 1.25rem;
    }
}

/* Print Styles */
@media print {
    .navbar,
    .sidebar,
    .exam-timer,
    .question-navigator,
    .btn {
        display: none !important;
    }
    
    body {
        background: white;
    }
    
    .glass-card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .main-content {
        margin-left: 0;
    }
}
