* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 20px;
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.hidden {
    display: none !important;
}

/* Auth Container */
#auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.auth-box {
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 400px;
}

.auth-box h1 {
    text-align: center;
    font-size: 3em;
    margin-bottom: 10px;
    color: #667eea;
}

.subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
}

.auth-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
}

.auth-tabs .tab-btn {
    flex: 1;
    padding: 12px;
    border: none;
    background: #f0f0f0;
    border-radius: 10px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s;
}

.auth-tabs .tab-btn.active {
    background: #667eea;
    color: white;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

input[type="text"],
input[type="email"],
input[type="password"] {
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 16px;
    transition: border-color 0.3s;
}

input:focus {
    outline: none;
    border-color: #667eea;
}

.btn-primary {
    padding: 15px;
    border: none;
    background: #667eea;
    color: white;
    border-radius: 10px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-primary:hover {
    background: #5568d3;
}

.divider {
    text-align: center;
    color: #999;
    margin: 20px 0;
    position: relative;
}

.divider::before,
.divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background: #e0e0e0;
}

.divider::before {
    left: 0;
}

.divider::after {
    right: 0;
}

.btn-google {
    width: 100%;
    padding: 15px;
    border: 2px solid #e0e0e0;
    background: white;
    border-radius: 10px;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s;
}

.btn-google:hover {
    background: #f8f8f8;
    border-color: #667eea;
}

.message {
    margin-top: 20px;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    font-size: 14px;
}

.message.success {
    background: #d4edda;
    color: #155724;
}

.message.error {
    background: #f8d7da;
    color: #721c24;
}

.message.info {
    background: #d1ecf1;
    color: #0c5460;
}

/* Main App Container */
#app-container {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    min-height: 80vh;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e0e0e0;
}

.header h1 {
    font-size: 2.5em;
    color: #667eea;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

#user-name {
    font-weight: bold;
    color: #333;
}

.btn-logout {
    padding: 10px 20px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.btn-logout:hover {
    background: #667eea;
    color: white;
}

.btn-back {
    background: #667eea;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1em;
    transition: background 0.3s;
}

.btn-back:hover {
    background: #5568d3;
}


/* Tabs */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
}

.tabs .tab-btn {
    flex: 1;
    padding: 15px;
    border: none;
    background: #f0f0f0;
    border-radius: 10px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.3s;
}

.tabs .tab-btn.active {
    background: #667eea;
    color: white;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

.tab-panel h2 {
    color: #333;
    margin-bottom: 20px;
    font-size: 1.5em;
}

.empty-message {
    text-align: center;
    color: #999;
    padding: 40px;
    font-size: 16px;
}

/* Game List */
.game-list,
.challenge-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.game-item,
.challenge-item {
    background: #f8f8f8;
    padding: 20px;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s;
}

.game-item:hover,
.challenge-item:hover {
    background: #f0f0f0;
    cursor: pointer;
}

/* Search Box */
.search-box {
    margin-bottom: 20px;
}

.search-box input {
    width: 100%;
    padding: 15px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 16px;
}

.search-box input:focus {
    outline: none;
    border-color: #667eea;
}

/* Users List */
.users-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 500px;
    overflow-y: auto;
}

.user-item {
    background: #f8f8f8;
    padding: 15px 20px;
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s;
}

.user-item:hover {
    background: #f0f0f0;
    transform: translateX(5px);
}

.user-info-display {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 20px;
    flex-shrink: 0;
}

.user-details {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.user-details .name {
    font-weight: bold;
    color: #333;
    font-size: 16px;
}

.user-details .email {
    font-size: 13px;
    color: #666;
}

.user-details .last-seen {
    font-size: 12px;
    color: #999;
    margin-top: 2px;
}

.user-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.online-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #28a745;
    box-shadow: 0 0 8px rgba(40, 167, 69, 0.5);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.offline-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #999;
}

.btn-challenge {
    padding: 10px 20px;
    border: none;
    background: #667eea;
    color: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
    white-space: nowrap;
}

.btn-challenge:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-challenge:active {
    transform: translateY(0);
}

/* Game List */
.game-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.game-item {
    background: linear-gradient(135deg, #e6f7ff 0%, #f0e6ff 100%);
    padding: 20px;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s;
    border: 2px solid transparent;
    cursor: pointer;
}

.game-item:hover {
    border-color: #667eea;
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.game-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.game-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 20px;
    flex-shrink: 0;
}

.game-details {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.game-opponent {
    font-size: 16px;
    color: #333;
}

.game-time {
    font-size: 13px;
    color: #666;
}

.game-status {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.game-score {
    font-size: 24px;
    font-weight: bold;
    color: #333;
}

.my-score {
    color: #28a745;
}

.score-separator {
    color: #999;
    margin: 0 5px;
}

.opp-score {
    color: #6c757d;
}

.turn-indicator {
    background: #28a745;
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.turn-indicator.waiting {
    background: #6c757d;
}

/* Challenge List */
.challenge-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 30px;
}

.challenge-item {
    background: linear-gradient(135deg, #fff5e6 0%, #ffe6f0 100%);
    padding: 20px;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.challenge-item:hover {
    border-color: #667eea;
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.challenge-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.challenge-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 20px;
    flex-shrink: 0;
}

.challenge-details {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.challenge-from,
.challenge-to {
    font-size: 16px;
    color: #333;
}

.challenge-time {
    font-size: 13px;
    color: #666;
}

.challenge-actions {
    display: flex;
    gap: 10px;
}

.btn-accept {
    padding: 10px 20px;
    border: none;
    background: #28a745;
    color: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
    white-space: nowrap;
}

.btn-accept:hover {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
}

.btn-reject {
    padding: 10px 20px;
    border: none;
    background: #dc3545;
    color: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
    white-space: nowrap;
}

.btn-reject:hover {
    background: #c82333;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
}

.btn-cancel {
    padding: 10px 20px;
    border: 2px solid #6c757d;
    background: white;
    color: #6c757d;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s;
    white-space: nowrap;
}

.btn-cancel:hover {
    background: #6c757d;
    color: white;
    transform: translateY(-2px);
}

/* Challenge badge on tab */
.tabs .tab-btn.has-challenges {
    position: relative;
}

.tabs .tab-btn.has-challenges::after {
    content: attr(data-count);
    position: absolute;
    top: 5px;
    right: 5px;
    background: #dc3545;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

.error-message {
    text-align: center;
    color: #dc3545;
    padding: 40px;
    font-size: 16px;
}

/* Responsive */
@media (max-width: 768px) {
    .auth-box {
        padding: 30px 20px;
    }
    
    #app-container {
        padding: 20px;
    }
    
    .header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .tabs {
        flex-direction: column;
    }
}

/* Footer Styles */
footer {
    flex-shrink: 0;
    width: 100%;
}
