:root {
    --primary: #1e3a8a; /* Deep Blue */
    --primary-light: #3b82f6;
    --secondary: #fbbf24; /* Gold */
    --bg-color: #f0fdfa; /* Light mint/blue background */
    --glass-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 255, 255, 0.3);
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --success: #10b981;
    --danger: #ef4444;
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius-lg: 1rem;
    --radius-full: 9999px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Sarabun', sans-serif;
}

body {
    background: linear-gradient(135deg, #e0f2fe 0%, #bfdbfe 100%);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
}

.app-container {
    width: 100%;
    max-width: 480px; /* Mobile first approach */
    background: url('https://www.transparenttextures.com/patterns/cubes.png'), linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    min-height: 100vh;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow-x: hidden;
    padding-bottom: 80px; /* Space for bottom nav */
}

/* Header */
.app-header {
    background: linear-gradient(135deg, var(--primary) 0%, #172554 100%);
    color: white;
    padding: 2rem 1.5rem 2.5rem;
    text-align: center;
    border-bottom-left-radius: 2rem;
    border-bottom-right-radius: 2rem;
    box-shadow: 0 4px 20px rgba(30, 58, 138, 0.3);
    position: relative;
    z-index: 10;
}

.school-logo {
    width: 80px;
    height: 80px;
    object-fit: contain;
    border-radius: 50%;
    background: white;
    padding: 5px;
    margin-bottom: 1rem;
    box-shadow: 0 0 15px rgba(251, 191, 36, 0.5); /* Gold glow */
    border: 2px solid var(--secondary);
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

.app-header h1 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
    letter-spacing: 0.5px;
}

.app-header p {
    font-size: 0.9rem;
    color: #93c5fd;
    font-weight: 300;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    width: 100%;
    max-width: 480px;
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-around;
    padding: 0.5rem 0;
    z-index: 50;
    box-shadow: 0 -4px 10px rgba(0,0,0,0.05);
}

.nav-btn {
    background: none;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-muted);
    font-size: 0.75rem;
    padding: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 33%;
}

.nav-btn i {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
    transition: transform 0.3s ease;
}

.nav-btn.active {
    color: var(--primary);
    font-weight: 600;
}

.nav-btn.active i {
    transform: translateY(-3px);
    color: var(--primary);
}

/* Main Content */
.content-area {
    padding: 1.5rem;
    position: relative;
    top: -20px;
    z-index: 20;
}

.tab-content {
    display: none;
    animation: fadeIn 0.4s ease forwards;
}

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

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

/* Cards (Glassmorphism) */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
}

.scanner-card {
    text-align: center;
    border-top: 4px solid var(--primary);
}

.scanner-card h2 {
    font-size: 1.2rem;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

/* Scanner Area */
#reader-container {
    width: 100%;
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 1.5rem;
    background: #000;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
    min-height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#reader {
    width: 100%;
}

/* Buttons */
.primary-btn {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: var(--radius-full);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
    transition: all 0.3s ease;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.6);
}

.danger-btn {
    background: linear-gradient(135deg, #ef4444 0%, #f87171 100%);
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: var(--radius-full);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
    transition: all 0.3s ease;
}

.primary-btn-small, .danger-btn-small, .secondary-btn {
    padding: 0.4rem 0.8rem;
    border-radius: 0.5rem;
    font-size: 0.85rem;
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

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

.danger-btn-small {
    background: #ef4444;
    color: white;
}

.secondary-btn {
    background: #e5e7eb;
    color: var(--text-main);
}

.pulse-btn {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7); }
    70% { box-shadow: 0 0 0 15px rgba(59, 130, 246, 0); }
    100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}

/* Status Box */
.status-box {
    background: #f3f4f6;
    border-radius: 0.5rem;
    padding: 0.75rem;
    margin-bottom: 1.5rem;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.status-box i {
    color: var(--primary);
}

.status-box.success i { color: var(--success); }
.status-box.error i { color: var(--danger); }

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

.modern-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.modern-table th {
    background: #f8fafc;
    color: var(--text-muted);
    font-weight: 600;
    text-align: left;
    padding: 0.75rem 0.5rem;
    border-bottom: 2px solid #e2e8f0;
}

.modern-table td {
    padding: 0.75rem 0.5rem;
    border-bottom: 1px solid #e2e8f0;
    color: var(--text-main);
}

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

/* Flex Utilities */
.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.mb-4 { margin-bottom: 1rem; }
.mt-4 { margin-top: 1rem; }
.hidden { display: none !important; }

/* Modals */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-content {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    width: 100%;
    max-width: 400px;
    animation: zoomIn 0.3s ease;
}

@keyframes zoomIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.success-glass {
    text-align: center;
    border-top: 5px solid var(--success);
}

.error-glass {
    text-align: center;
    border-top: 5px solid var(--danger);
}

.success-icon {
    font-size: 3rem;
    color: var(--success);
    margin-bottom: 1rem;
}

.error-icon {
    font-size: 3rem;
    color: var(--danger);
    margin-bottom: 1rem;
}

.result-details {
    text-align: left;
    background: #f8fafc;
    padding: 1rem;
    border-radius: 0.5rem;
    margin-top: 1rem;
}

.result-details p {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.signature-box {
    margin-top: 0.5rem;
    border-top: 1px dashed #cbd5e1;
    padding-top: 0.5rem;
}

.signature-box img {
    max-height: 60px;
    margin-top: 0.5rem;
    display: block;
}

/* Forms */
.form-group {
    margin-bottom: 1rem;
    text-align: left;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.modern-input {
    width: 100%;
    padding: 0.6rem;
    border: 1px solid #cbd5e1;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.2s;
}

.modern-input:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1.5rem;
}

.export-btns {
    display: flex;
    gap: 0.5rem;
}
