/* ============================================================
   Corporate Games Ghana Manager — Dashboard CSS
   Matches the SaaS UI Reference — Responsive Mobile Layout
   ============================================================ */

:root {
    --cggm-bg: #f5f7fb;
    --cggm-sidebar-bg: #0a192f;
    --cggm-sidebar-active: #155eef;
    --cggm-text-dark: #101828;
    --cggm-text-muted: #667085;
    --cggm-border: #eaecf0;
    --cggm-primary: #155eef;
    --cggm-radius: 12px;
}

html.cggm-dashboard-page, body.cggm-dashboard-page, body.cggm-player-dashboard-page {
    margin: 0 !important;
    padding: 0 !important;
    background: var(--cggm-bg);
    overflow: hidden !important;
    height: 100% !important;
}

/* Mobile Toggle Button */
.cggm-mobile-toggle {
    background: transparent;
    border: 1px solid var(--cggm-border);
    color: var(--cggm-text-dark);
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 20px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Sidebar Backdrop Overlay */
.cggm-sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: all 0.3s ease;
}
.cggm-sidebar-backdrop.show, .cggm-sidebar-backdrop.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Container & Layout */
.cggm-app-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 9999;
    display: flex;
    font-family: 'Inter', sans-serif;
    background: var(--cggm-bg);
    overflow: hidden;
}

body.admin-bar .cggm-app-container {
    top: 32px;
    height: calc(100vh - 32px);
}
@media screen and (max-width: 782px) {
    body.admin-bar .cggm-app-container {
        top: 46px;
        height: calc(100vh - 46px);
    }
}

/* Sidebar */
.cggm-sidebar {
    width: 215px;
    background: var(--cggm-sidebar-bg);
    color: #fff;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    height: 100%;
    overflow-y: auto;
    border-right: 1px solid rgba(255,255,255,0.05);
}

.cggm-brand {
    padding: 18px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.cggm-brand .brand-logo {
    width: 40px;
    height: 40px;
}

.cggm-brand .brand-text {
    display: flex;
    flex-direction: column;
    font-weight: 700;
    font-size: 15px;
    letter-spacing: 0.5px;
    line-height: 1.2;
    white-space: nowrap;
}

.cggm-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0 16px;
    gap: 4px;
    overflow-y: auto;
}

.cggm-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    font-size: 13px;
    transition: all 0.2s;
    white-space: nowrap;
}

.cggm-nav-item i {
    font-size: 16px;
}

.cggm-nav-item:hover {
    color: #fff;
    background: rgba(255,255,255,0.05);
}

.cggm-nav-item.active {
    color: #fff;
    background: var(--cggm-sidebar-active);
}

.cggm-sidebar-footer {
    padding: 18px;
    text-align: center;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.sidebar-club-logo {
    width: 75px;
    height: 75px;
    object-fit: contain;
    margin-bottom: 12px;
}

.sidebar-club-logo-placeholder {
    width: 75px;
    height: 75px;
    border-radius: 50%;
    background: rgba(255,255,255,0.1);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    font-weight: bold;
    margin: 0 auto 12px auto;
}

.btn-view-profile {
    display: inline-block;
    padding: 6px 14px;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 20px;
    color: #fff;
    text-decoration: none;
    font-size: 11px;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-view-profile:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

/* Main Content */
.cggm-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 100%;
    min-height: 0;
    width: 100%;
    min-width: 0;
    overflow: hidden;
}

/* Topbar */
.cggm-topbar {
    flex: 0 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: #fff;
    border-bottom: 1px solid var(--cggm-border);
}

.welcome-text .greeting {
    font-size: 14px;
    color: var(--cggm-text-muted);
    white-space: nowrap;
}

.welcome-text .club-name {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--cggm-text-dark);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    word-break: break-word;
}

.role-badge {
    background: var(--cggm-primary);
    color: #fff;
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
    white-space: nowrap;
    display: inline-block;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 24px;
}

.season-selector, .league-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--cggm-bg);
    padding: 2px 10px;
    border-radius: 8px;
    border: 1px solid var(--cggm-border);
    white-space: nowrap;
}

.selector-label {
    font-size: 11px;
    color: var(--cggm-text-muted);
    white-space: nowrap;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.btn-notification {
    background: none;
    border: none;
    position: relative;
    font-size: 18px;
    color: var(--cggm-text-dark);
}

.notification-dot {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 8px;
    height: 8px;
    background: #e3342f;
    border-radius: 50%;
    border: 2px solid #fff;
}

.user-profile-dropdown {
    display: flex;
    align-items: center;
    cursor: pointer;
    white-space: nowrap;
}

.topbar-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}
.topbar-avatar-placeholder {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--cggm-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--cggm-text-muted);
}

/* Dynamic Content Area */
.cggm-view-content {
    flex: 1 1 0px;
    height: auto;
    min-height: 0;
    max-height: none;
    padding: 24px;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
    outline: none !important;
}
.cggm-view-content:focus {
    outline: none !important;
}

/* Module Headers & Responsive Controls */
.cggm-module-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}
.cggm-module-header h2 {
    font-size: 22px;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--cggm-text-dark);
}

@media (max-width: 576px) {
    .cggm-module-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }
    .cggm-module-header h2 {
        font-size: 18px;
    }
    .cggm-module-header #cggm-fixture-filter-group {
        width: 100%;
        display: flex;
    }
    .cggm-module-header #cggm-fixture-filter-group .btn {
        flex: 1;
    }
}

/* Mobile Fixtures Card View */
.mobile-fixture-card {
    background: #fff;
    border-radius: var(--cggm-radius);
    padding: 16px;
    border: 1px solid var(--cggm-border);
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    margin-bottom: 12px;
    transition: all 0.2s ease;
}
.mobile-fixture-card.my-club-card {
    border-left: 4px solid var(--cggm-primary);
    background: #f8fbff;
}
.mobile-fixture-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.mobile-fixture-body {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}
.mobile-team {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 6px;
}
.mobile-team span {
    font-size: 12px;
    font-weight: 600;
    color: var(--cggm-text-dark);
    line-height: 1.2;
    word-break: break-word;
}
.mobile-vs-box {
    padding: 4px 12px;
    text-align: center;
}
.mobile-fixture-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 11px;
    color: var(--cggm-text-muted);
    border-top: 1px solid var(--cggm-border);
    padding-top: 10px;
    margin-top: 4px;
}

/* Dashboard Grid */
.cggm-dashboard-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Stats Row */
.stats-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.stat-card {
    flex: 1;
    min-width: 160px;
    background: #fff;
    border-radius: var(--cggm-radius);
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border: 1px solid var(--cggm-border);
    display: flex;
    flex-direction: column;
}

.stat-header {
    font-size: 12px;
    color: var(--cggm-text-muted);
    font-weight: 500;
    margin-bottom: 8px;
    white-space: nowrap;
}

.stat-body {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--cggm-text-dark);
}

.stat-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.stat-footer a {
    font-size: 12px;
    color: var(--cggm-primary);
    text-decoration: none;
    font-weight: 500;
}

/* Middle Row */
.middle-row {
    display: flex;
    gap: 16px;
}

.dashboard-card {
    background: #fff;
    border-radius: var(--cggm-radius);
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    border: 1px solid var(--cggm-border);
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--cggm-text-dark);
    margin: 0 0 16px 0;
}

/* Club Overview */
.club-overview-card {
    flex: 1;
    min-width: 240px;
}

.overview-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.overview-list li {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--cggm-border);
    font-size: 13px;
}
.overview-list li:last-child {
    border-bottom: none;
}

.overview-list .label {
    color: var(--cggm-text-muted);
}

/* Next Fixture Card */
.next-fixture-card {
    flex: 1.5;
    min-width: 280px;
    background: linear-gradient(135deg, #0a192f 0%, #00235b 100%);
    color: #fff;
    border: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.fixture-header h3 {
    margin: 0 0 4px 0;
    font-size: 15px;
    font-weight: 600;
    color: #ffffff !important;
}
.fixture-header p {
    margin: 0;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8) !important;
}

.fixture-teams {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 20px 0;
}

.fixture-teams .team {
    text-align: center;
    width: 40%;
}
.fixture-teams .team img, .placeholder-logo {
    width: 54px;
    height: 54px;
    margin: 0 auto 10px auto;
    object-fit: contain;
}
.placeholder-logo {
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: bold;
}
.fixture-teams .team span {
    display: block;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
    word-break: break-word;
}
.fixture-teams .vs {
    font-size: 20px;
    font-weight: 800;
    opacity: 0.5;
}

.fixture-details {
    text-align: center;
    margin-bottom: 16px;
}
.fixture-details .datetime {
    margin: 0;
    font-size: 13px;
    font-weight: 500;
}
.fixture-details .venue {
    margin: 4px 0 0 0;
    font-size: 12px;
    opacity: 0.7;
}

.fixture-countdown {
    display: flex;
    justify-content: center;
    gap: 16px;
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 16px;
}

.time-box {
    text-align: center;
}
.time-box .num {
    display: block;
    font-size: 20px;
    font-weight: 700;
    line-height: 1;
}
.time-box .lbl {
    font-size: 11px;
    opacity: 0.7;
    margin-top: 4px;
    display: block;
    text-transform: uppercase;
}

/* Recent Activity */
.recent-activity-card {
    flex: 1.2;
    min-width: 240px;
}

.activity-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.activity-list li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding-bottom: 16px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--cggm-border);
}
.activity-list li:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.activity-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 12px;
    flex-shrink: 0;
}

.activity-text p {
    margin: 0 0 4px 0;
    font-size: 13px;
    color: var(--cggm-text-dark);
    font-weight: 500;
}
.activity-text span {
    font-size: 11px;
    color: var(--cggm-text-muted);
}

/* Bottom Row */
.bottom-row {
    display: flex;
    gap: 16px;
}

.points-progress-card {
    flex: 2;
    min-width: 300px;
}

.quick-actions-card {
    flex: 1.5;
    min-width: 260px;
}

.quick-actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.action-btn {
    background: #fff;
    border: 1px solid var(--cggm-border);
    padding: 12px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 500;
    color: var(--cggm-text-dark);
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.action-btn:hover {
    border-color: var(--cggm-primary);
    background: #f8fbff;
}

.action-btn i {
    font-size: 18px;
}

/* ============================================================
   RESPONSIVE MEDIA QUERIES (Mobile & Tablet)
   ============================================================ */

@media (max-width: 991px) {
    body.cggm-dashboard-page, body.cggm-player-dashboard-page {
        overflow: auto !important;
    }

    .cggm-app-container {
        position: relative !important;
        width: 100% !important;
        height: auto !important;
        min-height: 100vh;
        overflow: visible !important;
    }

    .cggm-sidebar {
        position: fixed;
        top: 0;
        left: -280px;
        width: 260px;
        height: 100vh;
        z-index: 9999;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.3);
    }
    .cggm-sidebar.show, .cggm-sidebar.active {
        left: 0;
    }

    .cggm-brand {
        justify-content: space-between;
    }

    .cggm-main {
        width: 100% !important;
        min-width: 100% !important;
        height: auto !important;
        overflow: visible !important;
        display: flex !important;
        flex-direction: column !important;
    }

    .cggm-topbar {
        position: relative !important;
        width: 100% !important;
        flex: 0 0 auto !important;
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
        padding: 14px 16px;
    }

    .cggm-view-content {
        flex: 1 1 auto !important;
        height: auto !important;
        min-height: auto !important;
        max-height: none !important;
        overflow: visible !important;
        overflow-y: visible !important;
        overflow-x: hidden !important;
        padding: 16px 12px !important;
        box-sizing: border-box !important;
        display: block !important;
    }

    .topbar-left {
        display: flex;
        align-items: center;
        gap: 12px;
        width: 100%;
    }

    .topbar-right {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        width: 100%;
    }

    .season-selector, .league-selector {
        flex: 1;
        min-width: 125px;
    }

    .middle-row, .bottom-row {
        flex-direction: column;
    }

    .club-overview-card, .next-fixture-card, .recent-activity-card, .points-progress-card, .quick-actions-card {
        width: 100% !important;
        flex: none !important;
    }
}

@media (max-width: 768px) {
    .cggm-view-content {
        padding: 14px 10px !important;
    }

    .stats-row {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .fixture-teams {
        flex-direction: column;
        gap: 16px;
    }
    .fixture-teams .team {
        width: 100%;
    }

    .fixture-countdown {
        gap: 8px;
    }
    .time-box .num {
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .stats-row {
        grid-template-columns: 1fr;
    }

    .quick-actions-grid {
        grid-template-columns: 1fr;
    }

    .welcome-text .club-name {
        font-size: 16px;
    }

    .topbar-right {
        flex-direction: column;
        align-items: stretch;
    }

    .topbar-actions {
        justify-content: space-between;
        width: 100%;
        padding-top: 6px;
    }
}
