/* ============================================================
   Football Live Hub — Koora-Style Frontend (Light Theme)
   ============================================================ */

/* ------------------------------------------------------------------ */
/* Custom properties                                                    */
/* ------------------------------------------------------------------ */
.flh-app {
    --flh-blue:       #007bff;
    --flh-blue-dark:  #0056b3;
    --flh-green:      #28a745;
    --flh-green-dark: #1e7e34;
    --flh-red:        #dc3545;
    --flh-red-dark:   #b02a37;
    --flh-orange:     #fd7e14;
    --flh-gray:       #6c757d;
    --flh-light:      #f8f9fa;
    --flh-border:     #e9ecef;
    --flh-text:       #333333;
    --flh-text-muted: #666666;
    --flh-bg:         #f5f5f5;
    --flh-white:      #ffffff;
    --flh-radius:     12px;
    --flh-radius-sm:  6px;
    --flh-shadow:     0 4px 15px rgba(0,0,0,0.08);
    --flh-shadow-sm:  0 2px 8px rgba(0,0,0,0.05);
    --flh-font:       -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
                      "Helvetica Neue", Arial, "Noto Sans Arabic", sans-serif;
}

/* ------------------------------------------------------------------ */
/* App wrapper                                                          */
/* ------------------------------------------------------------------ */
.flh-app {
    font-family: var(--flh-font);
    background:  var(--flh-bg);
    color:       var(--flh-text);
    max-width:   1200px;
    margin:      0 auto;
    padding:     20px;
    min-height:  100vh;
    box-sizing:  border-box;
}

.flh-app *,
.flh-app *::before,
.flh-app *::after {
    box-sizing: border-box;
}

/* ------------------------------------------------------------------ */
/* DATE SLIDER                                                          */
/* ------------------------------------------------------------------ */
.flh-date-slider-wrap {
    position:      relative;
    background:    var(--flh-white);
    border-radius: var(--flh-radius);
    padding:       15px;
    box-shadow:    var(--flh-shadow-sm);
    margin-bottom: 25px;
    display:       flex;
    align-items:   center;
}

.flh-date-items {
    display:         flex;
    gap:             10px;
    flex:            1;
    justify-content: center;
    overflow-x:      auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding:         5px 55px;
    scroll-behavior: smooth;
}
.flh-date-items::-webkit-scrollbar { display: none; }

/* Circular date pill */
.flh-date-item {
    flex-shrink:     0;
    width:           65px;
    height:          65px;
    display:         flex;
    flex-direction:  column;
    align-items:     center;
    justify-content: center;
    background:      linear-gradient(145deg, var(--flh-light), var(--flh-white));
    border-radius:   50%;
    cursor:          pointer;
    transition:      all 0.25s ease;
    border:          2px solid transparent;
    box-shadow:      0 2px 6px rgba(0,0,0,0.08);
    user-select:     none;
}

.flh-date-item:hover {
    transform:    translateY(-3px);
    box-shadow:   0 4px 12px rgba(0,0,0,0.15);
    border-color: var(--flh-border);
}

.flh-date-item.today {
    background:  linear-gradient(145deg, var(--flh-green), var(--flh-green-dark));
    color:       var(--flh-white);
    border-color: var(--flh-green-dark);
}

.flh-date-item.active {
    background:  linear-gradient(145deg, var(--flh-blue), var(--flh-blue-dark));
    color:       var(--flh-white);
    border-color: var(--flh-blue-dark);
    transform:   scale(1.1);
    box-shadow:  0 4px 15px rgba(0,123,255,0.35);
}

/* Today AND active = keep blue, not green */
.flh-date-item.today.active {
    background:  linear-gradient(145deg, var(--flh-blue), var(--flh-blue-dark));
    border-color: var(--flh-blue-dark);
    box-shadow:  0 4px 15px rgba(0,123,255,0.35);
}

.flh-date-day   { font-size: 22px; font-weight: 700; line-height: 1.1; }
.flh-date-month { font-size: 12px; margin-top: 3px; opacity: 0.9; }

/* Nav arrows */
.flh-date-nav {
    position:        absolute;
    top:             50%;
    transform:       translateY(-50%);
    width:           44px;
    height:          44px;
    background:      var(--flh-white);
    border:          2px solid var(--flh-border);
    border-radius:   50%;
    cursor:          pointer;
    font-size:       18px;
    font-weight:     700;
    color:           var(--flh-text);
    display:         flex;
    align-items:     center;
    justify-content: center;
    transition:      all 0.25s ease;
    z-index:         5;
    line-height:     1;
}
.flh-date-prev { right: 8px; }
.flh-date-next { left:  8px; }

.flh-date-nav:hover {
    background:   var(--flh-blue);
    border-color: var(--flh-blue);
    color:        var(--flh-white);
    transform:    translateY(-50%) scale(1.1);
}

/* ------------------------------------------------------------------ */
/* TABS + CALENDAR BUTTON                                               */
/* ------------------------------------------------------------------ */
.flh-tabs-wrap {
    display:        flex;
    align-items:    center;
    gap:            15px;
    margin-bottom:  25px;
    flex-wrap:      wrap;
}

.flh-tabs {
    display:       flex;
    gap:           12px;
    background:    var(--flh-white);
    border-radius: var(--flh-radius);
    padding:       10px;
    box-shadow:    var(--flh-shadow-sm);
    flex:          1;
    flex-wrap:     nowrap;
    overflow-x:    auto;
    scrollbar-width: none;
}
.flh-tabs::-webkit-scrollbar { display: none; }

.flh-tab {
    padding:         11px 28px;
    background:      var(--flh-light);
    border:          none;
    border-radius:   30px;
    cursor:          pointer;
    font-size:       15px;
    font-weight:     500;
    font-family:     var(--flh-font);
    transition:      all 0.25s ease;
    display:         flex;
    align-items:     center;
    gap:             8px;
    color:           var(--flh-text);
    white-space:     nowrap;
}

.flh-tab:hover:not(.active) {
    background:  #e9ecef;
    transform:   translateY(-2px);
}

.flh-tab.active {
    background:  linear-gradient(145deg, var(--flh-blue), var(--flh-blue-dark));
    color:       var(--flh-white);
    box-shadow:  0 4px 12px rgba(0,123,255,0.25);
}

/* Live tab — always red and blinking */
.flh-tab-live {
    position: relative;
}

.flh-tab-live:not(.active) {
    background:  #fff0f0;
    color:       var(--flh-red);
}

.flh-tab-live:not(.active):hover {
    background:  var(--flh-red);
    color:       var(--flh-white);
}

.flh-tab-live.active {
    background: var(--flh-red) !important;
    animation:  flh-live-blink 1s infinite !important;
    box-shadow: 0 0 15px rgba(220,53,69,0.45) !important;
}

@keyframes flh-live-blink {
    0%,100% { background: var(--flh-red); }
    50%     { background: var(--flh-red-dark); }
}

.flh-live-indicator {
    display:  inline-block;
    animation: flh-pulse 1.4s ease-in-out infinite;
}

@keyframes flh-pulse {
    0%,100% { opacity: 1; transform: scale(1); }
    50%     { opacity: 0.6; transform: scale(0.85); }
}

/* Calendar buttons */
.flh-cal-btn {
    background:    var(--flh-light);
    border:        1px solid var(--flh-border);
    border-radius: var(--flh-radius);
    padding:       11px 18px;
    cursor:        pointer;
    display:       flex;
    align-items:   center;
    gap:           8px;
    font-size:     15px;
    font-family:   var(--flh-font);
    color:         var(--flh-text);
    white-space:   nowrap;
    height:        50px;
    transition:    all 0.25s ease;
}
.flh-cal-btn:hover {
    background:   #e9ecef;
    border-color: var(--flh-blue);
    color:        var(--flh-blue);
}

.flh-cal-btn-mobile {
    display:       none;
    background:    var(--flh-light);
    border:        1px solid var(--flh-border);
    border-radius: 30px;
    padding:       10px 16px;
    cursor:        pointer;
    font-size:     14px;
    font-family:   var(--flh-font);
    color:         var(--flh-text);
    white-space:   nowrap;
    align-items:   center;
    gap:           6px;
    transition:    all 0.25s ease;
}
.flh-cal-btn-mobile:hover {
    background:   #e9ecef;
    border-color: var(--flh-blue);
    color:        var(--flh-blue);
}

/* ------------------------------------------------------------------ */
/* CALENDAR MODAL                                                        */
/* ------------------------------------------------------------------ */
.flh-cal-modal {
    display:         none;
    position:        fixed;
    inset:           0;
    background:      rgba(0,0,0,0.5);
    z-index:         9999;
    align-items:     center;
    justify-content: center;
}
.flh-cal-modal.open {
    display: flex;
}

.flh-cal-content {
    background:    var(--flh-white);
    border-radius: 16px;
    padding:       22px;
    width:         90%;
    max-width:     360px;
    box-shadow:    0 10px 30px rgba(0,0,0,0.2);
    animation:     flh-slide-up 0.2s ease;
}

@keyframes flh-slide-up {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

.flh-cal-header {
    display:         flex;
    align-items:     center;
    justify-content: space-between;
    margin-bottom:   14px;
}

.flh-cal-title {
    font-size:   18px;
    font-weight: 700;
    color:       var(--flh-text);
}

.flh-cal-close {
    background: none;
    border:     none;
    font-size:  22px;
    cursor:     pointer;
    color:      var(--flh-gray);
    line-height: 1;
    padding:    4px;
    transition: color 0.2s;
}
.flh-cal-close:hover { color: var(--flh-red); }

.flh-cal-nav {
    display:         flex;
    align-items:     center;
    justify-content: space-between;
    margin-bottom:   14px;
    gap:             8px;
}

.flh-cal-nav-btn {
    background:    var(--flh-light);
    border:        1px solid var(--flh-border);
    border-radius: var(--flh-radius-sm);
    padding:       6px 12px;
    cursor:        pointer;
    font-size:     13px;
    font-family:   var(--flh-font);
    color:         var(--flh-text);
    transition:    all 0.2s;
}
.flh-cal-nav-btn:hover {
    background:   #e9ecef;
    border-color: var(--flh-blue);
}

.flh-cal-days-header {
    display:               grid;
    grid-template-columns: repeat(7, 1fr);
    gap:                   4px;
    margin-bottom:         6px;
}
.flh-cal-day-name {
    text-align:  center;
    font-size:   12px;
    font-weight: 600;
    color:       var(--flh-gray);
    padding:     4px 0;
}

.flh-cal-grid {
    display:               grid;
    grid-template-columns: repeat(7, 1fr);
    gap:                   4px;
}

.flh-cal-day {
    text-align:      center;
    padding:         9px 4px;
    border-radius:   var(--flh-radius-sm);
    cursor:          pointer;
    font-size:       14px;
    border:          1px solid transparent;
    min-height:      34px;
    display:         flex;
    align-items:     center;
    justify-content: center;
    transition:      all 0.2s;
    color:           var(--flh-text);
}
.flh-cal-day:hover:not(.empty) {
    background:   var(--flh-light);
    border-color: var(--flh-border);
}
.flh-cal-day.today {
    background:   var(--flh-green);
    color:        var(--flh-white);
    border-color: var(--flh-green-dark);
    font-weight:  700;
}
.flh-cal-day.selected {
    background:   var(--flh-blue);
    color:        var(--flh-white);
    border-color: var(--flh-blue-dark);
    font-weight:  700;
}
.flh-cal-day.today.selected {
    background:   var(--flh-blue);
    border-color: var(--flh-blue-dark);
}
.flh-cal-day.empty {
    cursor:     default;
    visibility: hidden;
}

/* ------------------------------------------------------------------ */
/* MATCHES AREA                                                          */
/* ------------------------------------------------------------------ */
.flh-matches {
    min-height: 500px;
}

/* League section */
.flh-league {
    background:     var(--flh-white);
    border-radius:  var(--flh-radius);
    margin-bottom:  20px;
    box-shadow:     var(--flh-shadow-sm);
    overflow:       hidden;
    border:         1px solid var(--flh-border);
    animation:      flh-fade-in 0.25s ease;
}

@keyframes flh-fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.flh-league-header {
    display:         flex;
    align-items:     center;
    gap:             14px;
    padding:         16px 22px;
    background:      linear-gradient(90deg, var(--flh-light), var(--flh-white));
    border-bottom:   2px solid var(--flh-border);
}

.flh-league-logo {
    width:       34px;
    height:      34px;
    object-fit:  contain;
    flex-shrink: 0;
}
.flh-league-logo[src=""] { display: none; }

.flh-league-name {
    font-weight: 700;
    font-size:   16px;
    color:       var(--flh-text);
    flex:        1;
}

.flh-league-count {
    background:    #e9ecef;
    padding:       3px 10px;
    border-radius: 50px;
    font-size:     12px;
    color:         var(--flh-gray);
    margin-inline-start: auto;
}

/* Match card */
.flh-match {
    padding:         18px 22px;
    border-bottom:   1px solid #f2f2f2;
    display:         flex;
    align-items:     center;
    justify-content: space-between;
    cursor:          pointer;
    transition:      background 0.2s ease;
    position:        relative;
    width:           100%;
    text-decoration: none;
    color:           inherit;
}
.flh-match:last-child { border-bottom: none; }
.flh-match:hover      { background: var(--flh-light); }

/* Live elapsed minute — top right corner */
.flh-match-minute {
    position:    absolute;
    top:         8px;
    right:       14px;
    font-size:   12px;
    font-weight: 700;
    color:       var(--flh-red);
    font-family: Arial, sans-serif;
}
.flh-match-minute::after {
    content:          "";
    display:          block;
    height:           2px;
    background:       var(--flh-red);
    margin-top:       2px;
    animation:        flh-minute-line 1.2s ease-in-out infinite;
    transform-origin: left;
}
@keyframes flh-minute-line {
    0%   { transform: scaleX(0.2); opacity: 0.4; }
    50%  { transform: scaleX(1);   opacity: 1;   }
    100% { transform: scaleX(0.2); opacity: 0.4; }
}

.flh-match-teams {
    flex:            1;
    display:         flex;
    align-items:     center;
    justify-content: space-between;
    gap:             15px;
    width:           100%;
}

/* Team column */
.flh-team {
    display:     flex;
    align-items: center;
    gap:         12px;
    width:       40%;
}
.flh-team.home { justify-content: flex-end; text-align: right; }
.flh-team.away { justify-content: flex-start; text-align: left; }

.flh-team-logo {
    width:       34px;
    height:      34px;
    object-fit:  contain;
    flex-shrink: 0;
}
.flh-team-logo[src=""] { display: none; }

.flh-team-name {
    font-weight: 500;
    font-size:   15px;
    color:       var(--flh-text);
    overflow:    hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width:   180px;
}

/* Status / score centre column */
.flh-match-status {
    width:      110px;
    text-align: center;
    flex-shrink: 0;
}

.flh-score-wrap {
    display:        flex;
    flex-direction: column;
    align-items:    center;
    gap:            4px;
}

.flh-score {
    font-weight:  700;
    font-size:    20px;
    font-family:  Arial, sans-serif;
    color:        var(--flh-green);
    letter-spacing: 2px;
}

.flh-time {
    font-size:  15px;
    font-weight:500;
    color:      var(--flh-gray);
    font-family:Arial, sans-serif;
}

/* Status badges */
.flh-badge {
    display:       inline-block;
    padding:       3px 10px;
    border-radius: 14px;
    font-size:     11px;
    font-weight:   700;
    margin-top:    3px;
    text-transform:uppercase;
}

.flh-badge-live {
    background: var(--flh-red);
    color:      var(--flh-white);
    animation:  flh-blink 1.4s infinite;
}
@keyframes flh-blink {
    0%,100% { opacity: 1; }
    50%     { opacity: 0.7; }
}

.flh-badge-ht     { background: var(--flh-orange); color: var(--flh-white); }
.flh-badge-ended  { background: #111;               color: var(--flh-white); }
.flh-badge-soon   { background: var(--flh-green);   color: var(--flh-white); }
.flh-badge-pst    { background: var(--flh-gray);    color: var(--flh-white); }
.flh-badge-canc   { background: var(--flh-gray);    color: var(--flh-white); }

/* ------------------------------------------------------------------ */
/* LOADING                                                               */
/* ------------------------------------------------------------------ */
.flh-loading {
    text-align:    center;
    padding:       60px 20px;
    background:    var(--flh-white);
    border-radius: var(--flh-radius);
    box-shadow:    var(--flh-shadow-sm);
    color:         var(--flh-gray);
}

.flh-spinner {
    display:       inline-block;
    width:         42px;
    height:        42px;
    border:        4px solid #e9ecef;
    border-top:    4px solid var(--flh-blue);
    border-radius: 50%;
    animation:     flh-spin 0.8s linear infinite;
    margin-bottom: 16px;
}
@keyframes flh-spin {
    to { transform: rotate(360deg); }
}

/* ------------------------------------------------------------------ */
/* EMPTY / ERROR                                                         */
/* ------------------------------------------------------------------ */
.flh-no-matches {
    text-align:    center;
    padding:       60px 20px;
    background:    var(--flh-white);
    border-radius: var(--flh-radius);
    box-shadow:    var(--flh-shadow-sm);
    color:         var(--flh-gray);
}
.flh-no-matches p:first-child {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 6px;
}
.flh-no-matches p:last-child {
    font-size: 14px;
    color: #999;
}

.flh-error-box {
    background:    #f8d7da;
    color:         #721c24;
    padding:       24px;
    border-radius: var(--flh-radius);
    text-align:    center;
    border:        1px solid #f5c6cb;
    font-size:     14px;
}

/* ------------------------------------------------------------------ */
/* NO-STREAM / REDIRECT OVERLAY                                          */
/* ------------------------------------------------------------------ */
.flh-overlay {
    display:         none;
    position:        fixed;
    inset:           0;
    background:      rgba(255,255,255,0.96);
    z-index:         9999;
    align-items:     center;
    justify-content: center;
    overflow-y:      auto;
}
.flh-overlay.open {
    display: flex;
}

.flh-overlay-content {
    max-width:     500px;
    width:         90%;
    text-align:    center;
    padding:       40px 30px;
    animation:     flh-slide-up 0.2s ease;
}

.flh-overlay-content .flh-spinner {
    width:  50px;
    height: 50px;
}

.flh-overlay-icon {
    font-size:     64px;
    display:       block;
    margin-bottom: 20px;
}

.flh-overlay-title {
    font-size:     26px;
    font-weight:   700;
    color:         var(--flh-text);
    margin:        0 0 10px;
}

.flh-overlay-msg {
    font-size:  16px;
    color:      var(--flh-gray);
    margin:     0 0 30px;
    line-height:1.5;
}

.flh-overlay-back {
    display:       inline-block;
    padding:       12px 36px;
    background:    var(--flh-blue);
    color:         var(--flh-white);
    border:        none;
    border-radius: 30px;
    font-size:     16px;
    font-family:   var(--flh-font);
    font-weight:   600;
    cursor:        pointer;
    transition:    all 0.2s;
    text-decoration: none;
}
.flh-overlay-back:hover {
    background:   var(--flh-blue-dark);
    transform:    translateY(-2px);
    box-shadow:   0 6px 20px rgba(0,123,255,0.3);
}

/* ------------------------------------------------------------------ */
/* RESPONSIVE                                                            */
/* ------------------------------------------------------------------ */
@media (max-width: 768px) {
    .flh-app { padding: 12px; }

    .flh-date-slider-wrap { padding: 12px; }
    .flh-date-items  { padding: 0 48px; gap: 8px; }
    .flh-date-item   { width: 56px; height: 56px; }
    .flh-date-day    { font-size: 18px; }
    .flh-date-month  { font-size: 11px; }
    .flh-date-nav    { width: 38px; height: 38px; font-size: 16px; }
    .flh-date-prev   { right: 5px; }
    .flh-date-next   { left:  5px; }

    .flh-tabs-wrap  { flex-direction: column; align-items: stretch; gap: 8px; }
    .flh-tabs       { justify-content: flex-start; overflow-x: auto; padding: 8px; }
    .flh-tab        { padding: 9px 18px; font-size: 14px; }
    .flh-cal-btn    { display: none; }
    .flh-cal-btn-mobile { display: flex; }

    .flh-match        { padding: 14px 14px; flex-direction: row; }
    .flh-match-minute { right: 10px; font-size: 11px; }
    .flh-match-teams  { gap: 8px; }
    .flh-team         { width: 35%; flex-direction: column; justify-content: center; align-items: center; text-align: center; gap: 5px; }
    .flh-team.home    { order: 1; justify-content: center; }
    .flh-team.away    { order: 3; justify-content: center; }
    .flh-match-status { order: 2; width: 30%; }
    .flh-team-logo    { width: 38px; height: 38px; }
    .flh-team-name    { font-size: 13px; max-width: 100%; white-space: normal; -webkit-line-clamp: 2; display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
    .flh-score        { font-size: 18px; }

    .flh-league-header { padding: 13px 15px; gap: 10px; }
    .flh-league-name   { font-size: 15px; }
}

@media (max-width: 480px) {
    .flh-date-items { padding: 0 42px; gap: 6px; }
    .flh-date-item  { width: 50px; height: 50px; }
    .flh-date-nav   { width: 34px; height: 34px; font-size: 14px; }
    .flh-date-day   { font-size: 16px; }

    .flh-tab        { padding: 8px 14px; font-size: 13px; }
    .flh-team       { width: 32%; }
    .flh-match-status { width: 36%; }
    .flh-team-logo  { width: 34px; height: 34px; }
    .flh-team-name  { font-size: 12px; }
    .flh-score      { font-size: 16px; }
    .flh-badge      { font-size: 10px; padding: 2px 7px; }
}
