/* assets/css/style.css - United FC Manager Styling */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Inter:wght@400;500;600;700&display=swap');

:root {
    --bg-primary: #0b1329;
    --bg-secondary: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.85);
    --card-border: rgba(255, 255, 255, 0.09);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-emerald: #10b981;
    --accent-emerald-hover: #059669;
    --accent-glow: rgba(16, 185, 129, 0.25);
    --star-active: #f59e0b;
    --star-inactive: #475569;
    --danger-red: #ef4444;
    --danger-hover: #dc2626;
    --input-bg: rgba(15, 23, 42, 0.9);
    --shadow-main: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
    --radius-lg: 10px;
    --radius-md: 10px;
    --radius-sm: 8px;
    --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --card-bg: rgba(255, 255, 255, 0.92);
    --card-border: rgba(15, 23, 42, 0.08);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --accent-emerald: #059669;
    --accent-emerald-hover: #047857;
    --accent-glow: rgba(5, 150, 105, 0.2);
    --star-active: #d97706;
    --star-inactive: #cbd5e1;
    --danger-red: #dc2626;
    --input-bg: #f1f5f9;
    --shadow-main: 0 10px 25px -5px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
}

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

body {
    font-family: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--bg-primary);
    background-image:
        radial-gradient(at 0% 0%, rgba(16, 185, 129, 0.08) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(59, 130, 246, 0.08) 0px, transparent 50%);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 2rem 1rem;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.container {
    width: 100%;
    max-width: 680px;
    margin: 0 auto;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(16px);
    padding: 1rem 1.25rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-main);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo {
    width: 52px;
    height: 52px;
    min-width: 52px;
    min-height: 52px;
    max-width: 52px;
    max-height: 52px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #ffffff !important;
    padding: 3px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
    flex-shrink: 0;
    position: relative;
}

.logo-img {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

header h1 {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

header .subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pwa-install-btn {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, var(--accent-emerald) 0%, #047857 100%);
    border: none;
    color: #ffffff;
    font-size: 1.1rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px var(--accent-glow);
    transition: var(--transition);
}

.pwa-install-btn span {
    display: none !important;
}

.pwa-install-btn:hover {
    transform: scale(1.05);
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.theme-toggle-btn {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    background: var(--input-bg);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    font-size: 1.1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.theme-toggle-btn:hover {
    transform: scale(1.05);
    border-color: var(--accent-emerald);
    color: var(--accent-emerald);
}

/* Counter Stat Cards */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 0.9rem;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(16px);
    border-radius: var(--radius-lg);
    padding: 1.25rem 1rem;
    text-align: center;
    box-shadow: var(--shadow-main);
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: rgba(16, 185, 129, 0.3);
}

.stat-value {
    font-size: 2.75rem;
    font-weight: 800;
    color: var(--accent-emerald);
    line-height: 1;
    margin-bottom: 0.35rem;
}

.stat-card:nth-child(2) .stat-value {
    color: #3b82f6;
}

.stat-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* Lineup Section Header */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    padding: 0 0.25rem;
}

.section-title {
    font-size: 1.25rem;
    font-weight: 700;
}

.action-links {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.btn-link {
    background: none;
    border: none;
    color: var(--accent-emerald);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-link:hover {
    text-decoration: underline;
    opacity: 0.85;
}

.btn-link.danger {
    color: var(--danger-red);
}

/* Controls Box (Add Player + Search) */
.controls-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(16px);
    border-radius: var(--radius-lg);
    padding: 1rem;
    margin-bottom: 0.75rem;
    box-shadow: var(--shadow-main);
}

.add-player-row {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.add-player-buttons {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.input-box {
    flex: 1;
    background: var(--input-bg);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition);
    font-family: inherit;
}

.input-box:focus {
    border-color: var(--accent-emerald);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.btn-add {
    background: linear-gradient(135deg, var(--accent-emerald) 0%, #059669 100%);
    color: #ffffff;
    border: none;
    width: 46px;
    height: 46px;
    border-radius: var(--radius-md);
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px var(--accent-glow);
    transition: var(--transition);
}

.btn-add:hover {
    transform: scale(1.04);
    background: linear-gradient(135deg, #10b981 0%, #047857 100%);
}

.btn-guest {
    width: auto;
    padding: 0 1rem;
    gap: 0.4rem;
    font-size: 0.9rem;
    font-weight: 600;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.25);
}

.btn-guest:hover {
    background: linear-gradient(135deg, #fbbf24 0%, #b45309 100%);
}

.guest-badge {
    display: inline-block;
    padding: 0.1rem 0.45rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-radius: 999px;
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.3);
    margin-left: 0.4rem;
    vertical-align: middle;
}

.btn-link.warning {
    color: #f59e0b;
}

.btn-link.warning:hover {
    color: #fbbf24;
}

.search-row {
    display: flex;
    gap: 0.75rem;
}

.search-input {
    width: 100%;
    padding: 0.6rem 0.9rem;
    font-size: 0.85rem;
}

/* Player List */
.player-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 2rem;
    max-height: 520px;
    overflow-y: auto;
    padding-right: 4px;
}

.player-list::-webkit-scrollbar {
    width: 6px;
}

.player-list::-webkit-scrollbar-track {
    background: transparent;
}

.player-list::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.3);
    border-radius: 3px;
}

.player-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(16px);
    border-radius: var(--radius-lg);
    padding: 0.85rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    box-shadow: var(--shadow-main);
    transition: var(--transition);
}

.player-card:hover {
    border-color: rgba(16, 185, 129, 0.4);
    transform: translateX(2px);
}

.player-checkbox {
    width: 22px;
    height: 22px;
    accent-color: var(--accent-emerald);
    cursor: pointer;
}

.player-avatar {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.05rem;
    color: #ffffff;
    flex-shrink: 0;
    position: relative;
}

.player-avatar.has-photo {
    background: transparent !important;
    background-color: transparent !important;
    border-radius: 50% !important;
}

.player-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

.avatar-upload-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.55);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    opacity: 0;
    cursor: pointer;
    transition: opacity 0.2s ease;
    border-radius: inherit;
}

.player-avatar:hover .avatar-upload-overlay {
    opacity: 1;
}

.player-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.player-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.star-rating {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.star-rating i {
    font-size: 0.85rem;
    color: var(--star-inactive);
    cursor: pointer;
    transition: var(--transition);
}

.star-rating i.active {
    color: var(--star-active);
}

.star-rating i:hover {
    transform: scale(1.2);
}

.rating-num {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-left: 0.35rem;
    font-weight: 500;
}

.gk-toggle-label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}

.gk-checkbox {
    width: 16px;
    height: 16px;
    accent-color: #3b82f6;
}

.btn-delete {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.05rem;
    cursor: pointer;
    padding: 0.35rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.btn-delete:hover {
    color: var(--danger-red);
    background: rgba(239, 68, 68, 0.1);
}

/* Match Settings Section */
.settings-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(16px);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-main);
}

.settings-card h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--card-border);
}

.setting-row:last-child {
    border-bottom: none;
}

.setting-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.stepper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.btn-step {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: var(--input-bg);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.btn-step:hover {
    border-color: var(--accent-emerald);
    color: var(--accent-emerald);
}

.step-value {
    font-weight: 700;
    font-size: 1.05rem;
    min-width: 24px;
    text-align: center;
}

/* Generate Teams Big Button */
.btn-generate {
    width: 100%;
    padding: 1.1rem;
    background: linear-gradient(135deg, var(--accent-emerald) 0%, #047857 100%);
    color: #ffffff;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 1.15rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    box-shadow: 0 10px 20px -5px var(--accent-glow);
    transition: var(--transition);
}

.btn-generate:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 25px -5px var(--accent-glow);
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-container {
    background: var(--bg-primary);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 580px;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    overflow: hidden;
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.alert-modal-container {
    max-width: 440px;
    max-height: 80vh;
}

.modal-overlay.active .modal-container {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--card-border);
    background: var(--card-bg);
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
}

.btn-close-modal {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.35rem;
    cursor: pointer;
    transition: var(--transition);
}

.btn-close-modal:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 1.25rem 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.team-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-md);
    padding: 1.1rem;
}

.team-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.85rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--card-border);
}

.team-badge-name {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.team-badge-num {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.95rem;
}

.team-title {
    font-size: 1.15rem;
    font-weight: 700;
}

.team-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.15rem;
}

.team-count-badge {
    background: rgba(16, 185, 129, 0.15);
    color: var(--accent-emerald);
    font-weight: 700;
    font-size: 0.8rem;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
}

[data-theme="light"] .team-count-badge {
    background: rgba(5, 150, 105, 0.12);
    color: #047857;
}

.team-players-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.6rem;
}

.team-player-item {
    background: var(--input-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.modal-footer {
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--card-border);
    background: var(--card-bg);
    display: flex;
    gap: 0.75rem;
}

.btn-modal-action {
    flex: 1;
    padding: 0.85rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: none;
    transition: var(--transition);
}

.btn-shuffle {
    background: var(--input-bg);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
}

.btn-shuffle:hover {
    border-color: var(--accent-emerald);
    color: var(--accent-emerald);
}

.btn-whatsapp {
    background: #25d366;
    color: #ffffff;
}

.btn-whatsapp:hover {
    background: #1da851;
}

@media (max-width: 680px) {
    body {
        padding: 0.75rem 0.4rem;
    }

    .container {
        width: 100%;
        padding: 0;
    }

    header {
        padding: 0.85rem 1rem;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.6rem;
    }

    .action-links {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem 0.85rem;
        justify-content: flex-start;
    }

    .action-links .btn-link {
        font-size: 0.85rem;
    }

    .add-player-row {
        flex-direction: row;
        align-items: center;
        gap: 0.4rem;
        width: 100%;
    }

    .add-player-row .input-box {
        flex: 1 1 0;
        min-width: 0;
        padding: 0.6rem 0.6rem;
        font-size: 0.85rem;
    }

    .add-player-buttons {
        display: flex;
        gap: 0.35rem;
        flex-shrink: 0;
        align-items: center;
    }

    .add-player-buttons .btn-add {
        width: 38px;
        height: 38px;
        min-width: 38px;
        font-size: 1rem;
        flex: 0 0 auto;
        border-radius: var(--radius-md);
    }

    .add-player-buttons .btn-guest {
        width: auto;
        height: 38px;
        padding: 0 0.55rem;
        font-size: 0.78rem;
        white-space: nowrap;
        flex: 0 0 auto;
    }

    .player-card {
        padding: 0.65rem 0.65rem;
        gap: 0.45rem;
    }

    .player-name {
        font-size: 0.95rem;
    }

    .star-rating .fa-star,
    .star-rating .fa-star-half-alt {
        font-size: 0.85rem;
    }

    .team-players-grid {
        grid-template-columns: 1fr;
    }

    .modal-container {
        width: 96%;
        max-height: 94vh;
        margin: 0.5rem auto;
    }

    .modal-header {
        padding: 1rem 1.1rem;
    }

    .modal-body {
        padding: 1rem 1.1rem;
    }

    .modal-footer {
        flex-direction: column;
        gap: 0.5rem;
        padding: 1rem 1.1rem;
    }
}

.app-footer {
    text-align: center;
    margin-top: 2rem;
    padding: 1rem 0;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    opacity: 0.8;
}

/* Accessibility Focus-Visible Styles */
button:focus-visible,
input:focus-visible {
    outline: 2px solid var(--accent-emerald);
    outline-offset: 2px;
}