/* Header and global navigation module.
   Large legacy header rules still live in includes/header.php and will be moved here incrementally. */

.top-header .logo,
.site-header .logo {
    text-decoration: none;
}

.header-login-btn {
    background: var(--accent-color);
    color: #fff;
    padding: 8px 16px;
    border-radius: 20px;
    text-decoration: none;
    font-weight: 600;
}

.header-center-content {
    display: flex;
    align-items: center;
    gap: 20px;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.header-actions {
    margin-left: auto;
}

.header-account-trigger {
    position: relative;
}

.header-notification-badge {
    top: -2px;
    right: -2px;
    width: 18px;
    height: 18px;
    font-size: 0.7rem;
    border: 2px solid #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.league-sponsor {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    padding: 5px 15px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.league-sponsor-logo {
    height: 35px;
    width: auto;
    background: rgba(255, 255, 255, 0.95);
    padding: 2px;
    border-radius: 4px;
    object-fit: contain;
}

.league-sponsor-copy {
    line-height: 1.1;
}

.league-sponsor-eyebrow {
    display: block;
    font-size: 0.6rem;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.league-sponsor-name {
    font-weight: 700;
    font-size: 0.9rem;
}

.toast-icon {
    margin-right: 10px;
}

/* Migrated from app/includes/header.php */
body {

            padding-top: 0;

            padding-bottom: calc(var(--bottom-nav-height) + 40px);

            background-color: var(--bg-color);

            color: var(--text-color);

            margin: 0;

            font-family: 'Montserrat', sans-serif;
            font-weight: 500;

            transition: background-color 0.3s, color 0.3s;

        }



        /* Header */

        .main-header {

            position: fixed;

            top: 0;

            left: 0;

            width: 100%;

            height: var(--header-height);

            background: rgba(255, 255, 255, 0.05);

            backdrop-filter: blur(12px);

            -webkit-backdrop-filter: blur(12px);

            border-bottom: 1px solid rgba(255, 255, 255, 0.1);

            z-index: 1000;

            display: flex;

            align-items: center;

            box-shadow: var(--shadow-sm);

            transition: all 0.3s ease;

        }

        

        /* Header for non-hero pages */
        body:not(.has-hero) .main-header {
            background: linear-gradient(135deg, var(--nav-bg) 0%, rgba(255,255,255,0.95) 100%);
            border-bottom: var(--glass-border);
            color: var(--text-color);
            box-shadow: 0 2px 10px rgba(0,0,0,0.05);
        }
        body:not(.has-hero) .main-header .logo {
            color: var(--primary-color);
        }
        body:not(.has-hero) .main-header .logo img {
            filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
            max-height: 50px;
            width: auto;
        }
        body:not(.has-hero) .icon-btn {
            color: var(--text-color);
        }

        

        /* Dynamic Header for Hero Pages */

        body.has-hero .main-header {

            position: absolute;
            background: linear-gradient(to bottom, rgba(0,0,0,0.3) 0%, transparent 100%);

            box-shadow: none;

            border-bottom: none;

            color: white;

        }

        

        body.has-hero .main-header .logo h1 {

            color: #fff;

            text-shadow: 0 2px 4px rgba(0,0,0,0.3);

        }



        .header-container {

            width: 100%;

            max-width: 1200px;

            margin: 0 auto;

            padding: 0 20px;

            display: flex;

            justify-content: space-between;

            align-items: center;

        }



        .logo {

            display: flex;

            align-items: center;

            gap: 12px;

            text-decoration: none;

            color: var(--primary-color);

        }



        .logo img {

            height: 55px;

            width: auto;

            filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));

        }



        .logo h1 {

            font-size: 1.4rem;

            font-weight: 800;

            margin: 0;

            letter-spacing: -0.5px;

            display: none;

        }



        .header-actions {

            display: flex;

            align-items: center;

            gap: 15px;

        }



        /* Notification Styles */

        .notification-wrapper { position: relative; }

        .notification-badge {

            position: absolute;

            top: -5px;

            right: -5px;

            background-color: var(--accent-color);

            color: white;

            border-radius: 50%;

            padding: 2px 6px;

            font-size: 0.7rem;

            font-weight: bold;

        }

        .notification-dropdown {

            position: absolute;

            top: 100%;

            right: 0;

            width: 300px;

            background: var(--card-bg);

            border: 1px solid var(--border-color);

            border-radius: 8px;

            box-shadow: 0 5px 15px rgba(0,0,0,0.1);

            display: none;

            z-index: 1001;

            max-height: 400px;

            overflow-y: auto;

        }

        .notification-dropdown.show { display: block; }

        .notification-item {

            padding: 15px;

            border-bottom: 1px solid var(--border-color);

            font-size: 0.9rem;

            cursor: pointer;

            transition: background 0.2s;

        }

        .notification-item:hover { background: var(--bg-color); }

        .notification-item.unread { font-weight: 600; border-left: 3px solid var(--accent-color); }

        .notification-empty { padding: 15px; text-align: center; color: #777; }



        .icon-btn {

            background: transparent;

            border: none;

            font-size: 1.4rem;

            color: inherit;

            cursor: pointer;

            padding: 8px;

            border-radius: 50%;

            transition: background 0.2s;

            display: flex;

            align-items: center;

            justify-content: center;

        }

        

        .icon-btn:hover {

            background: rgba(0,0,0,0.05);

        }

        

        body.has-hero .icon-btn:hover {

            background: rgba(255,255,255,0.15);

        }



        /* Adjust main container */

        main.container {

            width: 100%;

            max-width: none;

            margin: 0;

            padding: 0;

            min-height: calc(100vh - var(--header-height) - var(--bottom-nav-height));

            min-height: calc(100dvh - var(--header-height) - var(--bottom-nav-height));

        }



        /* Constrain content width for standard pages */

        .page-content, .dashboard-view, .container-fluid {

            max-width: 1200px;

            margin: 0 auto;

            padding: 20px;

        }

        

        /* Remove padding top for hero pages so hero goes under header */

        body.has-hero main.container {

            padding-top: var(--header-height);

            margin-top: calc(var(--header-height) * -1);

        }

        

        /* Fix for hero sections to handle the pull up */

        body.has-hero .dashboard-hero,

        body.has-hero .match-hero,

        body.has-hero .player-hero,

        body.has-hero .matches-hero,

        body.has-hero .fantasy-hero-wrapper {

            padding-top: calc(var(--header-height) + 40px);
            padding-bottom: 40px;

        }

        body.has-hero .page-content > .team-manager-hero {
            width: 100vw;
            margin-left: calc(50% - 50vw);
            margin-right: calc(50% - 50vw);
            margin-top: -20px;
            padding: 6rem 20px 3rem;
        }



        /* Common Component Styles for Dark Mode Compatibility */

        .dashboard-section, .match-detail-section, .player-section-card, .card-shadow, .modal-content, .league-item, .transfers-panel, .league-action-card, .receipt-container, .card, .package-card, .stat-card, .fixture-item, .search-card, .achievement-card, .match-summary-card, .gameweek-nav {

            background-color: var(--card-bg) !important;

            color: var(--text-color) !important;

            border-color: var(--border-color) !important;

        }

        

        .table-wrapper table {

            color: var(--text-color);

        }

        

        .styled-table thead tr {

            background-color: var(--bg-color) !important;

            color: var(--text-color) !important;

        }

        

        .styled-table tbody tr {

            border-bottom-color: var(--border-color) !important;

        }

        

        .styled-table tbody tr:hover {

            background-color: var(--bg-color) !important;

        }

        

        /* Dark Mode Table Striping & Elements Override */

        [data-theme="dark"] .styled-table tbody tr:nth-of-type(even) {

            background-color: var(--table-stripe-bg) !important;

        }

        [data-theme="dark"] .styled-table tbody tr:hover {

            background-color: var(--table-hover-bg) !important;

        }

        [data-theme="dark"] .score-box {

            background-color: rgba(255, 255, 255, 0.1) !important;

            color: var(--text-color) !important;

            border-color: rgba(255, 255, 255, 0.1) !important;

        }

        [data-theme="dark"] .score-box .score {

            color: var(--text-color) !important;

        }

        [data-theme="dark"] .sub-tab-link {

            background-color: rgba(255, 255, 255, 0.1) !important;

            color: var(--text-color) !important;

        }

        [data-theme="dark"] .sub-tab-link.active {

            background-color: var(--primary-color) !important;

            color: #fff !important;

        }

        [data-theme="dark"] .match-scorers,

        [data-theme="dark"] .stats-row {

            border-color: var(--border-color) !important;

        }



        /* Improved Modal Styles */

        .modal {

            display: none;

            position: fixed;

            z-index: 2000;

            left: 0;

            top: 0;

            width: 100%;

            height: 100%;

            overflow: auto;

            background-color: rgba(0,0,0,0.6);

            backdrop-filter: blur(4px);

            align-items: center;

            justify-content: center;

            opacity: 0;

            transition: opacity 0.3s ease;

        }

        .modal.show {

            display: flex;

            opacity: 1;

        }

        .modal-content {

            background-color: var(--card-bg);

            margin: auto;

            padding: 25px;

            border: 1px solid var(--border-color);

            width: 90%;

            max-width: 500px;

            border-radius: 16px;

            box-shadow: 0 10px 30px rgba(0,0,0,0.2);

            transform: scale(0.9);

            transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);

            color: var(--text-color);

        }

        .modal.show .modal-content {

            transform: scale(1);

        }

        .modal-header {

            display: flex;

            justify-content: space-between;

            align-items: center;

            border-bottom: 1px solid var(--border-color);

            padding-bottom: 15px;

            margin-bottom: 20px;

        }

        .modal-header h3 { margin: 0; font-size: 1.25rem; font-weight: 700; }

        .modal-close-btn { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--text-color); opacity: 0.7; transition: opacity 0.2s; }

        .modal-close-btn:hover { opacity: 1; }



        /* Header Search Bar */

        .header-search {

            display: flex;

            align-items: center;

            background: rgba(0, 0, 0, 0.05);

            padding: 5px 15px;

            border-radius: 20px;

            margin-left: 15px;

            margin-right: auto;

            border: 1px solid transparent;

            transition: all 0.3s ease;

        }

        .header-search input {

            background: transparent;

            border: none;

            color: inherit;

            padding: 5px;

            outline: none;

            font-size: 0.9rem;

            width: 200px;

        }

        .header-search button { background: transparent; border: none; color: inherit; cursor: pointer; padding: 5px; opacity: 0.7; }

        body:not(.has-hero) .header-search { background: rgba(255, 255, 255, 0.15); color: white; }

        body:not(.has-hero) .header-search input::placeholder { color: rgba(255, 255, 255, 0.7); }

        body.has-hero .header-search { background: rgba(255, 255, 255, 0.15); color: white; border-color: rgba(255, 255, 255, 0.2); }

        body.has-hero .header-search input::placeholder { color: rgba(255, 255, 255, 0.8); }

        [data-theme="dark"] .header-search { background: rgba(255, 255, 255, 0.05); border-color: rgba(255, 255, 255, 0.1); }

        @media (max-width: 768px) {

            .header-search {

                background: transparent !important;

                padding: 5px;

                border: none !important;

            }

            .header-search input {

                width: 0;

                padding: 0;

                opacity: 0;

                pointer-events: none;

                transition: all 0.3s ease;

            }

            .header-search.expanded {

                background: rgba(255, 255, 255, 0.15) !important;

                padding: 5px 15px;

                border: 1px solid rgba(255,255,255,0.2) !important;

                border-radius: 20px;

            }

            .header-search.expanded input { width: 160px; padding: 5px; opacity: 1; pointer-events: auto; }

        }



        /* --- Global Form Styles --- */

        input[type="text"],

        input[type="email"],

        input[type="password"],

        input[type="number"],

        input[type="date"],

        input[type="datetime-local"],

        select,

        textarea {

            width: 100%;

            padding: 12px 15px;

            border: 1px solid var(--border-color);

            border-radius: 8px;

            background-color: var(--card-bg);

            color: var(--text-color);

            font-size: 1rem;

            transition: border-color 0.2s, box-shadow 0.2s;

            box-sizing: border-box; /* Ensure padding doesn't affect width */

        }



        input[type="text"]:focus,

        input[type="email"]:focus,

        input[type="password"]:focus,

        input[type="number"]:focus,

        input[type="date"]:focus,

        input[type="datetime-local"]:focus,

        select:focus,

        textarea:focus {

            border-color: var(--secondary-color);

            outline: none;

            box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1); /* Using secondary color logic */

        }



        /* Checkboxes & Radios */

        input[type="checkbox"],

        input[type="radio"] {

            accent-color: var(--secondary-color);

            width: 18px;

            height: 18px;

            cursor: pointer;

            vertical-align: middle;

        }



        /* Form Labels */

        label {

            display: block;

            margin-bottom: 8px;

            font-weight: 600;

            color: var(--text-color);

            font-size: 0.95rem;

        }



        /* New Account Dropdown Styles */

        .account-menu-wrapper {

            position: relative;

        }

        .header-avatar {

            width: 40px;

            height: 40px;

            border-radius: 50%;

            object-fit: cover;

            border: 2px solid rgba(255,255,255,0.5);

            cursor: pointer;

        }

        body:not(.has-hero) .header-avatar {

            border-color: rgba(255,255,255,0.8);

        }

        .account-dropdown {

            position: absolute;

            top: calc(100% + 15px);

            right: 0;

            width: 320px;

            background: var(--card-bg);

            border-radius: 12px;

            box-shadow: 0 8px 30px rgba(0,0,0,0.1);

            border: 1px solid var(--border-color);

            overflow: hidden;

            z-index: 1001;

            display: none;

            opacity: 0;

            transform: translateY(10px);

            transition: opacity 0.2s ease, transform 0.2s ease;

        }

        .account-dropdown.show {

            display: block;

            opacity: 1;

            transform: translateY(0);

        }

        .account-dropdown-header {

            background: var(--hero-gradient);

            padding: 20px;

            display: flex;

            align-items: center;

            gap: 15px;

            color: white;

        }

        .dropdown-avatar {

            width: 50px;

            height: 50px;

            border-radius: 50%;

            object-fit: cover;

            border: 2px solid white;

        }

        .dropdown-user-info strong {

            display: block;

            font-size: 1.1rem;

        }

        .dropdown-user-info span {

            font-size: 0.85rem;

            opacity: 0.8;

            text-transform: capitalize;

        }

        .account-dropdown-actions {

            display: grid;

            grid-template-columns: repeat(4, 1fr);

            gap: 10px;

            padding: 15px;

            border-bottom: 1px solid var(--border-color);

        }

        .dropdown-action-item {

            display: flex;

            flex-direction: column;

            align-items: center;

            justify-content: center;

            gap: 5px;

            padding: 10px;

            border-radius: 8px;

            background: var(--bg-color);

            color: var(--text-color);

            text-decoration: none;

            font-size: 0.75rem;

            border: none;

            cursor: pointer;

            position: relative; /* For notification badge */

        }

        .dropdown-action-item:hover {

            background: var(--border-color);

        }

        .dropdown-action-item i {

            font-size: 1.2rem;

        }

        .account-dropdown-menu {

            max-height: 40vh;

            overflow-y: auto;

        }

/* Migrated global toast and prompt styles from app/includes/header.php */
.sponsor-ad {
            position: relative;
        }

        .tm-summary-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
            gap: 12px;
            max-width: 1200px;
            margin: -1rem auto 1.5rem;
            padding: 0 20px;
        }

        .tm-summary-card {
            background: var(--card-bg);
            border: 1px solid var(--border-color);
            border-left: 4px solid var(--primary-color);
            border-radius: 8px;
            padding: 14px;
            box-shadow: 0 3px 10px rgba(0,0,0,0.04);
        }

        .tm-summary-card.success { border-left-color: #27ae60; }
        .tm-summary-card.warning { border-left-color: #f39c12; }
        .tm-summary-card.danger { border-left-color: #e74c3c; }

        .tm-summary-card span {
            display: flex;
            align-items: center;
            gap: 7px;
            color: var(--text-muted, #7f8c8d);
            font-size: 0.75rem;
            font-weight: 700;
            text-transform: uppercase;
            margin-bottom: 8px;
        }

        .tm-summary-card strong {
            display: block;
            color: var(--text-color);
            font-size: 1.45rem;
            line-height: 1.1;
        }

        .tm-summary-card small {
            color: var(--text-muted, #7f8c8d);
            line-height: 1.35;
        }

        .sponsor-ad::after {
            content: "Sponsored";
            position: absolute;
            top: 8px;
            right: 8px;
            z-index: 3;
            padding: 3px 7px;
            border-radius: 999px;
            background: rgba(17, 24, 39, 0.78);
            color: #fff;
            font-size: 0.68rem;
            font-weight: 700;
            letter-spacing: 0;
            pointer-events: none;
        }
