/* ============================================
   LAYOUT.CSS - Layout Components
   ============================================ */

/* ===== Content Body ===== */
.content-body {
    padding: .1rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
}

.page-container {
    width: 100%;
    margin: 0 auto;
}

.dashboard-container {
    width: 100%;
    margin: 0 auto;
}

/* ===== Fixed Header ===== */
.fixed-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding-top: env(safe-area-inset-top, 0px);
    background: var(--card);
    border-bottom: 1px solid var(--v0-gray-200);
    z-index: 1000;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.ita-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.header-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--v0-gray-1000);
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    color: var(--primary);
    margin-top: 0.25rem;
}

.header-icons {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.help-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--v0-gray-500);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
    font-size: 1.1rem;
}

.help-icon:hover {
    background: var(--v0-gray-100);
    color: var(--primary);
}

.hamburger-menu {
    position: relative;
}

.hamburger-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--v0-gray-700);
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
}

.hamburger-icon:hover {
    background: var(--v0-gray-100);
}

.menu-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    background: var(--card);
    border: 1px solid var(--v0-gray-200);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    z-index: 1001;
    display: none;
    overflow: hidden;
}

.menu-dropdown.active {
    display: block;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--v0-gray-1000);
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 1px solid var(--v0-gray-200);
    white-space: nowrap;
}

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

.menu-item:hover {
    background: var(--v0-gray-100);
}

.menu-item i {
    width: 20px;
    text-align: center;
    color: var(--v0-gray-500);
}

.menu-item:hover i {
    color: var(--primary);
}

.menu-item span {
    font-size: 0.875rem;
    font-weight: 500;
}

/* ===== Wrapper ===== */
#wrapper {
    margin-top: calc(50px + env(safe-area-inset-top, 0px));
    padding: 1rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

@media (min-width: 769px) {
    #wrapper {
        margin-top: calc(100px + env(safe-area-inset-top, 0px));
    }
}

/* ===== Section Headers ===== */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--v0-gray-200);
}

.section-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--v0-gray-1000);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-title i {
    color: var(--primary);
}

/* ===== Stats Grid ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

/* ===== Matches Grid ===== */
.matches-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.matches-section {
    margin-top: 1rem;
}

.match-count {
    color: var(--v0-gray-500);
    font-size: 0.875rem;
}

/* ===== Match Header ===== */
.match-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0;
    padding: 1rem;
    background: var(--v0-gray-100);
    border-bottom: 1px solid var(--v0-gray-200);
}

.dark .match-header {
    background: var(--v0-gray-200);
    border-bottom-color: var(--v0-gray-300);
}

.match-meta {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.match-actions {
    display: flex;
    gap: 0.5rem;
}

.match-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--v0-gray-200);
    font-size: 0.875rem;
    color: var(--v0-gray-500);
}

.match-date,
.match-venue {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ===== Teams Container ===== */
.teams-container {
    margin-bottom: 1rem;
}

.team-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
}

.team-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
}

.team-logo {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: contain;
    background: white;
    padding: 6px;
    border: 2px solid var(--border);
    flex-shrink: 0;
}

.team-logo-fallback {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(30, 136, 229, 0.2), rgba(30, 136, 229, 0.1));
    border: 2px solid rgba(30, 136, 229, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: var(--primary);
    flex-shrink: 0;
}

.team-logo-small {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    object-fit: contain;
    padding: 4px;
    border: 1px solid var(--v0-gray-200);
}

.team-name {
    font-weight: 600;
    font-size: 1rem;
    color: var(--v0-gray-1000);
}

.ranking {
    color: var(--v0-gray-500);
    font-size: 0.875rem;
}

.score-display {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--v0-gray-900);
    min-width: 40px;
    text-align: center;
}

/* ===== Users Section ===== */
.users-section {
    background: var(--card);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--v0-gray-200);
    overflow-x: auto;
}

.users-table-wrapper {
    width: 100%;
    min-width: 100%;
    overflow-x: auto;
}

.user-name {
    font-weight: 600;
    color: var(--v0-gray-1000);
}

.user-email {
    color: var(--v0-gray-500);
    font-size: 0.8125rem;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .page-container {
        margin-top: 30px;
    }

    .content-body {
        padding: 0.1rem;
    }
    
    /* Reduce wrapper padding on mobile */
    #wrapper {
        padding: 0.5rem;
    }
    
    .filter-bar-content {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        padding-bottom: 0.5rem;
        margin-bottom: 0.75rem;
    }
    
    .section-title {
        font-size: 1rem;
    }
    
    /* Reduce users section padding */
    .users-section {
        padding: 0.75rem;
        border-radius: 10px;
    }
    
    .dashboard-container {
        padding: 0;
    }
}

