/* Общие стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    -webkit-tap-highlight-color: rgba(0,0,0,0);
}

body {
    background-color: #f5f7fa;
    color: #333;
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 88vh; 
    touch-action: manipulation;
}

/* Шапка */
.main-header {
    background: linear-gradient(135deg, #1a3a6c 0%, #0d2b4d 100%);
    color: white;
    padding: 12px 20px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    position: relative; /* Для абсолютного позиционирования user-menu */
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
}

.app-title {
    text-align: center;
}

.app-title h1 {
    font-size: 2.2rem;
    font-weight: 600;
    color: white;
    letter-spacing: 0.5px;
}

/* Блок пользователя - АБСОЛЮТНО В ПРАВОМ ВЕРХНЕМ УГЛУ */
.user-menu {
    position: absolute;
    right: 20px;
    top: 15px;
}

.user-info {
    display: flex;
    flex-direction: column; /* ВЕРТИКАЛЬНОЕ РАСПОЛОЖЕНИЕ */
    align-items: flex-end;
    gap: 5px;
}

.username {
    color: white;
    font-weight: 500;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 2px 5px;
    transition: opacity 0.3s;
    text-align: center;
}

.username:hover {
    opacity: 0.8;
    text-decoration: underline;
}

.logout-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 1.1rem;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: right;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.1);
}

/* Основной контент - ЗАНИМАЕТ ВСЁ ПРОСТРАНСТВО МЕЖДУ HEADER И FOOTER */
main {
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
}

.hero {
    text-align: center;
    padding: 3rem 5rem;
    background: linear-gradient(135deg, #1a3a6c 0%, #4fc3f7 100%);
    color: white;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-grow: 1;
}

/* КНОПКИ УЖЕ НА 15% */
.match-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(212px, 1fr));
    gap: 1.5rem;
    justify-content: center;
    width: 85%;
    max-width: 765px;
}

.match-buttons button {
    background-color: white;
    color: #1a3a6c;
    border: none;
    padding: 1.1rem;
    font-size: 1.1rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    min-height: 40px;
    width: 100%;
}

.match-buttons button:hover {
    transform: translateY(-5px);
    box-shadow: 0 7px 15px rgba(0, 0, 0, 0.3);
    background-color: #e3f2fd;
}

/* Футер - ВСЕГДА ВНИЗУ */
footer {
    flex-shrink: 0;
    text-align: center;
    padding: 0.5rem;
    background-color: #1a3a6c;
    color: white;
    position: sticky;
    bottom: 0;
}

/* Уведомления */
.global-notification {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 15px 25px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    z-index: 1000;
    transition: transform 0.3s ease-out;
    max-width: 90%;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.global-notification.show {
    transform: translateX(-50%) translateY(0);
}

.global-notification.info {
    background-color: #2196F3;
}

.global-notification.success {
    background-color: #4CAF50;
}

.global-notification.warning {
    background-color: #FF9800;
}

.global-notification.error {
    background-color: #F44336;
}

/* Индикатор загрузки */
#global-loading-indicator {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    z-index: 9999;
}

.loading-spinner {
    border: 5px solid #f3f3f3;
    border-top: 5px solid #3498db;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 2s linear infinite;
    margin-bottom: 15px;
}

.loading-text {
    font-size: 18px;
    color: #3498db;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.mini-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(79, 195, 247, 0.3);
    border-top: 2px solid #4fc3f7;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Адаптивность */
@media (max-width: 768px) {
        
    body {
        min-height: 88vh; 
    }

    .header-container {
        flex-direction: column;
        text-align: center;
        padding: 10px 0;
    }
    
    .app-title h1 {
        font-size: 1.8rem;
        margin: 10px 0;
    }
    

    .username {
        font-size: 0.9rem;
    }
    
    .match-buttons {
        grid-template-columns: 1fr;
        max-width: 100%;
        padding: 0 15px;
        width: 85%;
    }
    
    .match-buttons button {
        width: 100%;
        max-width: 100%;
        font-size: 1.3rem;
    }
    
    button, .button, .btn {
        min-width: 44px;
        min-height: 30px;
    }
    
    .player-action-btn, 
    .team-action-btn {
        width: 44px;
        height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {

    body {
        min-height: 88vh; 
    }

    .header-container {
        padding: 0 20px;
    }
    
    .match-buttons {
        grid-template-columns: repeat(2, 0.8fr);
        max-width: 595px;
        width: 85%;
    }
}

/* ---------------- мой телефон ---------------- */
@media (max-width: 480px) {

    body {
        min-height: 91vh; 
    }


    .app-title h1 {
        font-size: 2.2rem;
    }
    
    .hero {
        padding: 2rem 3rem;
        
    }
    
    .match-buttons button {
        padding: 0.7rem;
        font-size: 1rem;
        min-height: 52px;
    }
    
    .username {
        font-size: 0.8rem;
    }
    
    .logout-btn {
        font-size: 1.1rem;
        width: 32px;
        height: 32px;
    }
}