/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.site-header {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
}

.nav-brand a {
    font-size: 24px;
    font-weight: bold;
    color: #667eea;
    text-decoration: none;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 25px;
    align-items: center;
}

.nav-menu a {
    text-decoration: none;
    color: #333;
    font-weight: 500;
    transition: color 0.3s;
}

.nav-menu a:hover {
    color: #667eea;
}

.btn-logout {
    background: #ef4444;
    color: white !important;
    padding: 8px 20px;
    border-radius: 6px;
}

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

/* Login Page */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.login-box {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.logo {
    text-align: center;
    margin-bottom: 30px;
}

.logo h1 {
    color: #667eea;
    margin-bottom: 5px;
}

.logo p {
    color: #666;
    font-size: 14px;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
}

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

.form-group small {
    display: block;
    margin-top: 5px;
    color: #666;
    font-size: 12px;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: all 0.3s;
}

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

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

.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
}

.btn-block {
    width: 100%;
    text-align: center;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

/* Alerts */
.alert {
    padding: 12px 15px;
    border-radius: 6px;
    margin-bottom: 20px;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.alert-success a {
    color: #065f46;
    font-weight: 600;
}

.login-footer {
    text-align: center;
    margin-top: 20px;
    color: #666;
}

.login-footer a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
}

/* Dashboard */
.dashboard-header {
    background: white;
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.dashboard-header h1 {
    color: #333;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    text-align: center;
}

.stat-value {
    font-size: 32px;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 5px;
}

.stat-label {
    color: #666;
    font-size: 14px;
}

/* Sections */
.section {
    background: white;
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.section h2 {
    margin-bottom: 20px;
    color: #333;
}

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

.match-card {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px;
    background: #fafafa;
    transition: all 0.3s;
}

.match-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.match-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.match-number {
    font-weight: 600;
    color: #667eea;
}

.match-status {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.status-upcoming {
    background: #dbeafe;
    color: #1e40af;
}

.status-live {
    background: #fef3c7;
    color: #92400e;
}

.status-completed {
    background: #d1fae5;
    color: #065f46;
}

.match-teams {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
}

.team {
    flex: 1;
    text-align: center;
}

.team-name {
    font-weight: bold;
    font-size: 18px;
    color: #333;
}

.vs {
    padding: 0 10px;
    color: #999;
    font-weight: bold;
}

.match-info {
    margin-bottom: 15px;
    text-align: center;
}

.match-venue {
    font-size: 13px;
    color: #666;
}

.match-date {
    font-size: 12px;
    color: #999;
    margin-top: 3px;
}

.match-actions {
    text-align: center;
}

.team-locked {
    color: #059669;
    font-weight: 600;
}

.team-missed {
    color: #dc2626;
    font-weight: 600;
}

/* Results List */
.results-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: #fafafa;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.result-match {
    flex: 1;
    color: #333;
}

.result-score {
    display: flex;
    gap: 15px;
    align-items: center;
}

.points {
    font-weight: bold;
    color: #667eea;
    font-size: 16px;
}

.rank {
    color: #666;
    font-size: 14px;
}

.no-team {
    color: #999;
    font-size: 14px;
}

/* Team Builder */
.team-builder {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.match-info-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid #e5e7eb;
}

.match-info-header h1 {
    color: #333;
    margin-bottom: 10px;
}

.match-details h2 {
    color: #667eea;
    margin-bottom: 5px;
}

.match-details p {
    color: #666;
    font-size: 14px;
}

.team-selection-info {
    display: flex;
    justify-content: center;
    gap: 40px;
    margin-bottom: 30px;
    padding: 20px;
    background: #f9fafb;
    border-radius: 8px;
}

.info-item {
    text-align: center;
}

.info-label {
    display: block;
    font-size: 13px;
    color: #666;
    margin-bottom: 5px;
}

.info-value {
    display: block;
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

.players-container {
    margin-bottom: 30px;
}

.players-container h3 {
    margin-bottom: 10px;
    color: #333;
}

.helper-text {
    color: #666;
    font-size: 14px;
    margin-bottom: 20px;
}

.players-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
}

.player-card {
    position: relative;
    padding: 15px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    background: white;
    cursor: pointer;
    transition: all 0.3s;
}

.player-card:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.player-card.selected {
    border-color: #667eea;
    background: #ede9fe;
}

.player-card.captain {
    border-color: #fbbf24;
    background: #fef3c7;
}

.player-card.vice-captain {
    border-color: #c084fc;
    background: #f3e8ff;
}

.player-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    background: #667eea;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

.player-card.captain .player-badge {
    background: #fbbf24;
    color: #78350f;
}

.player-card.vice-captain .player-badge {
    background: #c084fc;
    color: white;
}

.player-info {
    padding-right: 30px;
}

.player-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.player-meta {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #666;
}

.player-team {
    font-weight: 600;
}

.player-role {
    color: #999;
}

.team-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    padding-top: 20px;
    border-top: 2px solid #e5e7eb;
}

/* Leaderboard */
.leaderboard-header {
    background: white;
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    text-align: center;
}

.user-rank-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.user-rank-card h3 {
    margin-bottom: 20px;
    text-align: center;
}

.rank-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 20px;
}

.rank-item {
    text-align: center;
}

.rank-label {
    display: block;
    font-size: 13px;
    opacity: 0.9;
    margin-bottom: 5px;
}

.rank-value {
    display: block;
    font-size: 28px;
    font-weight: bold;
}

.leaderboard-table-container {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow-x: auto;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
}

.leaderboard-table thead {
    background: #f9fafb;
}

.leaderboard-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #e5e7eb;
}

.leaderboard-table td {
    padding: 15px;
    border-bottom: 1px solid #e5e7eb;
}

.leaderboard-table tbody tr:hover {
    background: #f9fafb;
}

.highlight-row {
    background: #ede9fe !important;
}

.rank-cell {
    font-weight: bold;
    color: #667eea;
}

.medal {
    font-size: 24px;
}

.username-cell {
    font-weight: 600;
}

.you-badge {
    background: #667eea;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    margin-left: 8px;
}

.points-cell {
    font-weight: bold;
    color: #667eea;
}

/* My Teams */
.page-header {
    background: white;
    padding: 30px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.page-header h1 {
    color: #333;
    margin-bottom: 5px;
}

.page-header p {
    color: #666;
}

.teams-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.team-card-detail {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden;
}

.team-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.team-card-header h3 {
    color: #333;
    margin-bottom: 5px;
}

.team-card-body {
    padding: 20px;
}

.team-stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.stat {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 13px;
    color: #666;
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    font-size: 18px;
    font-weight: bold;
    color: #333;
}

.team-actions-row {
    display: flex;
    justify-content: center;
    gap: 10px;
    padding-top: 15px;
    border-top: 1px solid #e5e7eb;
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 40px;
    color: #999;
}

.empty-state-large {
    background: white;
    padding: 60px 40px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

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

.empty-state-large h2 {
    color: #333;
    margin-bottom: 10px;
}

.empty-state-large p {
    color: #666;
    margin-bottom: 20px;
}

/* Responsive */
@media (max-width: 768px) {
    .nav-menu {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    
    .matches-grid {
        grid-template-columns: 1fr;
    }
    
    .players-grid {
        grid-template-columns: 1fr;
    }
    
    .team-selection-info {
        flex-direction: column;
        gap: 15px;
    }
    
    .team-card-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .leaderboard-table-container {
        padding: 15px;
    }
    
    .leaderboard-table {
        font-size: 14px;
    }
    
    .leaderboard-table th,
    .leaderboard-table td {
        padding: 10px 5px;
    }
}
