/* =====================================================
   คลังสื่อ AI เพื่อการเรียนรู้
   Custom Stylesheet - Bootstrap Blue Theme
   ===================================================== */

:root {
    --rac-blue:       #0d6efd;
    --rac-dark-blue:  #0a58ca;
    --rac-navy:       #0a3055;
    --rac-light-blue: #cfe2ff;
    --rac-bg:         #f0f6ff;
}

/* =====================================================
   Global
   ===================================================== */
body {
    font-family: 'Sarabun', sans-serif;
    background-color: var(--rac-bg);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    font-size: 1rem;
}

a { color: var(--rac-blue); }
a:hover { color: var(--rac-dark-blue); }

/* =====================================================
   Navbar
   ===================================================== */
.navbar {
    background: linear-gradient(135deg, #0a3055 0%, #0d6efd 100%) !important;
    box-shadow: 0 2px 12px rgba(13,110,253,.25);
}
.navbar-brand { font-size: 1.1rem; letter-spacing: .02em; }
.navbar .form-control:focus { box-shadow: 0 0 0 3px rgba(255,255,255,.3); }

/* =====================================================
   Footer
   ===================================================== */
.footer-main {
    background: linear-gradient(135deg, #0a3055 0%, #0d6efd 100%);
    margin-top: auto;
}
.footer-link:hover { color: #fff !important; }

/* =====================================================
   Hero Section
   ===================================================== */
.hero-section {
    background: linear-gradient(135deg, #0a3055 0%, #1565c0 50%, #0d6efd 100%);
    color: #fff;
    padding: 70px 0 50px;
    position: relative;
    overflow: hidden;
}
.hero-section::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0; right: 0;
    height: 60px;
    background: var(--rac-bg);
    clip-path: ellipse(60% 100% at 50% 100%);
}
.hero-badge {
    background: rgba(255,255,255,.15);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,.3);
    display: inline-block;
    padding: .35rem .9rem;
    border-radius: 999px;
    font-size: .85rem;
    margin-bottom: 1rem;
}
.hero-title { font-size: clamp(1.8rem, 4vw, 2.8rem); font-weight: 700; line-height: 1.2; }
.hero-subtitle { font-size: 1.1rem; opacity: .9; }
.hero-search .form-control { border: none; border-radius: 12px 0 0 12px; font-size: 1rem; padding: .75rem 1.25rem; }
.hero-search .btn   { border-radius: 0 12px 12px 0; padding: .75rem 1.5rem; }
.stat-box {
    background: rgba(255,255,255,.12);
    border: 1px solid rgba(255,255,255,.2);
    border-radius: 12px;
    padding: 1rem;
    backdrop-filter: blur(4px);
    text-align: center;
}
.stat-box .stat-num { font-size: 1.8rem; font-weight: 700; }

/* =====================================================
   Category Cards
   ===================================================== */
.category-card {
    border: none;
    border-radius: 16px;
    transition: transform .2s, box-shadow .2s;
    overflow: hidden;
    cursor: pointer;
}
.category-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 30px rgba(13,110,253,.2);
}
.cat-icon-wrap {
    width: 64px; height: 64px;
    border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    font-size: 2rem;
    margin: 0 auto 1rem;
}

/* =====================================================
   Media Cards
   ===================================================== */
.media-card {
    border: none;
    border-radius: 14px;
    box-shadow: 0 2px 10px rgba(0,0,0,.07);
    transition: transform .2s, box-shadow .2s;
    overflow: hidden;
    height: 100%;
}
.media-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 25px rgba(13,110,253,.15);
}
.media-card .card-img-container {
    position: relative;
    padding-top: 56.25%;
    background: #e9ecef;
    overflow: hidden;
}
.media-card .card-img-container img,
.media-card .card-img-container .media-icon-placeholder {
    position: absolute;
    inset: 0;
    width: 100%; height: 100%;
    object-fit: cover;
}
.media-card .media-icon-placeholder {
    display: flex; align-items: center; justify-content: center;
    font-size: 3.5rem;
    color: #adb5bd;
    background: #f8f9fa;
}
.media-badge-overlay {
    position: absolute;
    top: 8px; right: 8px;
}
.media-card .card-title {
    font-size: .95rem;
    font-weight: 600;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.8em;
}
.media-card .card-body { padding: .85rem; }

/* =====================================================
   Sidebar Filters
   ===================================================== */
.filter-card {
    border: none;
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(0,0,0,.07);
}
.filter-card .card-header {
    background: linear-gradient(135deg, #0a3055, #0d6efd);
    color: #fff;
    border-radius: 14px 14px 0 0 !important;
    font-weight: 600;
}
.filter-list-item { cursor: pointer; border-radius: 8px; transition: background .15s; }
.filter-list-item:hover { background: #e7f0ff; }
.filter-list-item.active { background: var(--rac-light-blue); color: var(--rac-dark-blue); font-weight: 600; }

/* =====================================================
   Admin / Dashboard
   ===================================================== */
.sidebar-admin {
    min-height: calc(100vh - 60px);
    background: linear-gradient(180deg, #0a3055 0%, #0d6efd 100%);
    padding-top: 1rem;
}
.sidebar-admin .nav-link {
    color: rgba(255,255,255,.75);
    border-radius: 8px;
    margin: 2px 8px;
    padding: .55rem 1rem;
    transition: background .15s, color .15s;
}
.sidebar-admin .nav-link:hover,
.sidebar-admin .nav-link.active {
    background: rgba(255,255,255,.15);
    color: #fff;
}
.sidebar-admin .nav-link i { width: 22px; text-align: center; }

.stat-widget {
    border: none;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 3px 12px rgba(0,0,0,.08);
}
.stat-widget .stat-icon {
    width: 56px; height: 56px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.6rem;
}
.stat-widget .stat-value { font-size: 2rem; font-weight: 700; }
.stat-widget .stat-label { font-size: .85rem; color: #6c757d; }

/* =====================================================
   Forms
   ===================================================== */
.auth-card {
    border: none;
    border-radius: 20px;
    box-shadow: 0 8px 30px rgba(13,110,253,.15);
    overflow: hidden;
}
.auth-header {
    background: linear-gradient(135deg, #0a3055, #0D6EFD);
    color: #fff;
    padding: 2rem;
    text-align: center;
}
.form-control:focus { border-color: var(--rac-blue); box-shadow: 0 0 0 3px rgba(13,110,253,.15); }
.form-select:focus  { border-color: var(--rac-blue); box-shadow: 0 0 0 3px rgba(13,110,253,.15); }

/* =====================================================
   Media View Page
   ===================================================== */
.media-player-wrap {
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    aspect-ratio: 16/9;
    display: flex; align-items: center; justify-content: center;
}
.media-player-wrap iframe,
.media-player-wrap video {
    width: 100%; height: 100%; border: none;
}
.media-info-card {
    border: none;
    border-radius: 14px;
    box-shadow: 0 2px 10px rgba(0,0,0,.07);
}

/* =====================================================
   Profile
   ===================================================== */
.profile-avatar-wrap {
    position: relative;
    width: 120px; height: 120px;
    margin: 0 auto 1rem;
}
.profile-avatar-wrap img {
    width: 120px; height: 120px;
    object-fit: cover;
    border-radius: 50%;
    border: 4px solid var(--rac-blue);
}
.profile-avatar-wrap .avatar-edit-btn {
    position: absolute;
    bottom: 4px; right: 4px;
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--rac-blue);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: .85rem;
    border: 2px solid #fff;
    cursor: pointer;
}

/* =====================================================
   Misc
   ===================================================== */
.section-title {
    font-weight: 700;
    color: #0a3055;
    position: relative;
    padding-left: .85rem;
}
.section-title::before {
    content: '';
    position: absolute;
    left: 0; top: .15em; bottom: .1em;
    width: 5px;
    background: var(--rac-blue);
    border-radius: 3px;
}
.tag-badge {
    background: var(--rac-light-blue);
    color: var(--rac-dark-blue);
    border-radius: 999px;
    padding: .2rem .7rem;
    font-size: .8rem;
    text-decoration: none;
    display: inline-block;
    margin: 2px;
    transition: background .15s;
}
.tag-badge:hover { background: var(--rac-blue); color: #fff; }

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #adb5bd;
}
.empty-state i { font-size: 5rem; margin-bottom: 1rem; display: block; }

/* =====================================================
   Scrollbar
   ===================================================== */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #f0f6ff; }
::-webkit-scrollbar-thumb { background: #c5d8f8; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--rac-blue); }

/* =====================================================
   Responsive tweaks
   ===================================================== */
@media (max-width: 768px) {
    .hero-section { padding: 40px 0 40px; }
    .stat-box { margin-bottom: .5rem; }
}
