/* ======================================================
   TeleBid — Shared Pages Stylesheet (Apple White Theme)
   Used by: stats.php, rules.php, about.php
   ====================================================== */

:root {
    --bg-color: #ffffff;
    --bg-secondary: #f5f5f7;
    --text-main: #1d1d1f;
    --text-muted: #86868b;
    --border-color: #d2d2d7;
    --accent: #0071e3;
    --accent-hover: #0077ed;
    --card-shadow: 0 2px 8px rgba(0,0,0,0.04), 0 1px 3px rgba(0,0,0,0.06);
    --card-shadow-hover: 0 12px 40px rgba(0,0,0,0.1), 0 4px 12px rgba(0,0,0,0.06);
    --radius: 14px;
    --radius-sm: 10px;
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-smooth: cubic-bezier(0.4, 0, 0, 1);
    --duration: 0.35s;
    --duration-fast: 0.2s;
    --duration-slow: 0.5s;
}

/* ===== Keyframes ===== */
@keyframes pageIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes cardIn {
    from { opacity: 0; transform: translateY(16px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes barGrow {
    from { transform: scaleY(0); }
    to { transform: scaleY(1); }
}
@keyframes shimmer {
    from { background-position: -200% 0; }
    to { background-position: 200% 0; }
}
@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 0 0 rgba(0,113,227,0.15); }
    50% { box-shadow: 0 0 0 8px rgba(0,113,227,0); }
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
html, body { overflow-x: hidden; }
body { 
    font-family: var(--font-family); 
    background-color: var(--bg-color); 
    color: var(--text-main); 
    line-height: 1.6; 
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; height: auto; }

/* ===== Navbar ===== */
.navbar { 
    border-bottom: 1px solid var(--border-color); 
    padding: 0 24px; 
    height: 60px; 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    background: rgba(255,255,255,0.72); 
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    position: sticky; 
    top: 0; 
    z-index: 100;
    transition: background var(--duration-slow) var(--ease-smooth);
}
.nav-brand { 
    font-weight: 700; 
    font-size: 1.2rem; 
    display: flex; 
    align-items: center; 
    gap: 8px; 
    text-decoration: none; 
    color: var(--text-main);
    transition: transform var(--duration) var(--ease-spring), opacity var(--duration-fast);
}
.nav-brand:hover { transform: scale(0.97); opacity: 0.8; }
.nav-brand img { border-radius: 6px; transition: transform var(--duration) var(--ease-spring); }
.nav-brand:hover img { transform: rotate(-8deg) scale(1.1); }
.nav-links { display: flex; gap: 28px; font-size: 0.9rem; font-weight: 500; }
.nav-links a { 
    color: var(--text-muted); 
    transition: color var(--duration-fast) var(--ease-smooth);
    position: relative;
    padding: 4px 0;
}
.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--accent);
    border-radius: 1px;
    transform: scaleX(0);
    transform-origin: right;
    transition: transform var(--duration) var(--ease-out);
}
.nav-links a:hover { color: var(--accent); }
.nav-links a:hover::after { transform: scaleX(1); transform-origin: left; }
.nav-actions { display: flex; gap: 16px; align-items: center; }
.nav-actions a { transition: transform var(--duration) var(--ease-spring), opacity var(--duration-fast); }
.nav-actions a:hover { opacity: 0.7; transform: translateX(-2px); }

/* ===== Page Container ===== */
.page-container { 
    max-width: 1100px; 
    margin: 0 auto; 
    padding: 48px 24px 60px;
    animation: pageIn 0.6s var(--ease-out) both;
}
.page-header { text-align: center; margin-bottom: 40px; animation: pageIn 0.5s var(--ease-out) 0.1s both; }
.page-header h1 { font-size: 2.2rem; font-weight: 700; margin-bottom: 10px; letter-spacing: -0.02em; }
.page-header p { color: var(--text-muted); font-size: 1.05rem; }

/* ===== Cards ===== */
.card { 
    background: rgba(255,255,255,0.8); 
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(0,0,0,0.05); 
    border-radius: var(--radius); 
    padding: 24px; 
    box-shadow: var(--card-shadow);
    transition: 
        box-shadow var(--duration) var(--ease-out), 
        transform var(--duration) var(--ease-spring), 
        border-color var(--duration-slow) var(--ease-smooth);
    animation: cardIn 0.5s var(--ease-out) both;
}
.card:hover { 
    box-shadow: var(--card-shadow-hover); 
    transform: translateY(-4px);
    border-color: rgba(0,113,227,0.1);
}
.card h3 { 
    font-size: 1.05rem; 
    font-weight: 600; 
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Staggered card entrance */
.grid-2 > :nth-child(1), .grid-auto > :nth-child(1) { animation-delay: 0.05s; }
.grid-2 > :nth-child(2), .grid-auto > :nth-child(2) { animation-delay: 0.1s; }
.grid-2 > :nth-child(3), .grid-auto > :nth-child(3) { animation-delay: 0.15s; }
.grid-2 > :nth-child(4), .grid-auto > :nth-child(4) { animation-delay: 0.2s; }
.grid-auto > :nth-child(5) { animation-delay: 0.25s; }
.grid-auto > :nth-child(6) { animation-delay: 0.3s; }

/* ===== Grids ===== */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-bottom: 24px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 24px; }

/* ===== Rule Cards ===== */
.rule-card { 
    background: rgba(255,255,255,0.8); 
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(0,0,0,0.05); 
    border-radius: var(--radius); 
    padding: 28px; 
    box-shadow: var(--card-shadow);
    transition: 
        box-shadow var(--duration) var(--ease-out), 
        transform var(--duration) var(--ease-spring), 
        border-color var(--duration-slow) var(--ease-smooth),
        background var(--duration) var(--ease-smooth);
    animation: cardIn 0.5s var(--ease-out) both;
}
.rule-card:hover { 
    box-shadow: var(--card-shadow-hover); 
    transform: translateY(-5px);
    border-color: rgba(0,113,227,0.1);
    background: rgba(255,255,255,0.95);
}
.rule-icon { 
    width: 48px; 
    height: 48px; 
    border-radius: 14px; 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    margin-bottom: 16px; 
    font-size: 1.15rem;
    transition: transform var(--duration) var(--ease-spring), box-shadow var(--duration) var(--ease-out);
}
.rule-card:hover .rule-icon { transform: scale(1.12) rotate(-4deg); box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.rule-card h4 { font-size: 1.08rem; font-weight: 600; margin-bottom: 10px; transition: color var(--duration-fast); }
.rule-card:hover h4 { color: var(--accent); }
.rule-card p { font-size: 0.92rem; color: var(--text-muted); line-height: 1.7; }

/* ===== Side Box ===== */
.side-box { 
    background: rgba(255,255,255,0.7); 
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(0,0,0,0.05); 
    border-radius: var(--radius); 
    padding: 24px; 
    box-shadow: var(--card-shadow); 
    margin-bottom: 20px;
    transition: box-shadow var(--duration) var(--ease-out), transform var(--duration) var(--ease-spring);
}
.side-box:hover { box-shadow: var(--card-shadow-hover); transform: translateY(-2px); }
.side-box h3 { font-size: 1.05rem; font-weight: 600; margin-bottom: 14px; }

/* ===== Buttons ===== */
.btn-claim { 
    background: linear-gradient(135deg, #0071e3 0%, #0077ed 100%); 
    color: #fff; 
    border: none; 
    padding: 14px 36px; 
    border-radius: var(--radius-sm); 
    font-weight: 600; 
    font-size: 0.95rem; 
    cursor: pointer; 
    box-shadow: 0 4px 14px rgba(0,113,227,0.25); 
    display: inline-block; 
    text-decoration: none;
    letter-spacing: 0.01em;
    transition: 
        transform var(--duration) var(--ease-spring), 
        box-shadow var(--duration) var(--ease-out),
        background var(--duration-fast);
    position: relative;
    overflow: hidden;
}
.btn-claim::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, transparent 60%);
    opacity: 0;
    transition: opacity var(--duration-fast);
}
.btn-claim:hover { 
    transform: translateY(-3px) scale(1.02); 
    box-shadow: 0 10px 28px rgba(0,113,227,0.35);
}
.btn-claim:hover::before { opacity: 1; }
.btn-claim:active { 
    transform: translateY(0) scale(0.98); 
    box-shadow: 0 2px 8px rgba(0,113,227,0.3);
    transition-duration: 0.1s;
}

/* ===== Step List ===== */
.step-list { list-style: none; padding-left: 0; }
.step-list li { 
    padding: 10px 0; 
    border-bottom: 1px solid rgba(0,0,0,0.04); 
    font-size: 0.9rem; 
    color: var(--text-muted);
    transition: color var(--duration-fast), padding-left var(--duration) var(--ease-spring), background var(--duration-fast);
    border-radius: 6px;
    padding-left: 4px;
    padding-right: 4px;
}
.step-list li:hover { color: var(--text-main); padding-left: 10px; background: var(--bg-secondary); }
.step-list li:last-child { border-bottom: none; }

/* ===== FAQ ===== */
.faq-item { border-bottom: 1px solid rgba(0,0,0,0.06); }
.faq-q { 
    padding: 16px 0; 
    font-weight: 500; 
    cursor: pointer; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    font-size: 0.95rem;
    transition: color var(--duration-fast), padding-left var(--duration) var(--ease-spring);
    user-select: none;
}
.faq-q span { 
    font-size: 1rem; 
    color: var(--text-muted);
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--bg-secondary);
    font-weight: 400;
    transition: 
        transform var(--duration) var(--ease-spring), 
        color var(--duration-fast), 
        background var(--duration-fast);
}
.faq-q:hover { color: var(--accent); padding-left: 4px; }
.faq-q:hover span { color: var(--accent); background: rgba(0,113,227,0.08); transform: scale(1.1); }
.faq-a { 
    display: none; 
    padding: 0 0 16px; 
    font-size: 0.9rem; 
    color: var(--text-muted); 
    line-height: 1.7;
    animation: fadeIn 0.35s var(--ease-out);
}

/* ===== Data Rows ===== */
table { border-collapse: collapse; }
th { text-align: left; }
tr { transition: background var(--duration-fast); }
tbody tr:hover { background: var(--bg-secondary); }

/* ===== Bar Charts ===== */
.card div[style*="align-items:flex-end"] > div {
    transform-origin: bottom;
    animation: barGrow 0.6s var(--ease-out) both;
}
.card div[style*="align-items:flex-end"] > div:nth-child(2) { animation-delay: 0.02s; }
.card div[style*="align-items:flex-end"] > div:nth-child(3) { animation-delay: 0.04s; }
.card div[style*="align-items:flex-end"] > div:nth-child(4) { animation-delay: 0.06s; }
.card div[style*="align-items:flex-end"] > div:nth-child(5) { animation-delay: 0.08s; }
.card div[style*="align-items:flex-end"] > div:nth-child(6) { animation-delay: 0.1s; }
.card div[style*="align-items:flex-end"] > div:nth-child(7) { animation-delay: 0.12s; }

/* ===== Progress Bars ===== */
div[style*="height:6px"] > div {
    transition: width 0.8s var(--ease-out);
}

/* ===== Stat Cards in grid-auto ===== */
.grid-auto > .card {
    transition: 
        box-shadow var(--duration) var(--ease-out), 
        transform var(--duration) var(--ease-spring), 
        background var(--duration-fast);
}
.grid-auto > .card:hover { background: rgba(255,255,255,0.95); }

/* ===== Code ===== */
code {
    font-family: 'SF Mono', SFMono-Regular, ui-monospace, Menlo, Monaco, Consolas, monospace;
    font-size: 0.82rem;
}

/* ===== Footer ===== */
footer { 
    border-top: 1px solid var(--border-color); 
    padding: 40px 24px; 
    text-align: center; 
    color: var(--text-muted); 
    font-size: 0.88rem;
}
footer a { 
    color: var(--text-muted); 
    transition: color var(--duration-fast);
    position: relative;
}
footer a:hover { color: var(--accent); }
footer p + p { margin-top: 8px; }

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; transition: background 0.2s; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===== Selection ===== */
::selection { background: rgba(0,113,227,0.15); color: var(--text-main); }

/* ============================================
   Responsive — Tablet
   ============================================ */
@media (max-width: 900px) {
    .grid-2 { gap: 16px; }
    .grid-3 { grid-template-columns: 1fr 1fr; }
    .page-container { padding: 36px 16px 48px; }
}

/* ============================================
   Responsive — Mobile (app-like)
   ============================================ */
@media (max-width: 640px) {
    /* Nav */
    .nav-links { display: none; }
    .navbar { padding: 0 12px; height: 52px; }
    .nav-brand { font-size: 1.05rem; }
    .nav-brand img { width: 24px !important; height: 24px !important; }
    
    /* Page */
    .page-container { padding: 24px 12px 36px; }
    .page-header { margin-bottom: 28px; }
    .page-header h1 { font-size: 1.5rem; }
    .page-header p { font-size: 0.9rem; }
    
    /* Grids → stack */
    .grid-2, .grid-3 { grid-template-columns: 1fr; gap: 14px; }
    .grid-auto { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
    
    /* Cards */
    .card { padding: 18px; border-radius: var(--radius-sm); }
    .card:hover { transform: none; } /* no lift on mobile — feels janky with touch */
    .card h3 { font-size: 0.95rem; margin-bottom: 12px; }
    
    /* Rule Cards */
    .rule-card { padding: 20px; border-radius: var(--radius-sm); }
    .rule-card:hover { transform: none; }
    .rule-icon { width: 42px; height: 42px; }
    .rule-card h4 { font-size: 0.98rem; }
    .rule-card p { font-size: 0.85rem; }
    
    /* Side Box */
    .side-box { padding: 16px; }
    
    /* Button */
    .btn-claim { 
        padding: 13px 28px; 
        font-size: 0.9rem; 
        width: 100%;
        text-align: center;
    }
    
    /* FAQ */
    .faq-q { font-size: 0.88rem; padding: 14px 0; }
    .faq-a { font-size: 0.85rem; }
    
    /* Footer */
    footer { padding: 28px 12px; font-size: 0.8rem; }
    
    /* Stat value text */
    .grid-auto > .card div[style*="font-size:1.5rem"] { font-size: 1.2rem !important; }
    .grid-auto > .card div[style*="font-size:1.3rem"] { font-size: 1.1rem !important; }
    
    /* Table overflow */
    table { font-size: 0.85rem; }
    th, td { padding: 10px 6px !important; }
}

/* ============================================
   Responsive — Small phones
   ============================================ */
@media (max-width: 380px) {
    .page-header h1 { font-size: 1.3rem; }
    .grid-auto { grid-template-columns: repeat(2, 1fr); }
    .card { padding: 14px; }
    .rule-card { padding: 16px; }
}

/* ============================================
   Accessibility: Reduced Motion
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   Touch devices: disable hover lift
   ============================================ */
@media (hover: none) {
    .card:hover, .rule-card:hover, .side-box:hover { transform: none; }
    .btn-claim:hover { transform: none; }
    .nav-brand:hover { transform: none; }
    .nav-brand:hover img { transform: none; }
}
