:root {
    --primary-color: #0b5c1c; /* Verde campo */
    --hover-color: #0a4714;
    --second-color: #ca8a04; /* Dorado mundial */
    --dark: #1e293b;
    --light: #f8fafc;
    --border: #e2e8f0;
    --text: #334155;
    --error: #ef4444;
    --success: #10b981;
}

body {
    font-family: system-ui, -apple-system, sans-serif;
    background-color: #f1f5f9;
    margin: 0;
    padding: 20px 10px;
    color: var(--text);
}

* { box-sizing: border-box; }

.container {
    max-width: 900px;
    margin: 0 auto;
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
}

.main-auth {
    max-width: 800px;
    text-align: center;
}

h1, h2, h3 {
    color: var(--dark);
    margin-top: 0;
}

h1 { font-size: 2rem; margin-bottom: 30px; color: var(--primary-color);}

/* Header Nav */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--border);
    padding-bottom: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}
header h2 { margin: 0; }
nav { display: flex; gap: 15px; flex-wrap: wrap;}
nav a {
    text-decoration: none;
    color: var(--text);
    font-weight: 600;
    padding: 8px 12px;
    border-radius: 6px;
    transition: all 0.2s;
}
nav a:hover { background-color: var(--light); color: var(--primary-color); }
nav a.active { background-color: var(--primary-color); color: white; }
nav a.admin-link { color: var(--second-color); }
nav a.logout-link { color: var(--error); border: 1px solid #fee2e2;}

/* Forms */
.auth-forms {
    display: flex;
    justify-content: center;
    gap: 40px;
    flex-wrap: wrap;
}

.card {
    background: var(--light);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 25px;
    width: 100%;
    max-width: 350px;
}

.form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    text-align: left;
}

input, select {
    padding: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.2s;
    outline: none;
}
input:focus, select:focus { border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(11, 92, 28, 0.1); }

button {
    padding: 12px 20px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}
button:hover:not(:disabled) { background-color: var(--hover-color); }
button:disabled { background-color: #94a3b8; cursor: not-allowed; }
.btn-secondary { background-color: var(--dark); }
.btn-secondary:hover:not(:disabled) { background-color: #0f172a; }
.btn-block { width: 100%; margin-top: 15px;}
.btn-update { background-color: var(--second-color); color: #fff;}

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

.match-card {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    background: #fff;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    transition: transform 0.2s;
}
.match-card:hover { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0,0,0,0.08); }
.past-match { background: #f8fafc; opacity: 0.9;}

.match-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    font-size: 0.85rem;
    color: #64748b;
    border-bottom: 1px dashed var(--border);
    padding-bottom: 10px;
}

.badge {
    padding: 4px 8px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.75rem;
}
.badge-pending { background: #e0f2fe; color: #0369a1; }
.badge-playing { background: #fef9c3; color: #854d0e; }
.badge-finished { background: #dcfce7; color: #166534; }

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

.team { flex: 1; }
.align-right { text-align: right; }
.align-left { text-align: left; }
.team-name { font-weight: bold; font-size: 1.1rem; }

.score-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 15px;
}

.score-input {
    width: 50px;
    height: 50px;
    text-align: center;
    font-size: 1.5rem;
    font-weight: bold;
    padding: 5px;
    background: var(--light);
}

.vs-text { font-weight: bold; color: #94a3b8; font-size: 0.9rem; }

.match-result {
    margin-top: 20px;
    text-align: center;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    padding: 12px;
    border-radius: 6px;
    color: #16a34a;
    font-size: 0.9rem;
}
.match-result p { margin: 5px 0 0 0; }
.points-earned { color: var(--second-color); font-weight: bold; }

/* Ranking Table */
.ranking-section { margin-top: 20px; }
.ranking-table {
    width: 100%;
    border-collapse: collapse;
}
.ranking-table th, .ranking-table td {
    padding: 15px;
    border-bottom: 1px solid var(--border);
    text-align: left;
}
.ranking-table th {
    background-color: var(--light);
    color: var(--dark);
    font-weight: 600;
}
.highlight-row { background-color: #f0fdf4; }
.points-col { font-weight: bold; color: var(--primary-color); font-size: 1.1rem;}
.p-0 { padding: 0; overflow: hidden; }

/* Alerts / Toasts */
.alert {
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-weight: 500;
}
.alert.success { background-color: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert.error { background-color: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }

#alerts {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast-alert {
    margin-bottom: 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    background: white;
    min-width: 250px;
    animation: slideUp 0.3s forwards;
    border: none;
    border-left: 5px solid;
}
.toast-alert.success { border-left-color: var(--success); }
.toast-alert.error { border-left-color: var(--error); }
.toast-content { display: flex; align-items: center; gap: 10px; }
.toast-icon { font-size: 1.2rem; }

.fade-out { opacity: 0; transition: opacity 0.3s ease; }

@keyframes slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@media (max-width: 600px) {
    .matches-grid { grid-template-columns: 1fr; }
    header { flex-direction: column; align-items: center; }
    nav { justify-content: center; }
    .auth-forms { flex-direction: column; align-items: center; }
}
