/* ============================================
   EA FC Team Manager - Web Version Styles
   Dark theme, modern UI
   ============================================ */

:root {
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-card: #16162a;
    --bg-hover: #252540;
    --bg-sidebar: #111122;
    --border-color: #2a2a45;
    --text-primary: #e0e0f0;
    --text-secondary: #9090b0;
    --text-muted: #606080;
    --accent-blue: #1565c0;
    --accent-blue-hover: #1976d2;
    --accent-green: #2e7d32;
    --accent-red: #c62828;
    --accent-orange: #ef6c00;
    --accent-purple: #7c3aed;
    --win-color: #4caf50;
    --draw-color: #ff9800;
    --loss-color: #f44336;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
    --transition: all 0.2s ease;
    --sidebar-width: 220px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.5;
    overflow: hidden;
}

.hidden { display: none !important; }

/* ============================================
   LOGIN SCREEN
   ============================================ */
.login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--bg-primary) 0%, #1a1a3e 100%);
}

.login-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 48px 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-md);
    text-align: center;
}

.login-logo {
    width: 100px;
    height: 100px;
    object-fit: contain;
    margin-bottom: 16px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.login-box h1 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
}

.login-subtitle {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 28px;
}

.form-group {
    margin-bottom: 16px;
    text-align: left;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="email"],
.form-group input[type="number"],
.form-group input[type="datetime-local"],
.form-group input[type="url"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(21, 101, 192, 0.15);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-blue);
}

.form-check label {
    margin: 0;
    text-transform: none;
    font-weight: 400;
    font-size: 13px;
}

.login-error {
    color: var(--accent-red);
    font-size: 13px;
    margin-top: 12px;
    min-height: 20px;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 18px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    color: inherit;
}

.btn-primary {
    background: var(--accent-blue);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-blue-hover);
}

.btn-secondary {
    background: var(--bg-hover);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-card);
    border-color: var(--accent-blue);
    color: white;
}

.btn-success {
    background: var(--accent-green);
    color: white;
}

.btn-success:hover {
    background: #388e3c;
}

.btn-danger {
    background: var(--accent-red);
    color: white;
}

.btn-danger:hover {
    background: #b71c1c;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-outline:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 16px;
    cursor: pointer;
    transition: var(--transition);
    padding: 0;
}

.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--accent-blue);
}

.btn-icon.btn-sync {
    color: var(--accent-blue);
    border-color: rgba(21, 101, 192, 0.3);
}

.btn-icon.btn-sync:hover {
    background: rgba(21, 101, 192, 0.15);
    color: #64b5f6;
    border-color: var(--accent-blue);
}

.btn-icon.btn-danger {
    color: var(--accent-red);
    border-color: rgba(198, 40, 40, 0.3);
}

.btn-icon.btn-danger:hover {
    background: rgba(198, 40, 40, 0.15);
    color: #ef5350;
    border-color: var(--accent-red);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================
   MAIN APP LAYOUT
   ============================================ */
.main-app {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* ============================================
   SIDEBAR
   ============================================ */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 20px 16px 12px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-logo {
    width: 50px;
    height: 50px;
    object-fit: contain;
    margin-bottom: 8px;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.sidebar-team {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    word-break: break-word;
}

.sidebar-version {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 10px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: var(--transition);
    margin-bottom: 2px;
}

.nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.nav-icon {
    font-size: 16px;
    width: 22px;
    text-align: center;
}

.sidebar-footer {
    padding: 12px 10px;
    border-top: 1px solid var(--border-color);
}

.btn-sync {
    width: 100%;
    background: var(--accent-blue);
    color: white;
    margin-bottom: 8px;
}

.btn-sync:hover {
    background: var(--accent-blue-hover);
}

.sync-status {
    text-align: center;
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 10px;
    min-height: 16px;
}

/* ============================================
   LIGA SYNC CAROUSEL EN SIDEBAR
   ============================================ */
.league-sync-carousel {
    max-height: 80px;
    overflow: hidden;
    margin-bottom: 10px;
    position: relative;
}

.league-sync-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    font-size: 12px;
    border-radius: 6px;
    margin-bottom: 6px;
    transition: all 0.5s ease;
    animation: fadeSlideIn 0.5s ease;
    background: rgba(255,255,255,0.02);
    border: 1px solid transparent;
}

@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.league-sync-item .league-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-secondary);
    font-weight: 500;
}

.league-sync-item .sync-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.league-sync-item .sync-indicator.syncing {
    background: var(--accent-blue);
    animation: pulse 1s ease-in-out infinite;
    box-shadow: 0 0 8px rgba(21, 101, 192, 0.5);
}

.league-sync-item .sync-indicator.success {
    background: var(--accent-green);
    box-shadow: 0 0 8px rgba(46, 125, 50, 0.5);
}

.league-sync-item .sync-indicator.error {
    background: var(--accent-red);
    box-shadow: 0 0 8px rgba(198, 40, 40, 0.5);
}

@keyframes pulse {
    0%, 100% { 
        opacity: 1;
        transform: scale(1);
    }
    50% { 
        opacity: 0.6;
        transform: scale(0.9);
    }
}

.league-sync-item .sync-time {
    font-size: 10px;
    color: var(--text-muted);
    white-space: nowrap;
    font-weight: 500;
}

.league-sync-item .sync-progress {
    font-size: 10px;
    color: var(--accent-blue);
    font-weight: 700;
    background: rgba(21, 101, 192, 0.1);
    padding: 2px 8px;
    border-radius: 10px;
    margin-left: 8px;
}

.league-sync-item.syncing .sync-progress {
    color: var(--accent-blue);
    background: rgba(21, 101, 192, 0.15);
}

.league-sync-item.success .sync-progress {
    color: var(--accent-green);
    background: rgba(46, 125, 50, 0.1);
}

.league-sync-item.error .sync-progress {
    color: var(--accent-red);
    background: rgba(198, 40, 40, 0.1);
}

.league-sync-item.success {
    border-color: rgba(46, 125, 50, 0.3);
    background: rgba(46, 125, 50, 0.05);
}

.league-sync-item.error {
    border-color: rgba(198, 40, 40, 0.3);
    background: rgba(198, 40, 40, 0.05);
}

.league-sync-item.syncing {
    border-color: rgba(21, 101, 192, 0.3);
    background: rgba(21, 101, 192, 0.05);
}

.btn-logout {
    width: 100%;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 12px;
}

.btn-logout:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* ============================================
   CONTENT AREA
   ============================================ */
.content {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.view-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px 28px;
}

/* ============================================
   VIEW HEADERS
   ============================================ */
.view-header {
    margin-bottom: 24px;
}

.view-header h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}

.view-header p {
    color: var(--text-secondary);
    font-size: 13px;
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-bottom: 16px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

/* ============================================
   STATS
   ============================================ */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 16px;
}

.stat-item {
    text-align: center;
    padding: 12px;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

/* ============================================
   LEAGUE CARDS
   ============================================ */
.league-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    transition: var(--transition);
}

.league-card:hover {
    border-color: var(--accent-blue);
    box-shadow: var(--shadow-sm);
}

.league-card-name {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 6px;
}

.league-card-meta {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.league-card-status {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
    margin-top: 8px;
}

.status-active {
    background: rgba(46, 125, 50, 0.2);
    color: #81c784;
}

.status-inactive {
    background: rgba(96, 96, 128, 0.2);
    color: var(--text-muted);
}

.league-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px 12px;
    margin-top: -4px;
}

/* ============================================
   TABLES
   ============================================ */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

thead {
    background: var(--bg-secondary);
}

th {
    text-align: left;
    padding: 12px 14px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

td {
    padding: 12px 14px;
    border-top: 1px solid var(--border-color);
    color: var(--text-primary);
}

tr:hover td {
    background: var(--bg-hover);
}

/* ============================================
   MATCH ROWS
   ============================================ */
.match-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    transition: var(--transition);
}

.match-row:hover {
    border-color: var(--accent-blue);
}

.match-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.match-result {
    font-size: 16px;
    font-weight: 700;
}

.result-W { color: var(--win-color); }
.result-D { color: var(--draw-color); }
.result-L { color: var(--loss-color); }

.match-rival {
    font-weight: 600;
}

.match-meta {
    font-size: 12px;
    color: var(--text-secondary);
}

/* ============================================
   CALENDAR
   ============================================ */
.calendar-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 20px;
    height: calc(100vh - 120px);
}

.team-logo {
    width: 42px;
    height: 42px;
    object-fit: contain;
    border-radius: 4px;
    background: var(--bg-secondary);
    padding: 2px;
}

.calendar-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    overflow-y: auto;
}

.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.cal-day-header {
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 8px 0;
}

.cal-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
    position: relative;
}

.cal-day:hover {
    background: var(--bg-hover);
}

.cal-day.empty {
    cursor: default;
}

.cal-day.today {
    border-color: var(--accent-blue);
    font-weight: 700;
}

.cal-day.selected {
    background: var(--accent-blue);
    color: white;
}

.cal-day.has-matches::after {
    content: '';
    position: absolute;
    bottom: 4px;
    width: 4px;
    height: 4px;
    background: var(--accent-orange);
    border-radius: 50%;
}

.cal-day .match-count {
    font-size: 9px;
    color: var(--accent-orange);
    margin-top: 2px;
}

.cal-day.selected .match-count {
    color: rgba(255,255,255,0.8);
}

.matches-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    overflow-y: auto;
}

.matches-panel h3 {
    font-size: 16px;
    margin-bottom: 12px;
}

.match-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    border-left: 3px solid var(--border-color);
}

.match-card.played-W { border-left-color: var(--win-color); }
.match-card.played-D { border-left-color: var(--draw-color); }
.match-card.played-L { border-left-color: var(--loss-color); }

.match-card-teams {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
}

.team-block {
    text-align: center;
    min-width: 100px;
}

.team-block .team-name {
    font-size: 12px;
    font-weight: 600;
    margin-top: 6px;
}

.match-card-center {
    text-align: center;
    min-width: 80px;
}

.match-score {
    font-size: 22px;
    font-weight: 700;
}

.match-hour {
    font-size: 20px;
    font-weight: 700;
}

.match-time-remaining {
    font-size: 11px;
    color: var(--accent-orange);
    margin-top: 2px;
}

/* ============================================
   STANDINGS
   ============================================ */

.standings-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.standings-tab {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
}

.standings-tab:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.standings-tab.active {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: white;
    font-weight: 600;
}

/* ============================================
   RESULTS TABS & STATS
   ============================================ */

.results-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.results-tab {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
}

.results-tab:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.results-tab.active {
    background: var(--accent-blue);
    border-color: var(--accent-blue);
    color: white;
    font-weight: 600;
}

.results-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 8px;
}

.results-form {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    padding: 0 4px;
}

.results-table .results-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
    border-radius: 4px;
    background: var(--bg-secondary);
    padding: 2px;
    vertical-align: middle;
}

.results-table .team-cell {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.standings-table .pos {
    font-weight: 700;
    width: 40px;
    text-align: center;
}

.standings-table .team-cell {
    display: flex;
    align-items: center;
    gap: 8px;
}

.standings-table .team-logo {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.standings-table .highlight-row {
    background: rgba(21, 101, 192, 0.1);
}

/* ============================================
   ROSTER
   ============================================ */
.roster-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 20px;
    height: calc(100vh - 120px);
}

.roster-detail {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    text-align: center;
    overflow-y: auto;
}

.roster-avatar {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 64px;
    margin: 0 auto 16px;
    overflow: hidden;
}

.roster-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.roster-name {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 4px;
}

.roster-info {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 12px;
}

.roster-position {
    display: inline-block;
    padding: 4px 14px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    color: white;
    margin-bottom: 16px;
}

.pos-GK { background: #f59e0b; }
.pos-DEF, .pos-LB, .pos-CB, .pos-RB { background: #3b82f6; }
.pos-MID, .pos-CDM, .pos-CM, .pos-CAM, .pos-LM, .pos-RM { background: #10b981; }
.pos-FWD, .pos-LW, .pos-RW, .pos-ST, .pos-CF { background: #ef4444; }

.roster-table-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ============================================
   TACTICS BOARD
   ============================================ */
.tactics-layout {
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 20px;
    height: calc(100vh - 120px);
}

.tactics-sidebar {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 16px;
    overflow-y: auto;
}

.tactics-field {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tactics-field-inner {
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, #1b5e20 0%, #2e7d32 50%, #1b5e20 100%);
    position: relative;
}

.field-line {
    position: absolute;
    border: 2px solid rgba(255,255,255,0.4);
}

.field-center-line {
    top: 50%;
    left: 5%;
    right: 5%;
    height: 0;
    border-top: 2px solid rgba(255,255,255,0.4);
    border-bottom: none;
}

.field-center-circle {
    top: 50%;
    left: 50%;
    width: 80px;
    height: 80px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
}

.field-area {
    position: absolute;
    left: 15%;
    right: 15%;
    height: 18%;
    border: 2px solid rgba(255,255,255,0.4);
}

.field-area.top { top: 2%; }
.field-area.bottom { bottom: 2%; }

.player-dot {
    position: absolute;
    width: 36px;
    height: 36px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    color: #1a1a2e;
    cursor: grab;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    transform: translate(-50%, -50%);
    user-select: none;
}

.player-dot:hover {
    transform: translate(-50%, -50%) scale(1.1);
}

/* ============================================
   MODALS
   ============================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-md);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
}

/* ============================================
   TOASTS
   ============================================ */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 14px 18px;
    min-width: 280px;
    box-shadow: var(--shadow-md);
    animation: toastIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast.success { border-left: 3px solid var(--win-color); }
.toast.error { border-left: 3px solid var(--accent-red); }
.toast.warning { border-left: 3px solid var(--draw-color); }
.toast.info { border-left: 3px solid var(--accent-blue); }

@keyframes toastIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes toastOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

/* ============================================
   BADGES
   ============================================ */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.badge-blue { background: rgba(21, 101, 192, 0.2); color: #64b5f6; }
.badge-green { background: rgba(46, 125, 50, 0.2); color: #81c784; }
.badge-red { background: rgba(198, 40, 40, 0.2); color: #ef5350; }
.badge-orange { background: rgba(239, 108, 0, 0.2); color: #ffb74d; }
.badge-purple { background: rgba(124, 58, 237, 0.2); color: #b39ddb; }

/* ============================================
   UTILITIES
   ============================================ */
.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.flex { display: flex; }
.flex-between { justify-content: space-between; }
.flex-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }

.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }

.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-sm { font-size: 12px; }
.text-lg { font-size: 16px; }
.font-bold { font-weight: 700; }

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */

.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 1100;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
}

.mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 998;
}

.mobile-overlay.active {
    display: block;
}

.mobile-header {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    min-height: 56px;
}

.mobile-header-title {
    font-size: 16px;
    font-weight: 700;
    margin-left: 44px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Tablets and small desktops */
@media (max-width: 1024px) {
    .calendar-layout,
    .roster-layout,
    .tactics-layout {
        grid-template-columns: 1fr;
        height: auto;
        min-height: calc(100vh - 120px);
    }

    .roster-detail,
    .tactics-sidebar {
        max-height: 400px;
    }
}

/* Mobile phones */
@media (max-width: 768px) {
    html, body {
        overflow: hidden;
        font-size: 13px;
    }

    .mobile-menu-toggle {
        display: flex;
    }

    .mobile-header {
        display: flex;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        z-index: 999;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        width: 260px;
        box-shadow: 4px 0 16px rgba(0,0,0,0.5);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-app {
        flex-direction: column;
    }

    .content {
        width: 100vw;
    }

    .view-container {
        padding: 12px;
        height: calc(100vh - 56px);
    }

    .login-box {
        padding: 32px 20px;
        margin: 16px;
    }

    .login-logo {
        width: 72px;
        height: 72px;
    }

    .login-box h1 {
        font-size: 18px;
    }

    .view-header h2 {
        font-size: 18px;
    }

    .view-header {
        margin-bottom: 16px;
    }

    .card {
        padding: 14px;
        margin-bottom: 12px;
    }

    .card-grid {
        grid-template-columns: 1fr;
    }

    .stats-row {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .stat-value {
        font-size: 20px;
    }

    .match-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
        padding: 10px 12px;
    }

    .match-info {
        width: 100%;
        justify-content: space-between;
    }

    .match-card {
        flex-direction: column;
        gap: 10px;
        padding: 12px;
    }

    .match-card-teams {
        width: 100%;
        justify-content: space-between;
    }

    .team-block {
        min-width: 70px;
    }

    .match-card-center {
        min-width: auto;
        display: flex;
        align-items: center;
        gap: 12px;
    }

    .match-score {
        font-size: 18px;
    }

    .calendar-layout {
        grid-template-columns: 1fr;
        height: auto;
        gap: 12px;
    }

    .calendar-panel,
    .matches-panel {
        padding: 12px;
    }

    .calendar-grid {
        gap: 2px;
    }

    .cal-day {
        font-size: 11px;
    }

    .roster-layout {
        grid-template-columns: 1fr;
        height: auto;
        gap: 12px;
    }

    .roster-detail {
        padding: 16px;
    }

    .roster-avatar {
        width: 120px;
        height: 120px;
        font-size: 48px;
    }

    .roster-name {
        font-size: 16px;
    }

    .tactics-layout {
        grid-template-columns: 1fr;
        height: auto;
        gap: 12px;
    }

    .tactics-sidebar {
        padding: 12px;
        max-height: 350px;
    }

    .tactics-field {
        min-height: 300px;
    }

    .player-dot {
        width: 28px;
        height: 28px;
        font-size: 9px;
    }

    .standings-tabs,
    .results-tabs {
        gap: 6px;
    }

    .standings-tab,
    .results-tab {
        padding: 5px 10px;
        font-size: 12px;
    }

    .results-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        padding: 12px;
    }

    th, td {
        padding: 8px 10px;
        font-size: 12px;
    }

    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .modal-overlay {
        padding: 12px;
        align-items: flex-end;
    }

    .modal-content {
        max-height: 85vh;
        border-radius: var(--radius-md) var(--radius-md) 0 0;
    }

    .modal-header,
    .modal-body,
    .modal-footer {
        padding: 16px;
    }

    .modal-footer {
        flex-direction: column;
        gap: 8px;
    }

    .modal-footer .btn {
        width: 100%;
    }

    .toast-container {
        top: 12px;
        left: 12px;
        right: 12px;
        align-items: stretch;
    }

    .toast {
        min-width: auto;
        width: 100%;
        padding: 12px 14px;
    }

    .league-actions {
        flex-wrap: wrap;
        padding: 0 12px 10px;
    }

    .btn {
        padding: 8px 14px;
        font-size: 12px;
    }

    .btn-sm {
        padding: 5px 10px;
        font-size: 11px;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 8px 12px;
        font-size: 16px; /* prevent iOS zoom */
    }

    .nav-item {
        padding: 12px 14px;
        font-size: 14px;
    }

    .sidebar-header {
        padding: 16px;
    }

    .sidebar-footer {
        padding: 14px;
    }

    .empty-state {
        padding: 32px 16px;
    }

    .empty-state-icon {
        font-size: 36px;
    }
}

/* Small phones */
@media (max-width: 360px) {
    .stats-row {
        grid-template-columns: 1fr 1fr;
    }

    .results-stats {
        grid-template-columns: 1fr 1fr;
    }

    .view-container {
        padding: 8px;
    }

    .card {
        padding: 12px;
    }
}
