/* ============================================
   CricBuzzLive - Main Styles
   ============================================ */

:root {
    --primary: #0c8b4e;
    --primary-dark: #0a1f16;
    --primary-light: #e5f6ec;
    --secondary: #12a862;
    --accent: #f2a93b;
    --danger: #e13b3b;
    --text: #12211b;
    --text-muted: #55655f;
    --bg: #f5f7f6;
    --surface: #ffffff;
    --border: #e4e9e6;
    --shadow: 0 1px 2px rgba(10,31,22,0.06), 0 4px 16px rgba(10,31,22,0.05);
    --shadow-hover: 0 8px 28px rgba(10,31,22,0.12);
    --radius: 12px;
    --radius-lg: 20px;
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Reset & Base */
* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { text-decoration: none; color: var(--primary); }
a:hover { color: var(--secondary); }

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

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    letter-spacing: -0.01em;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
}

.section-eyebrow {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--primary);
}

/* Selection */
::selection {
    background: var(--secondary);
    color: #fff;
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ============================================
   Header / Navbar
   ============================================ */
.cv-header {
    background: var(--primary-dark);
    border-bottom: 3px solid var(--primary);
}

.cv-brand {
    font-weight: 800;
    font-size: 1.5rem;
    color: #fff !important;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.cv-brand span { color: var(--secondary); }
.cv-brand i { color: var(--secondary); }

.cv-nav-link {
    color: rgba(255,255,255,0.85) !important;
    font-weight: 600;
    padding: 0.5rem 0.85rem !important;
    transition: var(--transition);
    position: relative;
}

.cv-nav-link:hover,
.cv-nav-link.active {
    color: #fff !important;
}

.cv-nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0.85rem;
    right: 0.85rem;
    height: 2px;
    background: var(--secondary);
}

.cv-header .dropdown-menu {
    background: var(--primary-dark);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--radius);
    padding: 0.5rem;
}

.cv-header .dropdown-item {
    color: rgba(255,255,255,0.85);
    border-radius: 6px;
    padding: 0.5rem 1rem;
}

.cv-header .dropdown-item:hover {
    background: var(--primary);
    color: #fff;
}

.navbar-toggler {
    border-color: rgba(255,255,255,0.3);
    padding: 0.25rem 0.5rem;
}

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(255,255,255,0.8)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

.btn-premium {
    background: transparent;
    border: 1.5px solid var(--secondary);
    color: #fff;
    border-radius: 999px;
    font-weight: 600;
    font-size: 0.85rem;
    padding: 0.35rem 1rem;
    transition: var(--transition);
}

.btn-premium:hover {
    background: var(--secondary);
    color: #fff;
}

/* ============================================
   Ticker
   ============================================ */
.cv-ticker {
    background: var(--primary-dark);
    overflow: hidden;
    white-space: nowrap;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.cv-ticker-track {
    display: inline-flex;
    gap: 2.5rem;
    padding: 0.5rem 1rem;
    animation: ticker-scroll 32s linear infinite;
}

.cv-ticker:hover .cv-ticker-track {
    animation-play-state: paused;
}

@keyframes ticker-scroll {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

.cv-ticker-item {
    color: rgba(255,255,255,0.9);
    font-size: 0.83rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

/* ============================================
   Live Dot
   ============================================ */
.live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--danger);
    display: inline-block;
    position: relative;
    flex-shrink: 0;
}

.live-dot::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 1.5px solid var(--danger);
    animation: pulse-ring 1.8s cubic-bezier(0.4,0,0.6,1) infinite;
}

@keyframes pulse-ring {
    0% { transform: scale(0.6); opacity: 0.9; }
    100% { transform: scale(1.8); opacity: 0; }
}

.badge-live {
    background: var(--danger);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

/* ============================================
   Cards
   ============================================ */
.cv-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: var(--transition);
}

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

/* ============================================
   Hero Featured
   ============================================ */
.hero-featured {
    background: radial-gradient(1200px 400px at 20% -10%, rgba(18,168,98,0.25), transparent),
                var(--primary-dark);
    border-radius: var(--radius-lg);
    color: #fff;
    overflow: hidden;
    position: relative;
}

.hero-featured::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: repeating-linear-gradient(90deg, rgba(255,255,255,0.03) 0 1px, transparent 1px 44px);
    pointer-events: none;
}

/* ============================================
   Match Row
   ============================================ */
.match-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 0;
}

.match-score {
    font-weight: 700;
    font-size: 1.1rem;
}

.match-status {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--primary);
}

.match-status.is-live {
    color: var(--danger);
}

/* ============================================
   Team Chip
   ============================================ */
.team-chip {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.72rem;
    color: #fff;
    flex-shrink: 0;
}

.chip-1 { background: linear-gradient(135deg, #0c8b4e, #12a862); }
.chip-2 { background: linear-gradient(135deg, #2b4c9b, #4a6fd1); }
.chip-3 { background: linear-gradient(135deg, #b8452f, #e0704f); }
.chip-4 { background: linear-gradient(135deg, #7a3ea1, #a465d1); }
.chip-5 { background: linear-gradient(135deg, #ab7d19, #d9a441); }
.chip-6 { background: linear-gradient(135deg, #1a7a7a, #26a6a6); }

/* ============================================
   Quick Chips
   ============================================ */
.quick-chip {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition);
}

.quick-chip:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

/* ============================================
   News
   ============================================ */
.news-item {
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--border);
}

.news-item:last-child {
    border-bottom: none;
}

.news-item h3 {
    font-size: 0.98rem;
    margin-bottom: 0.25rem;
    font-weight: 600;
}

.news-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ============================================
   Videos
   ============================================ */
.video-card {
    position: relative;
    border-radius: var(--radius);
    overflow: hidden;
    display: block;
    color: #fff;
}

.video-card .play-btn {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(to top, rgba(10,31,22,0.75), rgba(10,31,22,0.05));
}

.video-card .play-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255,255,255,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
}

.video-duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0,0,0,0.7);
    color: #fff;
    font-size: 0.7rem;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
}

.video-card .p-2 {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
}

/* ============================================
   Filter Buttons
   ============================================ */
.pill-filter {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    border-radius: 999px;
    padding: 0.4rem 1.1rem;
    font-weight: 600;
    font-size: 0.85rem;
    transition: var(--transition);
}

.pill-filter.active,
.pill-filter:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.tab-underline {
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-weight: 600;
    padding: 0.6rem 0.25rem;
    margin-right: 1.5rem;
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
}

.tab-underline.active {
    border-color: var(--primary);
    color: var(--text);
}

.tab-underline:hover {
    color: var(--text);
}

/* ============================================
   Tables
   ============================================ */
.cv-table thead th {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border);
    font-weight: 700;
}

.cv-table td {
    vertical-align: middle;
}

.rank-badge {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: var(--primary-light);
    color: var(--primary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.82rem;
}

.rank-badge.top1 {
    background: #d9a441;
    color: #fff;
}

/* ============================================
   Skeleton Loader
   ============================================ */
.skeleton {
    background: linear-gradient(90deg, #edf1ef 25%, #f7f9f8 37%, #edf1ef 63%);
    background-size: 400% 100%;
    animation: skeleton-loading 1.4s ease infinite;
    border-radius: 6px;
}

@keyframes skeleton-loading {
    0% { background-position: 100% 50%; }
    100% { background-position: 0 50%; }
}

/* ============================================
   Footer
   ============================================ */
.cv-footer {
    background: var(--primary-dark);
    color: rgba(255,255,255,0.7);
    padding: 4rem 0 2rem;
    margin-top: 4rem;
}

.cv-footer h6 {
    color: #fff;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.85rem;
}

.cv-footer a {
    color: rgba(255,255,255,0.65);
    transition: var(--transition);
}

.cv-footer a:hover {
    color: var(--secondary);
}

.social-icon {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    transition: var(--transition);
}

.social-icon:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* ============================================
   Back to Top
   ============================================ */
.back-to-top {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-hover);
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
    z-index: 1030;
    border: none;
}

.back-to-top.show {
    opacity: 1;
    pointer-events: auto;
}

.back-to-top:hover {
    background: var(--secondary);
    color: #fff;
}

/* ============================================
   Mode Banner
   ============================================ */
.mode-banner {
    font-size: 0.82rem;
    padding: 0.55rem 1rem;
    border-radius: 6px;
}

.mode-banner.demo {
    background: #fff6e5;
    color: #8a6116;
    border: 1px solid #f3d99a;
}

.mode-banner.live {
    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid #b7e6cb;
}

.mode-banner.error {
    background: #fdeceb;
    color: #a3352c;
    border: 1px solid #f3bcb6;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 991.98px) {
    .cv-nav-link {
        padding: 0.5rem 0 !important;
    }
    
    .cv-nav-link.active::after {
        left: 0;
        right: 0;
    }
}

@media (max-width: 767.98px) {
    .section-title { font-size: 1.2rem; }
    .cv-ticker-track { animation-duration: 22s; }
    .hero-featured { padding: 1.5rem !important; }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
}