/* =====================================================
   NP Sport — ระบบกีฬาภายในโรงเรียนหนองไผ่
   Main Stylesheet
   ===================================================== */

:root {
    --primary: #c2185b;
    --primary-light: #e91e63;
    --primary-dark: #880e4f;
    --accent: #ff6f00;
    --accent-light: #ffa040;
    --gold: #FFD700;
    --gold-bg: #FFF8E1;
    --silver: #C0C0C0;
    --silver-bg: #F5F5F5;
    --bronze: #CD7F32;
    --bronze-bg: #FFF3E0;
    --success: #2e7d32;
    --danger: #c62828;
    --bg-body: #f0f2f5;
    --bg-card: #ffffff;
    --text-primary: #1a1a2e;
    --text-secondary: #64748b;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.12);
    --shadow-xl: 0 20px 60px rgba(0,0,0,0.15);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Prompt', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* =====================================================
   Navbar
   ===================================================== */
.bg-dark-gradient {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%) !important;
    box-shadow: var(--shadow-md);
}

.navbar-brand {
    font-size: 1.3rem;
    letter-spacing: 0.5px;
}

.navbar .nav-link {
    font-weight: 400;
    padding: 0.5rem 1rem !important;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.navbar .nav-link:hover {
    background: rgba(255,255,255,0.1);
}

.dropdown-menu-dark {
    background: var(--primary-dark);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
}

/* =====================================================
   Hero Section
   ===================================================== */
.hero-section {
    position: relative;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 40%, var(--primary-light) 100%);
    padding: 60px 0 80px;
    overflow: hidden;
    color: #fff;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(255,165,0,0.15) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.hero-section::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -10%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(57,73,171,0.3) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.hero-badge {
    display: inline-block;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    padding: 6px 20px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 500;
    letter-spacing: 1px;
    text-transform: uppercase;
    border: 1px solid rgba(255,255,255,0.2);
}

.hero-title {
    font-size: 2.2rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 15px;
    text-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.hero-subtitle {
    font-size: 1rem;
    font-weight: 300;
    opacity: 0.9;
    margin-bottom: 5px;
}

@media (max-width: 768px) {
    .hero-section {
        padding: 40px 0 60px;
    }
    .hero-title {
        font-size: 1.5rem;
    }
}

/* =====================================================
   Stats Section
   ===================================================== */
.stats-section {
    margin-top: -40px;
    position: relative;
    z-index: 10;
    padding-bottom: 20px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 20px;
    text-align: center;
    box-shadow: var(--shadow-md);
    transition: var(--transition);
    border: 1px solid rgba(0,0,0,0.04);
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    font-size: 1.8rem;
    color: var(--primary);
    margin-bottom: 8px;
}

.stat-card-success .stat-icon { color: var(--success); }
.stat-card-warning .stat-icon { color: var(--accent); }

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

@media (max-width: 768px) {
    .stat-card { padding: 15px 10px; }
    .stat-number { font-size: 1.5rem; }
    .stat-icon { font-size: 1.4rem; }
}

/* =====================================================
   Medal Section
   ===================================================== */
.medal-section {
    padding: 40px 0;
}

.section-header {
    margin-bottom: 30px;
}

.section-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
}

.section-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 2px;
    font-weight: 300;
}

.medal-table-wrapper {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(0,0,0,0.04);
}

.medal-table {
    margin-bottom: 0;
}

.medal-table thead {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: #fff;
}

.medal-table thead th {
    border: none;
    padding: 16px 12px;
    font-weight: 500;
    font-size: 0.85rem;
    vertical-align: middle;
}

.medal-header {
    font-size: 1.5rem;
    line-height: 1;
    margin-bottom: 2px;
}

.medal-col {
    width: 80px;
}

.medal-table tbody tr {
    transition: var(--transition);
}

.medal-table tbody tr:hover {
    background: rgba(26,35,126,0.03);
}

.medal-table tbody td {
    padding: 14px 12px;
    vertical-align: middle;
    border-bottom: 1px solid rgba(0,0,0,0.04);
}

.medal-row.rank-1 {
    background: linear-gradient(90deg, var(--gold-bg) 0%, transparent 100%);
}

.rank-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-weight: 700;
    font-size: 0.85rem;
    color: #fff;
}

.rank-1 { background: linear-gradient(135deg, #FFD700, #FFA000); color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.3); }
.rank-2 { background: linear-gradient(135deg, #B0BEC5, #78909C); color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.3); }
.rank-3 { background: linear-gradient(135deg, #CD7F32, #A0522D); color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.3); }
.rank-4, .rank-other { 
    background: linear-gradient(135deg, #f8fafc, #e2e8f0); 
    color: #334155; 
    border: 1.5px solid #cbd5e1; 
    box-shadow: 0 1px 3px rgba(0,0,0,0.08); 
    font-weight: 700;
}

.team-color-dot {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    margin-right: 8px;
    vertical-align: middle;
    border: 2px solid rgba(0,0,0,0.1);
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.medal-gold { color: #b8860b; }
.medal-silver { color: #71717a; }
.medal-bronze { color: #92400e; }
.medal-total { color: var(--primary); }

@media (max-width: 576px) {
    .medal-col { width: 42px !important; min-width: 38px !important; padding: 6px 2px !important; }
    .medal-col small { font-size: 0.72rem !important; }
    .medal-header { font-size: 1.1rem !important; margin-bottom: 0px !important; }
    .medal-table thead th { padding: 6px 2px !important; }
    .medal-table tbody td { padding: 8px 3px !important; font-size: 0.9rem !important; }
    .medal-num, .total-num { font-size: 0.95rem !important; }
    .rank-cell { width: 30px !important; padding: 6px 2px !important; }
    .rank-badge { width: 24px; height: 24px; font-size: 0.72rem; }
    .team-cell { padding: 8px 2px !important; }
    .team-banner-wrap { gap: 6px !important; }
    .team-circle-badge { width: 26px !important; height: 26px !important; }
    .team-gradient-strip { height: 30px !important; padding-left: 8px !important; padding-right: 15px !important; }
    .team-gradient-strip span { font-size: 0.95rem !important; }
}

/* =====================================================
   Quick Link Cards
   ===================================================== */
.quick-link-card {
    display: block;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 30px 24px;
    text-align: center;
    text-decoration: none;
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(0,0,0,0.04);
    transition: var(--transition);
}

.quick-link-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-xl);
    color: var(--primary);
    border-color: var(--primary-light);
}

.quick-link-icon {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 12px;
}

.quick-link-card h5 {
    font-weight: 600;
    margin-bottom: 8px;
}

.quick-link-card p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0;
}

/* =====================================================
   Footer
   ===================================================== */
.site-footer {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    color: rgba(255,255,255,0.85);
    padding: 24px 0;
    margin-top: 40px;
}

/* =====================================================
   Award Badges
   ===================================================== */
.award-gold {
    background: linear-gradient(135deg, #FFD700, #FFA000);
    color: #fff;
    padding: 3px 10px;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 500;
}

.award-silver {
    background: linear-gradient(135deg, #B0BEC5, #78909C);
    color: #fff;
    padding: 3px 10px;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 500;
}

.award-bronze {
    background: linear-gradient(135deg, #CD7F32, #A0522D);
    color: #fff;
    padding: 3px 10px;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* =====================================================
   Flash Messages
   ===================================================== */
.flash-message {
    border-radius: var(--radius-md);
    padding: 14px 20px;
    margin-bottom: 20px;
    border: none;
    box-shadow: var(--shadow-sm);
}

/* =====================================================
   Search Page
   ===================================================== */
.search-hero {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    padding: 50px 0;
    color: #fff;
}

.search-input-wrapper {
    position: relative;
    max-width: 500px;
    margin: 0 auto;
}

.search-input-wrapper input {
    padding: 14px 20px 14px 50px;
    border-radius: 50px;
    border: 2px solid rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    color: #fff;
    font-size: 1rem;
    width: 100%;
    transition: var(--transition);
}

.search-input-wrapper input::placeholder {
    color: rgba(255,255,255,0.6);
}

.search-input-wrapper input:focus {
    outline: none;
    border-color: var(--accent);
    background: rgba(255,255,255,0.25);
}

.search-input-wrapper .search-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
    color: rgba(255,255,255,0.6);
}

/* =====================================================
   Result Cards
   ===================================================== */
.result-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(0,0,0,0.04);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.result-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.result-card .player-info {
    flex: 1;
}

.result-card .player-name {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 2px;
}

.result-card .player-detail {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.btn-download-cert {
    background: linear-gradient(135deg, var(--success), #388e3c);
    color: #fff;
    border: none;
    padding: 8px 20px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-download-cert:hover {
    background: linear-gradient(135deg, #388e3c, #1b5e20);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(46,125,50,0.3);
}

/* =====================================================
   Animations
   ===================================================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.medal-row {
    animation: fadeInUp 0.4s ease forwards;
}

.medal-row:nth-child(1) { animation-delay: 0.05s; }
.medal-row:nth-child(2) { animation-delay: 0.1s; }
.medal-row:nth-child(3) { animation-delay: 0.15s; }
.medal-row:nth-child(4) { animation-delay: 0.2s; }
.medal-row:nth-child(5) { animation-delay: 0.25s; }
.medal-row:nth-child(6) { animation-delay: 0.3s; }

.stat-card {
    animation: fadeInUp 0.5s ease forwards;
}

.stat-card:nth-child(1) { animation-delay: 0.1s; }
.stat-card:nth-child(2) { animation-delay: 0.2s; }
.stat-card:nth-child(3) { animation-delay: 0.3s; }
.stat-card:nth-child(4) { animation-delay: 0.4s; }

/* =====================================================
   Footer & Compact 2-Line Layout
   ===================================================== */
.site-footer {
    background: linear-gradient(135deg, #c2185b, #880e4f);
    color: #ffffff;
    padding: 12px 0 !important;
    margin-top: 30px;
    border-top: 2px solid rgba(255, 255, 255, 0.12);
}

.footer-school-block {
    line-height: 1.35;
}

/* Counter Widget Styling & Right Alignment */
.counter-widget-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    gap: 2px;
    width: 100%;
    text-align: right;
    line-height: 1.2;
}

.counter-widget-box {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    line-height: 1 !important;
}

#sfct8d7esnthk7uehztyg25426333ldju1h,
#sfch1qt1g4ucmhsz2zzy3h2zta9mpxqrw2c {
    display: inline-flex !important;
    align-items: center !important;
    line-height: 1 !important;
    margin: 0 !important;
    padding: 0 !important;
}

#sfct8d7esnthk7uehztyg25426333ldju1h br,
#sfch1qt1g4ucmhsz2zzy3h2zta9mpxqrw2c br {
    display: none !important;
}

#sfct8d7esnthk7uehztyg25426333ldju1h a:not(:first-child),
#sfch1qt1g4ucmhsz2zzy3h2zta9mpxqrw2c a:not(:first-child) {
    display: none !important;
}

.counter-widget-box img,
#sfct8d7esnthk7uehztyg25426333ldju1h img,
#sfct8d7esnthk7uehztyg25426333ldju1h a img,
#sfch1qt1g4ucmhsz2zzy3h2zta9mpxqrw2c img,
#sfch1qt1g4ucmhsz2zzy3h2zta9mpxqrw2c a img {
    height: 22px !important;
    max-height: 22px !important;
    width: auto !important;
    display: block !important;
    background: transparent !important;
    border: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

.counter-credit-link,
.counter-credit-link:link,
.counter-credit-link:visited,
.counter-credit-link:hover,
.counter-credit-link:active,
.counter-credit-link:focus {
    color: #ffffff !important;
    text-decoration: none !important;
    font-weight: 400 !important;
    outline: none !important;
    box-shadow: none !important;
    opacity: 0.95;
}
.counter-credit-link:hover {
    opacity: 1;
}

@media (max-width: 767.98px) {
    .counter-widget-wrap {
        align-items: center !important;
        text-align: center !important;
        margin-top: 6px;
    }
}
