/* assets/css/style.css */

/* 1. Global Resets & Fonts */
:root {
    /* Light Mode (Default) */
    --primary: #3b82f6;
    --primary-dark: #34d399;

    --bg-dark: #f8fafc;
    /* slate-50 */
    --bg-card: #ffffff;
    --text-main: #0f172a;
    /* slate-900 */
    --text-muted: #64748b;
    /* slate-500 */
    --border-color: #e2e8f0;
    /* slate-200 */
}

/* Dark Mode Overrides */
.dark {
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --text-main: #ffffff;
    --text-muted: #94a3b8;
    --border-color: rgba(255, 255, 255, 0.1);
}

body {
    font-family: 'EXT12-Medium', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden !important;
    max-width: 100vw !important;
    position: relative;
    width: 100%;
        /* تفعيل ميزة ss01 */
    font-feature-settings: "ss01" 1;
    -webkit-font-feature-settings: "ss01" 1;
    
    /* تنعيم الخط */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
}

html {
    overflow-x: hidden;
    max-width: 100vw;
}

img,
svg,
video,
canvas,
audio,
iframe,
embed,
object {
    display: block;
    max-width: 100%;
}

/* 2. Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    /* Adaptive color */
    border-radius: 4px;
    opacity: 0.5;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* Hide Scrollbar Utility */
.no-scrollbar::-webkit-scrollbar {
    display: none;
}

.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

/* 3. Tab Systems */

/* Main Page Tabs (Team, League) */
.tab-btn {
    position: relative;
    /* Tailwind classes equivalent: px-4 py-3 text-sm font-bold transition-colors */
    transition: all 0.3s ease;
}

.tab-btn.active {
    color: white !important;
    position: relative;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--primary);
    box-shadow: 0 -2px 10px var(--primary);
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease-out;
}

.tab-content.active {
    display: block;
}

/* Sub-Tabs (League Stats, Matches) */
.sub-tab-btn {
    transition: all 0.3s ease;
}

.sub-tab-btn.active {
    background-color: var(--primary);
    color: white !important;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* Player Stat Tabs (Tournaments) */
.stat-tab-btn {
    transition: all 0.2s ease;
}

.stat-tab-btn.active {
    background-color: var(--primary) !important;
    color: white !important;
    border-color: var(--primary) !important;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
    transform: translateY(-1px);
}

.stat-content {
    animation: fadeIn 0.3s ease-out;
}

/* 4. View Toggles (Grid/List) */
.view-btn {
    transition: all 0.2s ease;
}

.view-btn.active {
    background-color: #334155;
    /* slate-700 */
    color: white !important;
}

/* 5. Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 6. Utility Helpers */
.glass {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.text-shadow {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* RTL Director Fixes (if needed overrides) */
[dir="rtl"] .dir-rtl {
    direction: ltr;
    display: inline-block;
}

/* 7. Homepage Specifics */

/* League Options Dropdown */
.league-options-dropdown {
    display: none;
    animation: fadeIn 0.2s ease-out;
}

.league-options-dropdown.active {
    display: block;
}

/* Pinned League Effect */
.league-section.pinned {
    order: -1;
    /* Flex/Grid order to move to top */
    border: 1px solid rgba(59, 130, 246, 0.3);
    background: rgba(59, 130, 246, 0.05);
    border-radius: 12px;
}

.league-section.hidden-league {
    display: none !important;
}

/* Action Buttons (Header) */
.action-btn {
    transition: all 0.2s ease;
}

.action-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
}

/* Date Header Custom */
.date-header-btn {
    position: relative;
    overflow: hidden;
}

.date-header-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s, height 0.3s;
}

/* 8. Modals (Filter, Settings) */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(4px);
    z-index: 50;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn 0.2s ease-out;
}

.modal-overlay.active {
    display: flex;
}

.modal-content {
    background: #1e293b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform: scale(0.95);
    transition: transform 0.2s ease;
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

/* Filter Option Buttons */
.filter-btn {
    border: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(255, 255, 255, 0.02);
    color: #94a3b8;
    transition: all 0.2s;
}

.filter-btn.active {
    background: white;
    color: #0f172a;
    /* dark-900 */
    border-color: white;
    font-weight: bold;
}

.action-confirm-btn {
    background: #10b981;
    /* emerald-500 */
    color: white;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
    transition: all 0.2s;
}

.action-confirm-btn:hover {
    background: #059669;
    transform: translateY(-1px);
}

/* 9. Match Details Enhancements */

/* Timeline Layout */
.timeline-container {
    position: relative;
    padding: 2rem 0;
}

/* Minimalist Timeline Redesign */
.timeline-new {
    width: 100%;
}

.timeline-row {
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding: 0.75rem 0;
    min-height: 60px;
}

.timeline-row:last-child {
    border-bottom: none;
}

.timeline-col-side {
    flex: 1;
    display: flex;
    align-items: center;
    min-width: 0;
}

.timeline-col-center {
    width: 80px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
}

.timeline-time-inner {
    width: 35px;
    height: 35px;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgb(255 255 255 / 10%);
    border-radius: 54%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 900;
    color: white;
    text-align: center;
}

.timeline-event-content {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
}

.timeline-event-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    flex-shrink: 0;
}

/* Lineup Pitch Styles */
.pitch-container {
    position: relative;
    width: 100%;
    aspect-ratio: 0.7;
    /* High-fidelity portrait pitch */
    background: #064e3b;
    /* Emerald-900 */
    border-radius: 24px;
    overflow: hidden;
    margin-top: 20px;
}

.pitch-overlay {
    position: absolute;
    inset: 0;
    background-image: url('/lineup.png');
    background-size: cover;
    background-position: center;
    opacity: 0.3;
    /* Higher opacity for the specific background */
}

.player-marker {
    position: absolute;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    z-index: 20;
    width: 60px;
}

.player-avatar-container {
    position: relative;
    width: 88px;
    height: 88px;
}

.player-avatar {
    width: 100%;
    height: 100%;
    background: #1e293b;
    border-radius: 50%;
    border: 2px solid white;
    object-fit: cover;
}

.player-number-badge {
    position: absolute;
    top: -2px;
    right: -6px;
    background: black;
    color: white;
    font-size: 8px;
    font-weight: bold;
    min-width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.player-rating-badge {
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    background: #3675de;
    color: #ffffff;
    font-size: 9px;
    font-weight: 900;
    padding: 0px 5px;
    border-radius: 3px;
}

.player-event-badge {
    position: absolute;
    top: 50%;
    left: -10px;
    transform: translateY(-50%);
}

.player-name-label {
    background: rgb(0 0 0 / 46%);
    color: white;
    font-size: 12px;
    font-weight: bold;
    padding: 1px 6px;
    border-radius: 4px;
    width: min-content;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Formation Selector Buttons */
.team-toggle-btn {
    flex: 1;
    padding: 5px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: bold;
    transition: all 0.3s;
    background: rgba(255, 255, 255, 0.02);
    color: #94a3b8;
}

.team-toggle-btn.active {
    background: #4f46e5;
    /* indigo-600 */
    color: white;
    box-shadow: 0 4px 20px rgba(79, 70, 229, 0.3);
}

@media (max-width: 640px) {
    .timeline-card {
        width: calc(50% - 25px);
        padding: 6px;
    }

    .player-marker {
        width: 50px;
    }

    .player-avatar-container {
        width: 60px;
        height: 60px;
    }
}

/* Footer Link Hovers */
footer a {
    position: relative;
    display: inline-block;
}

footer li a::before {
    content: '';
    position: absolute;
    bottom: -2px;
    right: 0;
    width: 0;
    height: 1px;
    background-color: var(--primary);
    transition: width 0.3s ease;
}

footer li a:hover::before {
    width: 100%;
}

/* App Store / Google Play Buttons */
.group:hover svg {
    transform: scale(1.1);
    transition: transform 0.3s ease;
}

/* Glassmorphism for Mobile Nav */
nav.md\:hidden {
    box-shadow: 0 -10px 30px -10px rgba(0, 0, 0, 0.1);
}

.dark nav.md\:hidden {
    box-shadow: 0 -10px 40px -20px rgba(0, 0, 0, 0.5);
    background: rgba(15, 23, 42, 0.8) !important;
}