/* ===== RESET & BASE STYLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #1f2937;
    background: linear-gradient(135deg, #D4FF00 40%, #F012BE 100%);
    min-height: 100vh;
}

/* ===== MAIN LAYOUT ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding-top: 90px; /* Отступ для фиксированного header */
}

.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ===== HEADER STYLES ===== */
.main-header {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 0;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
}

/* Логотип */
.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.logo:hover {
    transform: scale(1.05);
}

.logo:hover .logo-svg {
    transform: rotate(5deg) scale(1.1);
}

.logo-link {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
}

.logo-icon {
    display: flex;
    align-items: center;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.logo-svg {
    height: 28px;
    transition: transform 0.2s ease;
}

/* Правая часть header */
.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
    height: 100%;
    min-height: 70px;
}

/* Информация о пользователе */
.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f012bc30;
    padding: 0 16px;
    border-radius: 25px;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    height: 44px;
    box-sizing: border-box;
}

.user-info:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

.user-avatar {
    font-size: 1.5rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    flex-shrink: 0;
}

.user-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.user-nickname {
    font-size: 0.9rem;
    font-weight: 600;
    color: rgb(0, 0, 0);
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-team {
    font-size: 0.75rem;
    color: rgba(0, 0, 0, 0.8);
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Кнопка входа */
.btn-login {
    background: #f012bc30;
    color: black;
    padding: 0 20px;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    height: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    line-height: 1;
    vertical-align: middle;
}

.btn-login:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Выпадающее меню */
.dropdown-menu {
    position: relative;
    height: 44px;
    display: flex;
    align-items: center;
}

.menu-toggle {
    background: #f012bc30;
    border: 0px solid rgba(0, 0, 0, 0.3);
    color: rgb(0, 0, 0);
    padding: 10px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    box-sizing: border-box;
}

.menu-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.menu-icon {
    font-size: 1.2rem;
    font-weight: 600;
}

.dropdown-content {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1001;
    margin-top: 8px;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.dropdown-content.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    color: #374151;
    text-decoration: none;
    font-weight: 500;
    transition: background-color 0.2s ease;
    border-bottom: 1px solid #f3f4f6;
}

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

.dropdown-item:hover {
    background-color: #f9fafb;
    color: #667eea;
}

.item-icon {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
}

/* Стрелка для выпадающего меню */
.dropdown-content::before {
    content: '';
    position: absolute;
    top: -6px;
    right: 16px;
    width: 12px;
    height: 12px;
    background: white;
    transform: rotate(45deg);
    border-left: 1px solid rgba(0, 0, 0, 0.1);
    border-top: 1px solid rgba(0, 0, 0, 0.1);
}

/* ===== FORM STYLES ===== */
.form-container {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 600px;
    margin-bottom: 30px;
}

.main-text {
    text-align: center;
    border-radius: 20px;
    padding: 20px;
    width: 100%;
    max-width: 600px;
    margin-bottom: 20px;
}

.main-text-pinkword {
    color: #F012BE;
}

.game-form {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-group label {
    font-weight: 600;
    color: #374151;
    font-size: 0.95rem;
}

.form-group input {
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #f9fafb;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group select {
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: #f9fafb;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

.form-group select:focus {
    outline: none;
    border-color: #667eea;
    background-color: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group select option {
    padding: 8px 12px;
    background: white;
    color: #374151;
}

.form-group small {
    color: #6b7280;
    font-size: 0.85rem;
    margin-top: 4px;
}

.payment-control .payment-toggle-row {
    display: flex;
    align-items: center;
    gap: 16px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 12px 16px;
}

.payment-control .toggle-description {
    flex: 1;
    color: #374151;
    font-weight: 500;
}

.payment-control .toggle-state {
    font-weight: 600;
    color: #16a34a;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 24px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-switch .slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: #c7c7c7;
    transition: .2s;
    border-radius: 24px;
}

.toggle-switch .slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .2s;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .slider {
    background-color: #10b981;
}

.toggle-switch input:checked + .slider:before {
    transform: translateX(22px);
}

/* ===== BUTTON STYLES ===== */
.btn {
    padding: 14px 28px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: linear-gradient(135deg, #F012BE 0%, #D4FF00 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: linear-gradient(135deg, #F012BE 0%, #D4FF00 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.btn-small {
    padding: 8px 16px;
    font-size: 0.9rem;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* Loading spinner */
.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ===== RESULT & ERROR CONTAINERS ===== */
.result-container, .error-container {
    width: 100%;
    max-width: 600px;
    margin-bottom: 30px;
}

.result-card, .error-card {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    text-align: center;
    position: relative;
}

/* Close button */
.btn-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #6b7280;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.btn-close:hover {
    background: #f3f4f6;
    color: #374151;
}

.result-icon, .error-icon {
    font-size: 3rem;
    margin-bottom: 20px;
}

.result-card h3 {
    color: #059669;
    margin-bottom: 20px;
    font-size: 1.5rem;
}

.error-card h3 {
    color: #dc2626;
    margin-bottom: 20px;
    font-size: 1.5rem;
}

/* Link display */
.link-container {
    margin: 0px 0;
}

.link-actions {
    align-items: center;
    gap: 12px;
    margin-top: 10px;
}

.link-actions .btn-primary {
    background: #ff9dd4;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    white-space: nowrap;
    font-weight: 500;
}

.link-actions .btn-primary:hover {
    background: #ff9dd4;
    transform: translateY(-1px);
}

.btn-copy {
    background: #ff9dd4;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.btn-copy:hover {
    background: #ff9dd4;
    transform: translateY(-1px);
}

.link-display {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f3f4f6;
    padding: 16px;
    border-radius: 12px;
    margin-top: 10px;
}

.link-display.large {
    padding: 20px;
    font-size: 1.1rem;
    flex-direction: column;
}

.link-text {
    font-family: 'Monaco', 'Menlo', monospace;
    font-weight: 600;
    color: #1f2937;
    flex: 1;
    word-break: break-all;
}


/* Game info */
.game-info {
    text-align: left;
    background: #f9fafb;
    padding: 20px;
    border-radius: 12px;
    margin-top: 20px;
}

.game-info p {
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
}

.game-info p:last-child {
    margin-bottom: 0;
}

/* Auto close info */
.auto-close-info {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e5e7eb;
    text-align: center;
}

.auto-close-info small {
    color: #6b7280;
    font-size: 0.85rem;
}

/* ===== GAMES LIST STYLES ===== */
.games-container {
    width: 100%;
    max-width: 1000px;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.game-card {
    background: white;
    border-radius: 16px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.game-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
}

.game-header {
    display: block;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e5e7eb;
}

.game-header h3 {
    font-size: 1.2rem;
    color: #1f2937;
}

.game-date {
    background: #F012BE;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.game-details p {
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.game-actions {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid #e5e7eb;
    text-align: center;
}

/* Empty state */
.empty-state {
    text-align: center;
    background: white;
    border-radius: 20px;
    padding: 60px 40px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.empty-state h3 {
    color: #374151;
    margin-bottom: 10px;
    font-size: 1.5rem;
}

.empty-state p {
    color: #6b7280;
    margin-bottom: 30px;
}

/* ===== GAME DETAILS PAGE ===== */
.game-details-container {
    width: 100%;
    max-width: 800px;
}

.game-details-card {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
}

.game-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.info-item label {
    font-weight: 600;
    color: #6b7280;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-item span {
    font-size: 1.1rem;
    color: #1f2937;
    font-weight: 500;
}

.link-section {
    margin-bottom: 40px;
    padding: 30px;
    background: #f9fafb;
    border-radius: 16px;
}

.link-section h3 {
    margin-bottom: 15px;
    color: #374151;
}

/* Информация об игре */
.game-info-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

.game-header h1 {
    margin: 0 0 16px 0;
    color: #1f2937;
    font-size: 2rem;
    font-weight: 700;
}

.game-details p {
    margin: 8px 0;
    color: #6b7280;
    font-size: 1rem;
}

.game-details strong {
    color: #374151;
    font-weight: 600;
}

/* Счетчики */
.counters-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.counter-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
    transition: transform 0.2s ease;
}

.counter-card:hover {
    transform: translateY(-2px);
}

.counter-card.playing {
    border-left: 4px solid #10b981;
}

.counter-card.maybe {
    border-left: 4px solid #f59e0b;
}

.counter-card.declined {
    border-left: 4px solid #ef4444;
}

.counter-card.reserve {
    border-left: 4px solid #f59e0b;
}

.counter-icon {
    font-size: 2rem;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #f9fafb;
}

.counter-info {
    flex: 1;
}

.counter-number {
    font-size: 2rem;
    font-weight: 700;
    color: #1f2937;
    line-height: 1;
}

.counter-label {
    font-size: 0.9rem;
    color: #6b7280;
    margin-top: 4px;
}

/* Списки игроков */
.players-lists {
    margin-bottom: 32px;
}

.players-section {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

.players-section.playing {
    border-left: 4px solid #10b981;
}

.players-section.maybe {
    border-left: 4px solid #f59e0b;
}

.players-section.declined {
    border-left: 4px solid #ef4444;
}

.players-section.reserve {
    border-left: 4px solid #f59e0b;
}

.players-section h3 {
    margin: 0 0 16px 0;
    color: #1f2937;
    font-size: 1.2rem;
    font-weight: 600;
}

.players-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.player-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 12px 16px;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    position: relative;
    transition: all 0.2s ease;
}

/* Стили для drag and drop */
.player-item[draggable="true"] {
    cursor: move;
    cursor: grab;
}

.player-item[draggable="true"]:hover {
    background: #f3f4f6;
    border-color: #667eea;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.player-item[draggable="true"]:active {
    cursor: grabbing;
}

/* Кнопка удаления игрока */
.delete-player-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    font-weight: bold;
    line-height: 1;
    opacity: 0;
    transition: all 0.2s ease;
    z-index: 10;
    padding: 0;
    flex-shrink: 0;
}

.player-item[data-status="declined"] .delete-player-btn {
    right: 8px;
}

.player-item:hover .delete-player-btn {
    opacity: 1;
}

.delete-player-btn:hover {
    background: #dc2626;
    transform: translateY(-50%) scale(1.1);
}

.delete-player-btn:active {
    transform: translateY(-50%) scale(0.95);
}

/* Стили для droppable секций */
.players-section[data-droppable="true"] {
    transition: all 0.2s ease;
}

.players-section[data-droppable="true"].drag-over {
    background: #f0f9ff;
    border-color: #667eea;
    border-width: 2px;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.3);
}

.players-section[data-droppable="true"] .players-list {
    min-height: 40px;
}

/* Стили для droppable счетчиков */
.counter-card[data-droppable-counter="true"] {
    transition: all 0.2s ease;
    cursor: default;
    position: relative;
}

.counter-card[data-droppable-counter="true"].drag-over-counter {
    background: #f0f9ff;
    border: 2px solid #667eea;
    transform: scale(1.05);
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    cursor: grabbing;
}

/* Визуальная подсказка при перетаскивании над счетчиком */
.counter-card[data-droppable-counter="true"].drag-over-counter::after {
    content: "Отпустите для перемещения";
    position: absolute;
    bottom: -35px;
    left: 50%;
    transform: translateX(-50%);
    background: #667eea;
    color: white;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    pointer-events: none;
}

.counter-card[data-droppable-counter="true"].drag-over-counter::before {
    content: "";
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #667eea;
    z-index: 1000;
    pointer-events: none;
}

.player-name {
    font-weight: 600;
    color: #374151;
    flex: 1;
    margin-right: 8px;
}

.player-item[data-status="declined"] .player-name {
    margin-right: 0;
}

.player-position {
    font-size: 0.9rem;
    color: #6b7280;
    background: #e5e7eb;
    padding: 4px 8px;
    border-radius: 4px;
}

.player-item.reserve {
    display: flex;
    justify-content: space-between;
    padding: 12px 16px;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.player-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.player-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
    min-width: 150px;
}

.player-meta:empty {
    display: none;
}

.payment-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    background: #fee2e2;
    color: #b91c1c;
    line-height: 1.5;
    min-height: 28px;
}

.payment-status.paid {
    background: #dcfce7;
    color: #166534;
}

.payment-status .payment-icon {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.payment-toggle-wrapper {
    margin-left: 4px;
}

.payment-status .toggle-switch {
    width: 38px;
    height: 20px;
}

.payment-status .toggle-switch .slider:before {
    height: 16px;
    width: 16px;
}

.payment-status .toggle-switch input:checked + .slider:before {
    transform: translateX(18px);
}

/* Форма добавления игрока */
.join-form-section {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
    margin-bottom: 32px;
}

.join-form-section h3 {
    margin: 0 0 20px 0;
    color: #1f2937;
    font-size: 1.5rem;
    font-weight: 600;
}

/* Кнопки статуса */
.status-buttons {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.status-btn {
    flex: 1;
    min-width: 140px;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background: white;
    color: #374151;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1.2rem;
}

.status-btn:hover {
    border-color: #d1d5db;
    background: #f9fafb;
}

.status-btn.active {
    border-color: #667eea;
    background: #667eea;
    color: white;
}

.status-btn.playing.active {
    border-color: #10b981;
    background: #10b981;
}

.status-btn.maybe.active {
    border-color: #f59e0b;
    background: #f59e0b;
}

.status-btn.declined.active {
    border-color: #ef4444;
    background: #ef4444;
}

.status-btn.reserve.active {
    border-color: #f59e0b;
    background: #f59e0b;
}

/* Форма */
.join-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.join-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.join-form label {
    font-weight: 600;
    color: #374151;
    font-size: 0.95rem;
}

.join-form input,
.join-form select {
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s ease;
    background: #f9fafb;
}

.join-form input:focus,
.join-form select:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.join-form select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6,9 12,15 18,9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

/* ===== AUTH STYLES ===== */
.auth-container {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
}

.auth-step {
    margin-bottom: 30px;
}

.auth-card {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    text-align: center;
}

.auth-icon {
    font-size: 3rem;
    margin-bottom: 20px;
}

.auth-card h3 {
    color: #374151;
    margin-bottom: 10px;
    font-size: 1.5rem;
}

.auth-card p {
    color: #6b7280;
    margin-bottom: 30px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.auth-links {
    margin-top: 25px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.link-secondary {
    color: #667eea;
    text-decoration: none;
    font-size: 0.9rem;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.link-secondary:hover {
    text-decoration: underline;
}

/* ===== PROFILE PAGE ===== */
.profile-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
}

.profile-card {
    background: white;
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

.profile-header {
    text-align: center;
    margin-bottom: 32px;
}

.profile-icon {
    font-size: 3rem;
    margin-bottom: 16px;
}

.profile-header h1 {
    margin: 0 0 8px 0;
    color: #1f2937;
    font-size: 2rem;
    font-weight: 700;
}

.profile-header p {
    margin: 0;
    color: #6b7280;
    font-size: 1.1rem;
}

/* Форма профиля */
.profile-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 32px;
}

.profile-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.profile-form label {
    font-weight: 600;
    color: #374151;
    font-size: 1rem;
}

/* Группа ввода с кнопками */
.input-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.input-group input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s ease;
    background: #f9fafb;
}

.input-group input:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.input-group input[readonly] {
    background: #f3f4f6;
    color: #6b7280;
}

.readonly-field {
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 1rem;
    background: #f3f4f6;
    color: #6b7280;
    cursor: not-allowed;
}

/* Кнопки редактирования */
.btn-edit, .btn-save, .btn-cancel {
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s ease;
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-edit {
    background: #f3f4f6;
    color: #374151;
}

.btn-edit:hover {
    background: #e5e7eb;
}

.btn-save {
    background: #10b981;
    color: white;
}

.btn-save:hover {
    background: #059669;
}

.btn-cancel {
    background: #ef4444;
    color: white;
}

.btn-cancel:hover {
    background: #dc2626;
}

/* Статус поля */
.field-status {
    font-size: 0.9rem;
    padding: 8px 12px;
    border-radius: 6px;
    margin-top: 4px;
}

.field-status.success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.field-status.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.field-status.loading {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.field-status.info {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
}

/* Действия профиля */
.profile-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ===== MODAL STYLES ===== */
.verification-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.verification-content {
    background: white;
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-width: 400px;
    width: 90%;
    text-align: center;
}

.verification-content h3 {
    margin-bottom: 15px;
    color: #2c3e50;
}

.verification-content p {
    margin-bottom: 20px;
    color: #7f8c8d;
}

.verification-content .form-group {
    margin-bottom: 20px;
}

.verification-content input {
    width: 100%;
    padding: 12px;
    border: 2px solid #ecf0f1;
    border-radius: 5px;
    font-size: 16px;
    text-align: center;
    letter-spacing: 2px;
}

.verification-content input:focus {
    border-color: #3498db;
    outline: none;
}

.verification-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.verification-actions .btn {
    padding: 10px 20px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
}

.verification-actions .btn-primary {
    background: #3498db;
    color: white;
}

.verification-actions .btn-secondary {
    background: #95a5a6;
    color: white;
}

.verification-actions .btn:hover {
    opacity: 0.9;
}

/* ===== UI STATE STYLES ===== */
.user-not-authenticated {
    display: none !important;
}

.user-info.user-authenticated {
    display: flex !important;
}

#userInfo.user-authenticated {
    display: flex !important;
}

#loginBtn.user-not-authenticated {
    display: none !important;
}

/* Кнопка "Войти" должна всегда использовать flex для правильного выравнивания */
#loginBtn {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* ===== FOOTER ===== */
.footer {
    text-align: center;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    .container {
        padding: 15px;
        padding-top: 80px;
    }
    
    .header-container {
        padding: 0 15px;
        height: 60px;
    }
    
    .header-right {
        gap: 15px;
    }
    
    .user-info {
        padding: 6px 12px;
    }
    
    .user-details {
        display: none;
    }
    
    .btn-login {
        padding: 8px 16px;
        font-size: 0.85rem;
        height: 40px;
        min-height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
        line-height: 1;
    }
    
    .form-container {
        padding: 25px;
    }
    
    .auth-card {
        padding: 25px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .games-grid {
        grid-template-columns: 1fr;
    }
    
    .game-info-grid {
        grid-template-columns: 1fr;
    }
    
    .counters-section {
        grid-template-columns: 1fr;
    }
    
    .status-buttons {
        flex-direction: column;
    }
    
    .status-btn {
        min-width: auto;
    }
    
    /* Стили для кнопки удаления на мобильных */
    .delete-player-btn {
        opacity: 1 !important;
        width: 28px;
        height: 28px;
        font-size: 22px;
        right: 4px;
    }
    
    .player-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    /* Применяем десктопные правила выравнивания для team-player на мобильных */
    .player-item.team-player,
    .team-player {
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 8px;
        flex-wrap: wrap;
    }
    
    /* Блок с именем игрока - слева, динамическая ширина */
    .team-player .player-info {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 6px;
        flex: 0 1 auto;
        min-width: 0;
        justify-content: flex-start;
    }
    
    .team-player .player-name {
        white-space: nowrap;
        overflow: visible;
        text-overflow: clip;
    }
    
    /* Блок с позицией и оплатой - справа */
    .team-player .player-meta {
        display: flex;
        align-items: center;
        gap: 12px;
        flex-wrap: wrap;
        justify-content: flex-end;
        min-width: 150px;
    }
    
    /* Позиция теперь в player-meta справа - унифицированные стили с десктопом */
    .team-player .player-meta .position-label {
        display: inline-flex;
        font-size: 12px;
        padding: 4px 10px;
        gap: 6px;
        white-space: nowrap;
        flex-shrink: 0;
        line-height: 1.5;
        align-items: center;
        font-weight: 500;
        min-height: 28px;
    }
    
    .team-player .player-meta .position-label .position-icon {
        margin-right: 0;
        display: inline-block;
    }
    
    /* Оплата - унифицированные стили с десктопом */
    .team-player .payment-status {
        padding: 6px 12px;
        font-size: 0.85rem;
        gap: 8px;
        width: auto;
        flex-wrap: nowrap;
        line-height: 1.5;
        display: inline-flex;
        align-items: center;
        font-weight: 600;
        min-height: 28px;
    }
    
    /* На мобильных скрываем текст оплаты, оставляем только иконку */
    .team-player .payment-icon {
        display: inline-flex;
        align-items: center;
        font-size: 0;
        line-height: 0;
        position: relative;
    }
    
    .team-player .payment-icon::before {
        content: '';
        font-size: 16px;
        line-height: 1;
    }
    
    .team-player .payment-icon.paid::before {
        content: '✅';
    }
    
    .team-player .payment-icon.unpaid::before {
        content: '💸';
    }
    
    .team-player .payment-status .toggle-switch {
        width: 38px;
        height: 20px;
        margin-left: 4px;
    }
    
    .team-player .payment-status .toggle-switch .slider:before {
        height: 16px;
        width: 16px;
    }
    
    .team-player .payment-status .toggle-switch input:checked + .slider:before {
        transform: translateX(18px);
    }
    
    /* Применяем десктопные правила выравнивания для запасных игроков на мобильных */
    .players-section.reserve .player-item.reserve {
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 8px;
        flex-wrap: wrap;
    }
    
    /* Блок с именем игрока - слева, динамическая ширина */
    .players-section.reserve .player-item.reserve .player-info {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 6px;
        flex: 0 1 auto;
        min-width: 0;
        justify-content: flex-start;
    }
    
    .players-section.reserve .player-item.reserve .player-name {
        white-space: nowrap;
        overflow: visible;
        text-overflow: clip;
    }
    
    /* Блок с позицией и оплатой - справа */
    .players-section.reserve .player-item.reserve .player-meta {
        display: flex;
        align-items: center;
        gap: 12px;
        flex-wrap: wrap;
        justify-content: flex-end;
        min-width: 150px;
    }
    
    .players-section.reserve .player-item.reserve .position-label {
        display: inline-flex;
        font-size: 12px;
        padding: 4px 10px;
        gap: 6px;
        white-space: nowrap;
        flex-shrink: 0;
        line-height: 1.5;
        align-items: center;
        font-weight: 500;
        min-height: 28px;
    }
    
    .players-section.reserve .player-item.reserve .position-label .position-icon {
        margin-right: 0;
        display: inline-block;
    }
    
    .players-section.reserve .player-item.reserve .payment-status {
        padding: 6px 12px;
        font-size: 0.85rem;
        gap: 8px;
        width: auto;
        flex-wrap: nowrap;
        line-height: 1.5;
        display: inline-flex;
        align-items: center;
        font-weight: 600;
        min-height: 28px;
    }
    
    .players-section.reserve .player-item.reserve .payment-icon {
        display: inline-flex;
        align-items: center;
        font-size: 0;
        line-height: 0;
        position: relative;
    }
    
    .players-section.reserve .player-item.reserve .payment-icon::before {
        content: '';
        font-size: 16px;
        line-height: 1;
    }
    
    .players-section.reserve .player-item.reserve .payment-icon.paid::before {
        content: '✅';
    }
    
    .players-section.reserve .player-item.reserve .payment-icon.unpaid::before {
        content: '💸';
    }
    
    .players-section.reserve .player-item.reserve .payment-status .toggle-switch {
        width: 38px;
        height: 20px;
        margin-left: 4px;
    }
    
    .players-section.reserve .player-item.reserve .payment-status .toggle-switch .slider:before {
        height: 16px;
        width: 16px;
    }
    
    .players-section.reserve .player-item.reserve .payment-status .toggle-switch input:checked + .slider:before {
        transform: translateX(18px);
    }
    
    .player-meta {
        width: 100%;
        justify-content: flex-start;
        gap: 8px;
    }
    
    .payment-status {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
    }
    
    .payment-status .toggle-switch {
        margin-left: auto;
    }
    
    /* Адаптация подсказки для счетчиков на мобильных */
    .counter-card[data-droppable-counter="true"].drag-over-counter::after {
        font-size: 11px;
        padding: 5px 10px;
        bottom: -32px;
        max-width: 90vw;
        white-space: normal;
        text-align: center;
    }
    
    .counter-card[data-droppable-counter="true"].drag-over-counter::before {
        bottom: -6px;
    }
    
    .profile-container {
        padding: 16px;
    }
    
    .profile-card {
        padding: 24px;
    }
    
    .input-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .input-group input {
        margin-bottom: 8px;
    }
    
    .btn-edit, .btn-save, .btn-cancel {
        width: 100%;
        justify-content: center;
    }
    
    .profile-actions {
        flex-direction: column;
    }
    
    .verification-actions {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    .header-container {
        padding: 0 10px;
    }
    
    .header-right {
        gap: 10px;
    }
    
    .form-container {
        padding: 20px;
    }
    
    .game-details-card {
        padding: 25px;
    }

    .main-text {
        padding: 0px;
    }
}