/* assets/css/style.css */

:root {
    --primary: #1a3a5c;
    --primary-light: #2563a8;
    --secondary: #f59e0b;
    --accent: #10b981;
    --danger: #ef4444;
    --bg-light: #f0f4f8;
    --card-shadow: 0 4px 24px rgba(26,58,92,.10);
    --card-hover-shadow: 0 8px 40px rgba(26,58,92,.18);
    --radius: 14px;
    --radius-sm: 8px;
    --font-th: 'Sarabun', sans-serif;
}

*, body { font-family: var(--font-th); }

/* ======= NAVBAR ======= */
#mainNav {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    box-shadow: 0 2px 20px rgba(26,58,92,.3);
    padding: .75rem 0;
}
.brand-icon {
    width: 38px; height: 38px;
    background: linear-gradient(135deg, var(--secondary), #f97316);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem; color: white;
    box-shadow: 0 2px 8px rgba(245,158,11,.4);
}
.navbar-brand span { font-size: 1.1rem; font-weight: 600; }

/* ======= MAIN CONTENT ======= */
.main-content { min-height: calc(100vh - 160px); background: var(--bg-light); }

/* ======= HERO SECTION ======= */
.hero-section {
    background: linear-gradient(135deg, var(--primary) 0%, #1e5799 50%, var(--primary-light) 100%);
    color: white; padding: 3.5rem 0;
    position: relative; overflow: hidden;
}
.hero-section::before {
    content: '';
    position: absolute; top: -50%; right: -10%;
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(245,158,11,.15) 0%, transparent 70%);
    border-radius: 50%;
}
.hero-section::after {
    content: '';
    position: absolute; bottom: -30%; left: -5%;
    width: 400px; height: 400px;
    background: radial-gradient(circle, rgba(16,185,129,.10) 0%, transparent 70%);
    border-radius: 50%;
}
.hero-section .container { position: relative; z-index: 1; }
.hero-title { font-size: 2.2rem; font-weight: 700; margin-bottom: .5rem; }
.hero-subtitle { font-size: 1.05rem; opacity: .85; }
.hero-stats { display: flex; gap: 2rem; margin-top: 1.5rem; }
.stat-item { text-align: center; }
.stat-number { font-size: 2rem; font-weight: 700; color: var(--secondary); line-height: 1; }
.stat-label { font-size: .78rem; opacity: .8; margin-top: .2rem; }

/* ======= CARDS ======= */
.cert-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    transition: transform .25s ease, box-shadow .25s ease;
    overflow: hidden;
    border: none;
    height: 100%;
}
.cert-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--card-hover-shadow);
}
.cert-card-header {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    padding: 1.4rem 1.4rem 1rem;
    position: relative;
}
.cert-card-header .cert-icon {
    width: 52px; height: 52px;
    background: rgba(255,255,255,.15);
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.6rem; color: var(--secondary);
    backdrop-filter: blur(4px);
}
.cert-card-header .cert-category-badge {
    position: absolute; top: 1rem; right: 1rem;
    background: rgba(255,255,255,.2);
    color: white; font-size: .7rem;
    padding: .25rem .7rem; border-radius: 20px;
    backdrop-filter: blur(4px);
}
.cert-card-body { padding: 1.2rem 1.4rem; flex: 1; }
.cert-card-title { font-size: 1rem; font-weight: 600; color: var(--primary); margin-bottom: .5rem; line-height: 1.4; }
.cert-card-desc { font-size: .85rem; color: #64748b; margin-bottom: .75rem; }
.cert-meta { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .75rem; }
.cert-meta-item { font-size: .75rem; color: #94a3b8; display: flex; align-items: center; gap: .3rem; }
.cert-card-footer {
    padding: 1rem 1.4rem;
    background: #f8fafc;
    border-top: 1px solid #f1f5f9;
}

/* ======= SECTION TITLE ======= */
.section-title {
    font-size: 1.4rem; font-weight: 700;
    color: var(--primary); margin-bottom: 1.5rem;
    display: flex; align-items: center; gap: .6rem;
}
.section-title::after {
    content: '';
    flex: 1; height: 2px;
    background: linear-gradient(to right, var(--secondary), transparent);
    margin-left: .5rem;
}

/* ======= SEARCH BAR ======= */
.search-bar-wrapper {
    background: white;
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--card-shadow);
    margin-bottom: 2rem;
}
.search-input-group { position: relative; }
.search-input-group .form-control {
    padding-left: 3rem;
    border-radius: 40px;
    border: 2px solid #e2e8f0;
    font-size: 1rem; height: 50px;
    transition: border-color .2s;
}
.search-input-group .form-control:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 .2rem rgba(37,99,168,.15);
}
.search-icon {
    position: absolute; left: 1rem; top: 50%;
    transform: translateY(-50%); color: #94a3b8; z-index: 4;
}
.filter-select {
    border-radius: 40px; border: 2px solid #e2e8f0;
    padding: .5rem 1rem; height: 50px;
    color: var(--primary); font-weight: 500;
    transition: border-color .2s;
}
.filter-select:focus { border-color: var(--primary-light); box-shadow: none; }

/* ======= BUTTONS ======= */
.btn-download {
    background: linear-gradient(135deg, var(--accent), #059669);
    color: white; border: none;
    border-radius: 40px;
    padding: .5rem 1.2rem; font-size: .85rem; font-weight: 600;
    transition: all .2s;
    display: flex; align-items: center; justify-content: center; gap: .4rem; text-decoration: none;
}
.btn-download:hover { transform: scale(1.03); box-shadow: 0 4px 15px rgba(16,185,129,.4); color: white; }

.btn-primary-custom {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white; border: none; border-radius: var(--radius-sm);
    padding: .6rem 1.5rem; font-weight: 600;
    transition: all .2s;
}
.btn-primary-custom:hover { opacity: .9; transform: translateY(-1px); color: white; }

/* ======= ADMIN PANEL ======= */
.admin-sidebar {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--card-shadow);
    overflow: hidden;
}
.admin-sidebar .sidebar-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white; padding: 1.25rem 1.5rem;
}
.admin-sidebar .nav-link {
    color: #475569; padding: .75rem 1.5rem;
    display: flex; align-items: center; gap: .75rem;
    font-weight: 500; transition: all .15s;
    border-left: 3px solid transparent;
}
.admin-sidebar .nav-link:hover,
.admin-sidebar .nav-link.active {
    background: #f0f4f8; color: var(--primary);
    border-left-color: var(--primary-light);
}
.admin-sidebar .nav-link i { width: 20px; text-align: center; }

.stat-card {
    background: white; border-radius: var(--radius);
    box-shadow: var(--card-shadow); padding: 1.5rem;
    display: flex; align-items: center; gap: 1.2rem;
    transition: transform .2s;
}
.stat-card:hover { transform: translateY(-3px); }
.stat-card-icon {
    width: 56px; height: 56px; border-radius: 14px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem;
}
.stat-card-icon.blue { background: #dbeafe; color: #2563eb; }
.stat-card-icon.green { background: #d1fae5; color: #059669; }
.stat-card-icon.yellow { background: #fef3c7; color: #d97706; }
.stat-card-icon.red { background: #fee2e2; color: #dc2626; }
.stat-card-value { font-size: 1.8rem; font-weight: 700; color: var(--primary); line-height: 1; }
.stat-card-label { color: #64748b; font-size: .85rem; }

/* ======= TABLE ======= */
.table-custom { background: white; border-radius: var(--radius); overflow: hidden; box-shadow: var(--card-shadow); }
.table-custom thead th {
    background: var(--primary); color: white;
    font-weight: 600; border: none; padding: 1rem 1.25rem;
}
.table-custom tbody td { padding: .85rem 1.25rem; vertical-align: middle; border-color: #f1f5f9; }
.table-custom tbody tr:hover { background: #f8fafc; }

/* ======= UPLOAD ZONE ======= */
.upload-zone {
    border: 2.5px dashed #cbd5e1;
    border-radius: var(--radius);
    padding: 2.5rem;
    text-align: center; cursor: pointer;
    transition: all .2s; background: #f8fafc;
}
.upload-zone:hover, .upload-zone.drag-over {
    border-color: var(--primary-light);
    background: #eff6ff;
}
.upload-zone .upload-icon { font-size: 3rem; color: #94a3b8; margin-bottom: .75rem; }

/* ======= BADGES ======= */
.badge-public { background: #d1fae5; color: #065f46; }
.badge-private { background: #fee2e2; color: #991b1b; }

/* ======= PAGINATION ======= */
.pagination .page-link {
    color: var(--primary); border-radius: var(--radius-sm) !important;
    margin: 0 2px; border: none;
    background: white; box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.pagination .page-item.active .page-link {
    background: var(--primary); color: white;
}

/* ======= AUTH PAGES ======= */
.auth-wrapper {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
    display: flex; align-items: center; justify-content: center; padding: 2rem;
}
.auth-card {
    background: white; border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
    padding: 2.5rem; width: 100%; max-width: 440px;
}
.auth-logo { text-align: center; margin-bottom: 2rem; }
.auth-logo .logo-icon {
    width: 72px; height: 72px;
    background: linear-gradient(135deg, var(--secondary), #f97316);
    border-radius: 18px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 2rem; color: white;
    box-shadow: 0 8px 20px rgba(245,158,11,.4);
    margin-bottom: 1rem;
}
.form-label { font-weight: 600; color: var(--primary); font-size: .9rem; }
.form-control, .form-select {
    border-radius: var(--radius-sm);
    border: 1.5px solid #e2e8f0;
    padding: .6rem 1rem;
    transition: border-color .2s;
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 .2rem rgba(37,99,168,.12);
}

/* ======= FOOTER ======= */
.footer { background: white; border-top: 1px solid #e2e8f0; }

/* ======= EMPTY STATE ======= */
.empty-state { text-align: center; padding: 4rem 2rem; color: #94a3b8; }
.empty-state i { font-size: 4rem; margin-bottom: 1rem; display: block; }

/* ======= PDF PREVIEW BADGE ======= */
.pdf-badge {
    display: inline-flex; align-items: center; gap: .3rem;
    background: #fee2e2; color: #dc2626;
    font-size: .7rem; font-weight: 700;
    padding: .2rem .6rem; border-radius: 4px; letter-spacing: .5px;
}

/* ======= RESPONSIVE ======= */
@media (max-width: 768px) {
    .hero-title { font-size: 1.6rem; }
    .hero-stats { gap: 1.5rem; }
    .stat-number { font-size: 1.6rem; }
}

/* PDF Preview Modal */
#pdfPreviewModal .modal-content { border-radius: 12px; overflow: hidden; display:flex; flex-direction:column; }
#pdfPreviewModal .modal-header { background: #f8fafc; border-bottom: 1px solid #e9ecef; }
#pdfPreviewModal .modal-body { flex: 1; }
