/* ─── ระบบลงทะเบียน สถาบันพัฒนาฝีมือแรงงาน14 ปทุมธานี ─── */
/* Mobile-First Professional Government Theme */

:root {
    --primary: #1a365d;
    --primary-dark: #0f2440;
    --primary-light: #2c5282;
    --accent: #d69e2e;
    --accent-light: #ecc94b;
    --success: #38a169;
    --info: #3182ce;
    --warning: #dd6b20;
    --danger: #e53e3e;
    --gray-50: #f7fafc;
    --gray-100: #edf2f7;
    --gray-200: #e2e8f0;
    --gray-500: #a0aec0;
    --gray-600: #718096;
    --gray-700: #4a5568;
    --gray-800: #2d3748;
    --sidebar-width: 240px;
}

/* ─── Base ─── */
body {
    font-family: 'Noto Sans Thai', sans-serif;
    background-color: var(--gray-50);
    color: var(--gray-800);
    font-size: 0.95rem;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
.main-content {
    flex: 1;
}

/* ─── Bootstrap Overrides ─── */
.bg-primary { background-color: var(--primary) !important; }
.bg-primary-dark { background-color: var(--primary-dark) !important; }
.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
}
.btn-primary:hover {
    background-color: var(--primary-light);
    border-color: var(--primary-light);
}
.btn-accent {
    background-color: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.btn-accent:hover {
    background-color: var(--accent-light);
    border-color: var(--accent-light);
    color: #333;
}
.text-primary { color: var(--primary) !important; }
.text-accent { color: var(--accent) !important; }

a { color: var(--primary-light); }
a:hover { color: var(--primary); }

/* ─── Navbar ─── */
.navbar-brand {
    font-size: 0.95rem;
}
.navbar .nav-link {
    font-size: 0.9rem;
    padding: 0.5rem 0.75rem !important;
}

/* ─── Hero Section ─── */
.hero-section {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: #fff;
    padding: 2rem 0;
}
.hero-section h1 {
    font-size: 1.5rem;
    font-weight: 700;
}
.hero-section .lead {
    font-size: 0.95rem;
    opacity: 0.9;
}
@media (min-width: 768px) {
    .hero-section {
        padding: 3rem 0;
    }
    .hero-section h1 {
        font-size: 2rem;
    }
    .hero-section .lead {
        font-size: 1.1rem;
    }
}

/* ─── Course Cards ─── */
.course-card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transition: transform 0.2s, box-shadow 0.2s;
    overflow: hidden;
}
.course-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}
.course-card .card-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    color: #fff;
    border: none;
    padding: 1rem;
}
.course-card .card-body {
    padding: 1rem;
}
.course-card .card-footer {
    background: var(--gray-50);
    border-top: 1px solid var(--gray-200);
    padding: 0.75rem 1rem;
}
.course-banner {
    width: 100%;
    height: 160px;
    object-fit: cover;
}
@media (min-width: 768px) {
    .course-banner { height: 180px; }
}
.course-info-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0;
    font-size: 0.85rem;
    color: var(--gray-600);
}
.course-info-item i {
    color: var(--primary);
    width: 16px;
    text-align: center;
}

/* ─── Stats Cards ─── */
.stat-card {
    border: none;
    border-radius: 12px;
    padding: 1.25rem;
    color: #fff;
    position: relative;
    overflow: hidden;
}
.stat-card::after {
    content: '';
    position: absolute;
    right: -10px;
    top: -10px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
}
.stat-card .stat-number {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1;
}
.stat-card .stat-label {
    font-size: 0.8rem;
    opacity: 0.85;
    margin-top: 0.25rem;
}
.stat-card .stat-icon {
    font-size: 1.5rem;
    opacity: 0.7;
}

/* ─── Admin Layout ─── */
.admin-body {
    min-height: 100vh;
}
.admin-sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    flex-shrink: 0;
    min-height: calc(100vh - 56px);
    position: sticky;
    top: 56px;
    border-right: 1px solid var(--gray-200);
}
.admin-content {
    min-width: 0;
    min-height: calc(100vh - 56px);
    background: var(--gray-50);
}
.admin-nav-link {
    display: flex;
    align-items: center;
    padding: 0.65rem 0.75rem;
    margin-bottom: 2px;
    color: var(--gray-700);
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.9rem;
    transition: background 0.15s;
}
.admin-nav-link:hover {
    background: var(--gray-100);
    color: var(--primary);
}
.admin-nav-link.active {
    background: var(--primary);
    color: #fff;
}
.admin-nav-link.active:hover {
    background: var(--primary-light);
    color: #fff;
}

/* ─── Tables ─── */
.table-responsive { border-radius: 8px; }
.table thead th {
    background: var(--gray-100);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    color: var(--gray-600);
    border-bottom: 2px solid var(--gray-200);
    white-space: nowrap;
}
.table td {
    vertical-align: middle;
    font-size: 0.9rem;
}

/* ─── Forms ─── */
.form-label {
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--gray-700);
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 0.2rem rgba(26, 54, 93, 0.15);
}

/* ─── Cards ─── */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.card-header {
    background: #fff;
    border-bottom: 1px solid var(--gray-200);
    font-weight: 600;
}

/* ─── Badges ─── */
.badge {
    font-weight: 500;
    font-size: 0.75rem;
    padding: 0.35em 0.65em;
    border-radius: 6px;
}

/* ─── Message Card ─── */
.message-card {
    border-left: 4px solid var(--primary);
    transition: background 0.15s;
}
.message-card.unread {
    background: #ebf4ff;
    border-left-color: var(--accent);
}
.message-card:hover {
    background: var(--gray-100);
}

/* ─── Empty State ─── */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--gray-500);
}
.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
}
.empty-state p {
    font-size: 1rem;
}

/* ─── Auth Pages ─── */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 50%, #4299e1 100%);
    padding: 1rem;
}
.auth-card {
    width: 100%;
    max-width: 440px;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    overflow: hidden;
}
.auth-header {
    background: var(--primary-dark);
    color: #fff;
    padding: 1.5rem;
    text-align: center;
}
.auth-header h4 {
    margin: 0;
    font-weight: 600;
}
.auth-body {
    padding: 1.5rem;
    background: #fff;
}

/* ─── Student Dashboard ─── */
.status-timeline {
    position: relative;
    padding-left: 2rem;
}
.status-timeline::before {
    content: '';
    position: absolute;
    left: 0.5rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--gray-200);
}
.status-step {
    position: relative;
    padding-bottom: 1rem;
}
.status-step::before {
    content: '';
    position: absolute;
    left: -1.65rem;
    top: 0.2rem;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--gray-500);
    border: 2px solid #fff;
}
.status-step.active::before {
    background: var(--success);
    box-shadow: 0 0 0 3px rgba(56, 161, 105, 0.2);
}

/* ─── Status Option (Radio Cards) ─── */
.status-option {
    cursor: pointer;
    margin: 0;
}
.status-option .btn-check { display: none; }
.status-option span.d-flex {
    transition: all 0.15s;
    font-size: 0.85rem;
    border-color: var(--gray-200) !important;
}
.status-option:hover span.d-flex {
    background: var(--gray-50);
    border-color: var(--primary-light) !important;
}
.status-option .btn-check:checked + span.d-flex {
    background: #ebf4ff;
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 2px rgba(26, 54, 93, 0.2);
}

/* ─── Footer (PC) ─── */
.site-footer {
    background: var(--primary-dark);
    color: #cbd5e0;
    padding: 1rem 0;
    margin-top: auto;
}

/* ─── Mobile Bottom Navigation ─── */
.mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: #fff;
    border-top: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 1050;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.06);
    padding-bottom: env(safe-area-inset-bottom, 0);
}
.mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--gray-500);
    font-size: 0.65rem;
    padding: 0.25rem 0.5rem;
    position: relative;
    transition: color 0.15s;
    -webkit-tap-highlight-color: transparent;
}
.mobile-nav-item i { font-size: 1.25rem; }
.mobile-nav-item.active {
    color: var(--primary);
    font-weight: 600;
}
.mobile-nav-item.active i { font-weight: 700; }
.mobile-nav-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--danger);
    color: #fff;
    font-size: 0.55rem;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

/* ─── Mobile App-like Adjustments ─── */
@media (max-width: 991.98px) {
    body {
        padding-bottom: 68px;
        -webkit-text-size-adjust: 100%;
    }
    .container { padding-left: 0.75rem; padding-right: 0.75rem; }
    .hero-section { padding: 1.5rem 0; }
    .hero-section h1 { font-size: 1.25rem; }
    .hero-section .lead { font-size: 0.85rem; }
    .course-card { border-radius: 10px; }
    .card { border-radius: 10px; }
    .stat-card { border-radius: 10px; padding: 1rem; }
    .stat-card .stat-number { font-size: 1.5rem; }
    .navbar-brand div .fw-bold { font-size: 0.85rem; }
}

/* ─── OTP Input ─── */
.otp-input {
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.5rem;
    padding: 0.75rem;
}

/* ─── Print Styles ─── */
@media print {
    .no-print, .navbar, .admin-sidebar, .offcanvas, footer,
    .mobile-bottom-nav,
    .btn, .alert, .admin-nav-link { display: none !important; }
    .admin-content { margin: 0; padding: 0; }
    body { background: #fff; font-size: 12pt; padding-bottom: 0; }
    .table thead th { background: #eee !important; }
    .card { box-shadow: none; border: 1px solid #ddd; }
    @page { margin: 1.5cm; }
}

/* ─── Utilities ─── */
.cursor-pointer { cursor: pointer; }
.min-vh-50 { min-height: 50vh; }
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.hover-shadow:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.1) !important; }
