/**
 * style.css – Main Styles (Mobile-first)
 *
 * Color variables are defined inline in header.php:
 *   --color-primary:   #2563EB
 *   --color-secondary: #10B981
 *   --color-accent:    #F59E0B
 *   --color-bg:        #F9FAFB
 *   --color-text:      #111827
 *   --color-border:    #E5E7EB
 *   --color-muted:     #6B7280
 *
 * Bootstrap 5.3, Google Fonts (Roboto, Open Sans) already loaded in header.php.
 *
 * @package GiaSuAnhSao
 */

/* ===================================================================
   1. GLOBAL RESETS & BASE
   =================================================================== */

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    line-height: 1.6;
    overflow-x: hidden;
}

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

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color .2s ease;
}
a:hover {
    color: #1d4ed8;
}

::selection {
    background: var(--color-primary);
    color: #fff;
}

/* ===================================================================
   2. TYPOGRAPHY
   =================================================================== */

h1 { font-size: 2rem;   margin-bottom: 1rem; }
h2 { font-size: 1.65rem; margin-bottom: .85rem; }
h3 { font-size: 1.35rem; margin-bottom: .75rem; }
h4 { font-size: 1.15rem; margin-bottom: .6rem; }
h5 { font-size: 1rem;    margin-bottom: .5rem; }

.lead {
    font-size: 1.1rem;
    color: var(--color-muted);
}

.text-primary  { color: var(--color-primary) !important; }
.text-secondary{ color: var(--color-secondary) !important; }
.text-accent   { color: var(--color-accent) !important; }
.text-muted    { color: var(--color-muted) !important; }

/* ===================================================================
   3. TOP BAR
   =================================================================== */

.top-bar {
    font-size: .82rem;
    letter-spacing: .01em;
}
.top-bar a {
    transition: opacity .2s;
}
.top-bar a:hover {
    opacity: .85;
}

/* ===================================================================
   4. NAVBAR
   =================================================================== */

.navbar {
    transition: box-shadow .3s ease, background .3s ease;
}
.navbar.scrolled {
    box-shadow: 0 2px 12px rgba(0,0,0,.1);
}

.navbar-brand span {
    font-size: 1.15rem;
}

.navbar .nav-link {
    font-size: .9rem;
    font-weight: 600;
    color: #374151;
    padding: .5rem .75rem;
    transition: color .2s ease;
}
.navbar .nav-link:hover,
.navbar .nav-link.active {
    color: var(--color-primary);
}

/* ── Dropdown ── */
.nav-dropdown {
    position: relative;
}

.nav-dropdown__toggle {
    cursor: pointer;
}

.nav-dropdown__arrow {
    font-size: .55rem;
    margin-left: .3rem;
    transition: transform .2s ease;
}

/* Menu: hidden by default */
.nav-dropdown__menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 220px;
    margin: 0;
    padding: .5rem 0;
    list-style: none;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: .5rem;
    box-shadow: 0 8px 24px rgba(0,0,0,.1);
    z-index: 1000;
}

/* Roll-down keyframes */
@keyframes dropdownSlideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Desktop: show on hover */
@media (min-width: 992px) {
    .nav-dropdown:hover > .nav-dropdown__menu {
        display: block;
        animation: dropdownSlideDown .2s ease;
    }
    .nav-dropdown:hover > .nav-dropdown__toggle {
        color: var(--color-primary);
    }
    .nav-dropdown:hover .nav-dropdown__arrow {
        transform: rotate(180deg);
    }
}

/* Mobile: show on click */
@media (max-width: 991.98px) {
    .nav-dropdown__menu {
        position: static;
        box-shadow: none;
        border: 0;
        background: transparent;
        padding-left: 1rem;
    }
    .nav-dropdown.is-open > .nav-dropdown__menu {
        display: block;
    }
    .nav-dropdown.is-open .nav-dropdown__arrow {
        transform: rotate(180deg);
    }
}

/* Dropdown item */
.nav-dropdown__item {
    display: block;
    font-size: .88rem;
    padding: .45rem 1rem;
    color: var(--color-text);
    text-decoration: none;
    white-space: nowrap;
    border-bottom: 1px solid var(--color-border);
}

.nav-dropdown__menu li:last-child .nav-dropdown__item {
    border-bottom: none;
}

.nav-dropdown__item:hover {
    background: #eff6ff;
    color: var(--color-primary);
}

.nav-dropdown__item i {
    width: 20px;
    text-align: center;
    color: var(--color-muted);
}

.nav-dropdown__item:hover i {
    color: var(--color-primary);
}

/* ===================================================================
   5. HERO SECTION
   =================================================================== */

.hero-section {
    position: relative;
    background: linear-gradient(135deg, #1e3a8a 0%, var(--color-primary) 50%, #3b82f6 100%);
    color: #fff;
    padding: 3.5rem 0 3rem;
    overflow: hidden;
}
.hero-section::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('../images/hero-bg.jpg') center/cover no-repeat;
    opacity: .12;
    pointer-events: none;
}
.hero-section .container {
    position: relative;
    z-index: 2;
}

.hero-section h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: .75rem;
    text-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.hero-section p {
    font-size: 1.05rem;
    opacity: .9;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.hero-search {
    max-width: 640px;
    margin: 1.5rem auto 0;
}
.hero-search .input-group {
    box-shadow: 0 4px 20px rgba(0,0,0,.2);
    border-radius: .5rem;
    overflow: hidden;
}
.hero-search .form-control {
    border: 0;
    padding: .85rem 1.25rem;
    font-size: 1rem;
}
.hero-search .btn {
    padding: 0 1.5rem;
    font-weight: 600;
}

.hero-stats {
    margin-top: 2rem;
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}
.hero-stats .stat-item {
    text-align: center;
}
.hero-stats .stat-number {
    display: block;
    font-size: 1.65rem;
    font-weight: 700;
    font-family: 'Roboto', sans-serif;
}
.hero-stats .stat-label {
    font-size: .8rem;
    opacity: .8;
}

/* ===================================================================
   6. SECTION LAYOUT
   =================================================================== */

.section {
    padding: 2.5rem 0;
}
.section-header {
    text-align: center;
    margin-bottom: 2rem;
}
.section-header h2 {
    position: relative;
    display: inline-block;
    padding-bottom: .5rem;
}
.section-header h2::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 3px;
    background: var(--color-accent);
    border-radius: 2px;
}
.section-header p {
    color: var(--color-muted);
    max-width: 560px;
    margin: .75rem auto 0;
}

/* ===================================================================
   7. BUTTONS
   =================================================================== */

.btn {
    font-weight: 600;
    font-size: .9rem;
    border-radius: .4rem;
    padding: .5rem 1.25rem;
    transition: all .2s ease;
}

.btn-primary {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
}
.btn-primary:hover {
    background-color: #1d4ed8;
    border-color: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37,99,235,.35);
}

.btn-secondary {
    background-color: var(--color-secondary);
    border-color: var(--color-secondary);
}
.btn-secondary:hover {
    background-color: #059669;
    border-color: #059669;
}

.btn-accent {
    background-color: var(--color-accent);
    border-color: var(--color-accent);
    color: #111;
}
.btn-accent:hover {
    background-color: #d97706;
    border-color: #d97706;
    color: #111;
}

.btn-outline-primary {
    color: var(--color-primary);
    border-color: var(--color-primary);
}
.btn-outline-primary:hover {
    background-color: var(--color-primary);
    color: #fff;
    transform: translateY(-1px);
}

.btn i {
    margin-right: .35rem;
}

.btn-lg {
    padding: .7rem 1.75rem;
    font-size: 1rem;
}

/* ===================================================================
   8. BADGES
   =================================================================== */

.badge {
    font-weight: 600;
    font-size: .75rem;
    padding: .35em .65em;
    border-radius: 50rem;
}

.badge-status-pending      { background: #fef3c7; color: #92400e; }
.badge-status-open         { background: #dbeafe; color: #1e40af; }
.badge-status-in_progress  { background: #d1fae5; color: #065f46; }
.badge-status-closed       { background: #f3f4f6; color: #374151; }

.badge-app-awaiting        { background: #fef3c7; color: #92400e; }
.badge-app-under_review    { background: #e0e7ff; color: #3730a3; }
.badge-app-eligible        { background: #d1fae5; color: #065f46; }
.badge-app-received        { background: #bfdbfe; color: #1e3a8a; }
.badge-app-failed          { background: #fee2e2; color: #991b1b; }

.badge-format-in-person    { background: #dbeafe; color: #1d4ed8; }
.badge-format-online       { background: #d1fae5; color: #047857; }
.badge-format-both         { background: #fef3c7; color: #b45309; }

/* ===================================================================
   9. SIDEBARS
   =================================================================== */

/* ── Card shell ─────────────────────────────────── */
.sb-card {
    border: 1px solid var(--color-border);
    border-radius: .2rem;   /* ← change border-radius here */
    background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,.07);
    overflow: hidden;
    margin-bottom: .5rem;
}

/* ── Header ─────────────────────────────────────── */
.sb-card__header {
    display: flex;
    align-items: center;
    padding: .6rem .9rem;
}
.sb-card__header h5 {
    margin: 0;
    font-size: .95rem;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: .5rem;
}
.sb-card__header--blue   { background: var(--color-primary); }
.sb-card__header--green  { background: #198754; }
.sb-card__header--yellow { background: var(--color-accent); }
.sb-card__header--yellow h5 { color: #111; }
.sb-card__header--teal   { background: #0891b2; }

/* ── Nav links ──────────────────────────────────── */
.sb-card__menu {
    display: flex;
    flex-direction: column;
}
.sb-card__link {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .55rem .9rem;
    font-size: .88rem;
    color: var(--color-text);
    text-decoration: none;
    border-bottom: 1px solid var(--color-border);
    transition: background .15s, color .15s;
}
.sb-card__link:last-child { border-bottom: none; }
.sb-card__link:hover {
    background: #f0f6ff;
    color: var(--color-primary);
}
.sb-card__link i {
    width: 17px;
    text-align: center;
    flex-shrink: 0;
}

/* ── Icon colours ───────────────────────────────── */
.sb-icon-blue   { color: var(--color-primary); }
.sb-icon-green  { color: #198754; }
.sb-icon-yellow { color: var(--color-accent); }
.sb-icon-teal   { color: #0891b2; }
.sb-icon-red    { color: #ef4444; }

/* ── Body ───────────────────────────────────────── */
.sb-card__body {
    padding: .3rem;
}
.sb-card__empty {
    text-align: center;
    font-size: .85rem;
    color: var(--color-muted);
    margin: 0;
    padding: .25rem 0;
}

/* ── Footer ─────────────────────────────────────── */
.sb-card__footer {
    text-align: center;
    padding: .5rem;
    border-top: 1px solid var(--color-border);
    background: #f9fafb;
}
.sb-card__footer-btn {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .3rem .9rem;
    font-size: .82rem;
    font-weight: 600;
    border-radius: .35rem;
    border: 1px solid;
    text-decoration: none;
    transition: background .2s, color .2s;
}
.sb-card__footer-btn--yellow {
    color: #92400e;
    border-color: var(--color-accent);
}
.sb-card__footer-btn--yellow:hover {
    background: var(--color-accent);
    color: #111;
}
.sb-card__footer-btn--teal {
    color: #0891b2;
    border-color: #0891b2;
}
.sb-card__footer-btn--teal:hover {
    background: #0891b2;
    color: #fff;
}

/* ── Tutor avatar grid (sidebar-left-2) ─────────── */
.sb-tutor-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2px;
}
.sb-tutor-item {
    display: block;
    text-decoration: none;
    overflow: hidden;
    background: #f8f9fa;
}
.sb-tutor-item img {
    width: 100%;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    display: block;
}

/* ── News list (sidebar-right-2) ────────────────── */
.sb-news-item {
    display: flex;
    align-items: flex-start;
    gap: .5rem;
    padding: .5rem;
    border-radius: .35rem;
    text-decoration: none;
    transition: background .15s;
}
.sb-news-item:not(:last-child) {
    border-bottom: 1px solid var(--color-border);
}
.sb-news-item:hover { background: #f0f6ff; }
.sb-news-thumb {
    width: 60px;
    height: 45px;
    object-fit: cover;
    border-radius: .25rem;
    flex-shrink: 0;
}
.sb-news-title {
    margin: 0 0 .25rem;
    font-size: .82rem;
    font-weight: 700;
    color: var(--color-text);
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.sb-news-meta {
    font-size: .75rem;
    color: var(--color-muted);
    display: flex;
    gap: .6rem;
}
.sb-news-meta i { margin-right: .2rem; }

/* ===================================================================
   10. ALERTS & FLASH MESSAGES
   =================================================================== */

.alert {
    border-radius: .5rem;
    font-size: .92rem;
    border: 0;
}
.alert-success {
    background: #ecfdf5;
    color: #065f46;
    border-left: 4px solid var(--color-secondary);
}
.alert-danger {
    background: #fef2f2;
    color: #991b1b;
    border-left: 4px solid #ef4444;
}
.alert-warning {
    background: #fffbeb;
    color: #92400e;
    border-left: 4px solid var(--color-accent);
}
.alert-info {
    background: #eff6ff;
    color: #1e40af;
    border-left: 4px solid var(--color-primary);
}

/* ===================================================================
   11. PAGINATION
   =================================================================== */

.pagination {
    gap: .25rem;
}
.pagination .page-link {
    border: 1px solid var(--color-border);
    color: var(--color-muted);
    font-size: .88rem;
    font-weight: 600;
    border-radius: .35rem !important;
    padding: .4rem .75rem;
    transition: all .2s;
}
.pagination .page-link:hover {
    background: #eff6ff;
    color: var(--color-primary);
    border-color: var(--color-primary);
}
.pagination .page-item.active .page-link {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}

/* ===================================================================
   12. FOOTER
   =================================================================== */

.site-footer {
    background: #111827;
    color: #d1d5db;
    padding: 2.5rem 0 0;
    margin-top: 2rem;
}
.site-footer h5 {
    color: #fff;
    font-size: 1rem;
    margin-bottom: 1rem;
    position: relative;
    padding-bottom: .5rem;
}
.site-footer h5::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 30px;
    height: 2px;
    background: var(--color-accent);
}
.site-footer a {
    color: #9ca3af;
    font-size: .88rem;
    transition: color .2s;
}
.site-footer a:hover {
    color: var(--color-accent);
}
.site-footer .footer-links {
    list-style: none;
    padding: 0;
}
.site-footer .footer-links li {
    margin-bottom: .5rem;
}
.site-footer .footer-links li i {
    width: 16px;
    margin-right: .5rem;
    color: var(--color-accent);
}
.site-footer .footer-bottom {
    background: #0f172a;
    padding: 1rem 0;
    margin-top: 2rem;
    text-align: center;
    font-size: .82rem;
    color: #6b7280;
}
.site-footer .social-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,.08);
    color: #d1d5db;
    margin-right: .5rem;
    transition: all .2s;
}
.site-footer .social-links a:hover {
    background: var(--color-primary);
    color: #fff;
    transform: translateY(-2px);
}

/* ===================================================================
   13. MISCELLANEOUS UTILITIES
   =================================================================== */

.bg-gradient-primary {
    background: linear-gradient(135deg, #1e3a8a, var(--color-primary), #3b82f6) !important;
}
.bg-gradient-secondary {
    background: linear-gradient(135deg, #065f46, var(--color-secondary), #34d399) !important;
}

.shadow-hover {
    transition: box-shadow .3s ease;
}
.shadow-hover:hover {
    box-shadow: 0 8px 24px rgba(0,0,0,.12);
}

.border-left-primary { border-left: 4px solid var(--color-primary) !important; }
.border-left-secondary { border-left: 4px solid var(--color-secondary) !important; }
.border-left-accent { border-left: 4px solid var(--color-accent) !important; }

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cursor-pointer { cursor: pointer; }

/* Scrollbar (Webkit) */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--color-bg); }
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* Smooth scroll */
html {
    scroll-behavior: smooth;
}

/* Loading skeleton */
.skeleton {
    background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: .35rem;
}
@keyframes shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* Back-to-top button */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--color-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: all .3s ease;
    z-index: 1020;
    box-shadow: 0 4px 12px rgba(37,99,235,.35);
    cursor: pointer;
    border: 0;
}
.back-to-top.visible {
    opacity: 1;
    visibility: visible;
}
.back-to-top:hover {
    background: #1d4ed8;
    transform: translateY(-3px);
}
