/* Mobile-first CSS for Al-Toke F.C. Web App */

:root {
    /* Typography */
    --font-display: 'Bebas Neue', Impact, sans-serif;
    --font-numbers: 'Graduate', 'Bebas Neue', sans-serif;
    --font-body: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;

    /* Core Colors */
    --color-bg: #ffffff;
    --color-surface: #f8f9fa;
    --color-primary: #008751;   /* Verde Esmeralda Al-Toke */
    --color-accent: #e30613;    /* Rojo Al-Toke */
    --color-secondary: #e9ecef;
    --color-text: #1a1a1a;
    --color-text-muted: #5a6268;
    --color-error: #dc3545;
    --color-error-dark: #c82333;
    --color-error-surface: #fef2f2;
    --color-error-border: #fecaca;
    --color-success: #28a745;

    /* Color Variants */
    --color-primary-dark: #006340;
    --color-primary-light: #00a863;
    --color-primary-glow: rgba(0, 135, 81, 0.3);
    --color-accent-dark: #b8050f;
    --color-accent-light: #ff1f2c;

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #008751 0%, #006340 100%);
    --gradient-accent: linear-gradient(135deg, #e30613 0%, #b8050f 100%);
    --gradient-field: linear-gradient(180deg, rgba(0, 135, 81, 0.03) 0%, rgba(0, 135, 81, 0.08) 100%);

    /* Shadows with brand colors */
    --shadow-sm: 0 2px 8px rgba(0, 135, 81, 0.08);
    --shadow-md: 0 4px 16px rgba(0, 135, 81, 0.12);
    --shadow-lg: 0 8px 32px rgba(0, 135, 81, 0.16);
    --shadow-glow: 0 0 20px rgba(0, 135, 81, 0.3);

    /* Legacy shadow (for compatibility) */
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.05);

    /* Layout */
    --border-radius: 12px;
    --spacing: 16px;
}

/* Skip navigation link - visually hidden until focused */
.skip-link {
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    height: 1px;
    overflow: hidden;
    position: absolute;
    white-space: nowrap;
    width: 1px;
}

.skip-link:focus {
    clip: auto;
    clip-path: none;
    height: auto;
    overflow: visible;
    position: fixed;
    top: 8px;
    left: 8px;
    width: auto;
    z-index: 9999;
    padding: 8px 16px;
    background: var(--color-primary);
    color: white;
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    text-decoration: none;
}

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

html, body {
    height: 100%;
}

body {
    font-family: var(--font-body);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.5;
    min-height: 100vh;
    min-height: 100dvh;
}

/* Identidad Visual: Barra superior tricolor mejorada */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: linear-gradient(90deg,
        var(--color-primary) 0%,
        var(--color-primary) 40%,
        var(--color-accent) 40%,
        var(--color-accent) 60%,
        #ffffff 60%,
        #ffffff 100%
    );
    z-index: 1001;
    box-shadow: 0 2px 8px rgba(0, 135, 81, 0.15);
}

.container {
    max-width: 480px;
    margin: 0 auto;
    padding: var(--spacing);
    padding-bottom: 80px;
    background: var(--gradient-field);
    min-height: 100vh;
}

/* Typography */
h1 {
    font-family: var(--font-display);
    font-size: 1.85rem;
    font-weight: 400;
    margin-bottom: 8px;
    text-align: center;
    color: var(--color-primary);
    letter-spacing: 2px;
    text-transform: uppercase;
}

.subtitle {
    font-family: var(--font-body);
    color: var(--color-text-muted);
    text-align: center;
    margin-bottom: 32px;
}

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

label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--color-text);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Vertical marker for labels */
label::before {
    content: '';
    width: 4px;
    height: 16px;
    background: var(--gradient-primary);
    border-radius: 2px;
    flex-shrink: 0;
}

input[type="text"],
input[type="password"],
input[type="number"],
textarea {
    width: 100%;
    padding: 14px 16px;
    font-family: var(--font-body);
    font-size: 16px;
    border: 2px solid var(--color-secondary);
    border-radius: var(--border-radius);
    background: var(--color-surface);
    color: var(--color-text);
    transition: all 0.2s ease;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02);
}

input:focus,
textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    background: white;
    box-shadow: 0 0 0 4px var(--color-primary-glow);
}

textarea {
    resize: vertical;
    min-height: 100px;
}

/* Password Input with Toggle */
.password-input-wrapper {
    position: relative;
}

.password-input-wrapper input[type="password"],
.password-input-wrapper input[type="text"] {
    padding-right: 48px;
}

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--color-text-muted);
    transition: color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.password-toggle:hover {
    color: var(--color-primary);
}

.password-toggle:active {
    transform: translateY(-50%) scale(0.95);
}

/* File Input Custom Styling */
.image-input-container {
    background: var(--color-surface);
    border: 2px dashed var(--color-secondary);
    border-radius: var(--border-radius);
    padding: 20px;
    text-align: center;
    transition: all 0.2s;
}

.image-input-container:hover {
    border-color: var(--color-primary);
}

input[type="file"] {
    width: 100%;
    font-size: 14px;
    color: var(--color-text-muted);
}

.image-preview {
    margin-top: 12px;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    max-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-surface);
}

.image-preview img {
    max-width: 100%;
    max-height: 200px;
    object-fit: contain;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 16px 24px;
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 400;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 2px;
    position: relative;
    overflow: hidden;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 4px 16px rgba(0, 135, 81, 0.3);
}

/* Shine effect on hover */
.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s ease;
}

.btn-primary:hover::before {
    left: 100%;
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(0, 135, 81, 0.4);
    transform: translateY(-1px);
}

.btn-secondary {
    background: white;
    color: var(--color-text);
    border: 2px solid var(--color-secondary);
    font-family: var(--font-body);
    font-weight: 600;
    letter-spacing: 0.5px;
}

.btn-secondary:hover {
    background: var(--color-surface);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

/* Login Page */
.login-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: var(--spacing);
    background: linear-gradient(180deg, rgba(0, 135, 81, 0.03) 0%, rgba(0, 135, 81, 0.08) 100%);
}

/* Diagonal stripe pattern in background */
.login-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        -45deg,
        transparent 0px,
        transparent 40px,
        rgba(0, 135, 81, 0.02) 40px,
        rgba(0, 135, 81, 0.02) 80px
    );
    pointer-events: none;
}

.login-logo {
    max-width: 200px;
    height: auto;
    margin-bottom: 40px;
    filter: drop-shadow(0 8px 24px rgba(0, 135, 81, 0.2));
    position: relative;
    z-index: 1;
    animation: float-logo 3s ease-in-out infinite;
}

@keyframes float-logo {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.login-form {
    width: 100%;
    max-width: 320px;
    position: relative;
    z-index: 1;
    background: rgba(255, 255, 255, 0.9);
    padding: 24px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(10px);
}

.login-form label::before {
    display: none;
}

/* Error States */
.error-message {
    color: var(--color-error);
    font-size: 0.875rem;
    text-align: center;
    margin-bottom: 16px;
    min-height: 1.25em;
}

.error-text {
    color: var(--color-error);
    font-size: 0.875rem;
    padding: 8px;
}

.empty-text {
    color: var(--color-text-muted);
    font-size: 0.875rem;
    padding: 8px;
}

.error-container {
    text-align: center;
    padding: 24px;
    background: var(--color-error-surface);
    border-radius: var(--border-radius);
    border: 1px solid var(--color-error-border);
}

.error-container p {
    color: var(--color-error);
    margin-bottom: 16px;
}

/* Upload Page */
.upload-container {
    padding-top: 12px;
}

.header-logo {
    display: block;
    margin: 0 auto 12px;
    width: 80px;
    height: 80px;
    object-fit: contain;
}

.upload-form {
    margin-top: 20px;
}

/* Loading State */
.loading-text {
    color: var(--color-text-muted);
    font-size: 0.875rem;
    text-align: center;
    padding: 16px;
}

/* Progress */
.progress-container {
    margin-top: 24px;
    padding: 24px;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--color-secondary);
}

.progress-text {
    font-family: var(--font-body);
    color: var(--color-text-muted);
    font-size: 0.875rem;
    text-align: center;
    margin-top: 14px;
}

/* Result */
.result-container {
    margin-top: 24px;
    text-align: center;
}

.result-image-clickable {
    width: 100%;
    border-radius: var(--border-radius);
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: transform 0.2s;
}

.result-image-clickable:active {
    transform: scale(0.98);
}

.result-hint {
    color: var(--color-text-muted);
    font-size: 0.75rem;
    margin-top: 8px;
    margin-bottom: 16px;
}

.result-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Recent Uploads Grid */
.recent-uploads-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    padding: 4px;
}

.upload-thumbnail {
    aspect-ratio: 1;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    border: 3px solid transparent;
    box-shadow: var(--shadow);
    transition: all 0.2s;
}

.upload-thumbnail.selected {
    border-color: var(--color-primary);
    transform: scale(1.05);
}

.upload-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 3px solid transparent;
    border-image: linear-gradient(90deg, var(--color-primary) 0%, var(--color-primary) 40%, var(--color-accent) 40%, var(--color-accent) 60%, #ffffff 60%) 1;
    padding: 14px 0;
    padding-bottom: max(14px, env(safe-area-inset-bottom));
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.08);
    z-index: 1000;
}

.nav-item {
    flex: 1;
    text-align: center;
    color: var(--color-text-muted);
    text-decoration: none;
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    position: relative;
    transition: color 0.2s ease;
}

.nav-item:hover {
    color: var(--color-primary);
}

.nav-item.active {
    color: var(--color-primary);
}

/* Pulsing dot indicator for active nav */
.nav-item.active::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 6px;
    height: 6px;
    background: var(--color-primary);
    border-radius: 50%;
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: translateX(-50%) scale(1); }
    50% { opacity: 0.6; transform: translateX(-50%) scale(1.2); }
}

.nav-item.nav-logout {
    flex: 0;
    padding: 0 16px;
    color: var(--color-text-muted);
    border-left: 1px solid var(--color-secondary);
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.nav-item.nav-logout:hover {
    color: var(--color-accent);
}

.nav-item.nav-logout::after {
    display: none;
}

/* Progress Bar */
.progress-bar {
    height: 12px;
    background: var(--color-secondary);
    border-radius: 6px;
    overflow: hidden;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-primary), var(--color-primary-light));
    border-radius: 6px;
    transition: width 0.3s ease;
    position: relative;
    overflow: hidden;
}

/* Animated shine effect on progress bar */
.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.4),
        transparent
    );
    animation: progress-shine 1.5s infinite;
}

@keyframes progress-shine {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* History Page */
.history-container {
    padding-top: 12px;
}

.history-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-top: 20px;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 14px;
    background: white;
    border: none;
    border-left: 4px solid var(--color-primary);
    border-radius: var(--border-radius);
    padding: 14px;
    box-shadow: var(--shadow-md);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.history-item:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-lg);
}

.history-item:active {
    transform: scale(0.98);
}

.history-item-image {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    border-radius: 8px;
    overflow: hidden;
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
}

.history-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.2s;
}

.history-item:hover .history-item-image img {
    transform: scale(1.05);
}

.history-item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.history-item-prompt {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--color-text);
    margin-bottom: 4px;
}

.history-item-prompt-text {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.history-item-prompt-text.expanded {
    display: block;
    -webkit-line-clamp: unset;
}

.prompt-expand-btn {
    background: none;
    border: none;
    padding: 2px 0;
    margin-top: 2px;
    color: var(--color-primary);
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.prompt-expand-btn:hover {
    text-decoration: underline;
}

.prompt-expand-btn .expand-arrow {
    display: inline-block;
    transition: transform 0.2s;
    font-size: 0.6rem;
}

.prompt-expand-btn.expanded .expand-arrow {
    transform: rotate(180deg);
}

.history-item-date {
    font-family: var(--font-body);
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.load-more-container {
    margin-top: 20px;
    text-align: center;
}

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--color-text-muted);
}

.empty-state p {
    margin-bottom: 20px;
}

.empty-state .btn {
    width: auto;
    display: inline-flex;
}

/* Status Badges */
.no-image {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-surface);
}

.status-success {
    color: var(--color-success);
    font-size: 0.75rem;
    font-weight: 600;
}

.status-rejected {
    color: var(--color-error);
    font-size: 0.75rem;
    font-weight: 600;
}

/* Lightbox */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing);
    animation: lightbox-in 0.2s ease;
}

@keyframes lightbox-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.lightbox-content {
    position: relative;
    max-width: 100%;
    max-height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    animation: lightbox-content-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes lightbox-content-in {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.lightbox-content img {
    max-width: 100%;
    max-height: 80vh;
    border-radius: var(--border-radius);
    object-fit: contain;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
    position: absolute;
    top: -52px;
    right: 0;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    transition: transform 0.2s;
    padding: 13px;
    line-height: 1;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-download {
    width: auto;
    padding: 12px 32px;
}

/* Admin Delete Buttons */
.delete-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--color-error);
    color: white;
    border: none;
    font-size: 16px;
    font-weight: bold;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
    transition: opacity 0.2s, background 0.2s;
    flex-shrink: 0;
}

.delete-btn:hover {
    opacity: 1;
    background: var(--color-error-dark);
}

.delete-btn:active {
    transform: scale(0.95);
}

/* Upload thumbnail delete - positioned absolute */
.upload-thumbnail {
    position: relative;
}

.upload-thumbnail .delete-btn {
    position: absolute;
    top: 4px;
    right: 4px;
}

/* History delete - push to end of flexbox */
.history-item > .delete-btn {
    margin-left: auto;
}

/* Help Text */
.help-text {
    color: var(--color-text-muted);
    font-size: 0.875rem;
    margin-bottom: 12px;
    text-align: center;
}

/* Toast Notification */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: var(--gradient-primary);
    color: white;
    padding: 14px 28px;
    border-radius: 50px;
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 0.95rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    box-shadow: 0 8px 24px rgba(0, 135, 81, 0.35);
    z-index: 3000;
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Tab Navigation */
.tab-nav {
    display: flex;
    gap: 4px;
    margin-bottom: 20px;
    background: rgba(0, 0, 0, 0.04);
    padding: 4px;
    border-radius: var(--border-radius);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06);
}

.tab-btn {
    flex: 1;
    padding: 12px 16px;
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 1px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--color-text-muted);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.tab-btn:hover {
    color: var(--color-text);
}

.tab-btn.active {
    background: white;
    color: var(--color-primary);
    box-shadow: var(--shadow-sm);
}

/* Green underline for active tab */
.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 40%;
    height: 3px;
    background: var(--gradient-primary);
    border-radius: 2px;
}

/* Tab Content */
.tab-content {
    display: none;
}

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

/* Players Grid */
.players-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.02);
    border-radius: var(--border-radius);
}

@media (min-width: 400px) {
    .players-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 14px;
    }
}

.player-card {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 3px solid transparent;
    box-shadow: var(--shadow-md);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    background: white;
}

.player-card:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: var(--shadow-lg);
}

.player-card:hover img {
    filter: brightness(1.05);
}

.player-card.selected {
    border-color: var(--color-primary);
    transform: scale(1.03);
    box-shadow: var(--shadow-glow), var(--shadow-lg);
    animation: pulse-select 0.3s ease-out;
}

/* Checkmark badge for selected state */
.player-card.selected::after {
    content: '';
    position: absolute;
    bottom: 32px;
    right: 6px;
    width: 24px;
    height: 24px;
    background: var(--gradient-primary);
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='20 6 9 17 4 12'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    animation: pop-in 0.2s ease-out;
    z-index: 5;
}

@keyframes pulse-select {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1.03); }
}

@keyframes pop-in {
    0% { transform: scale(0); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.player-card img {
    width: 100%;
    aspect-ratio: 3/4;
    object-fit: cover;
    display: block;
    transition: filter 0.2s ease-out;
}

.player-number {
    position: absolute;
    top: 0;
    left: 0;
    background: var(--gradient-primary);
    color: white;
    font-family: var(--font-numbers);
    font-size: 0.85rem;
    font-weight: 400;
    padding: 4px 8px;
    border-radius: 0 0 8px 0;
    min-width: 28px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.player-name {
    padding: 8px 4px;
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    color: var(--color-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: white;
    line-height: 1.2;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    border-top: 2px solid var(--color-primary);
}

.player-card .delete-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    font-size: 14px;
}

/* Selection Preview */
.selection-preview {
    margin-bottom: 20px;
    padding: 16px;
    background: linear-gradient(135deg, rgba(0, 135, 81, 0.05) 0%, rgba(0, 135, 81, 0.1) 100%);
    border-radius: var(--border-radius);
    border: 2px solid var(--color-primary);
    position: relative;
    overflow: hidden;
}

/* Diagonal stripe decoration */
.selection-preview::before {
    content: '';
    position: absolute;
    top: -10px;
    right: -10px;
    width: 60px;
    height: 60px;
    background: repeating-linear-gradient(
        -45deg,
        var(--color-primary) 0px,
        var(--color-primary) 3px,
        var(--color-accent) 3px,
        var(--color-accent) 6px,
        white 6px,
        white 9px
    );
    opacity: 0.3;
    border-radius: 0 0 0 100%;
}

.selection-preview label {
    margin-bottom: 12px;
    color: var(--color-primary);
    position: relative;
    z-index: 1;
}

.selection-info {
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    z-index: 1;
}

.selection-info img {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    border: 2px solid white;
}

.selection-info span {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 400;
    color: var(--color-text);
    letter-spacing: 1px;
}

/* Gestionar Header */
.gestionar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.gestionar-header label {
    margin-bottom: 0;
}

.btn-add {
    padding: 10px 18px;
    font-family: var(--font-display);
    font-size: 0.9rem;
    width: auto;
    background: var(--gradient-primary);
    color: white;
    letter-spacing: 1px;
}

.btn-add:hover {
    box-shadow: 0 4px 12px rgba(0, 135, 81, 0.3);
}

/* Management Mode Player Cards */
.players-grid.manage-mode .player-card {
    cursor: default;
}

.players-grid.manage-mode .player-card .player-actions {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 8px;
    background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 100%);
}

.player-actions .action-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: transform 0.2s, opacity 0.2s;
    opacity: 0.9;
}

.action-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

.action-btn.edit-btn {
    background: var(--color-primary);
    color: white;
}

.action-btn.delete-action-btn {
    background: var(--color-error);
    color: white;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--spacing);
    animation: modal-backdrop-in 0.2s ease;
}

@keyframes modal-backdrop-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: white;
    border-radius: var(--border-radius);
    width: 100%;
    max-width: 400px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modal-content-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modal-content-in {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 2px solid var(--color-primary);
}

.modal-header h2 {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 400;
    color: var(--color-text);
    margin: 0;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.modal-close {
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 8px;
    line-height: 1;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, transform 0.2s;
}

.modal-content form {
    padding: 20px;
}

.modal-content form label::before {
    display: none;
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.modal-actions .btn {
    flex: 1;
}

.modal-error {
    background: var(--color-error-surface);
    border: 1px solid var(--color-error);
    color: var(--color-error);
    padding: 12px 16px;
    margin: 0 20px;
    border-radius: var(--border-radius);
    font-family: var(--font-body);
    font-size: 0.875rem;
    text-align: center;
}

/* Media Queries */
@media (prefers-color-scheme: dark) {
    /* Mantenemos el modo claro por peticion del usuario */
    :root {
        --color-bg: #ffffff;
        --color-surface: #f8f9fa;
        --color-text: #1a1a1a;
    }
}

/* =================================
   LOADING ANIMATIONS
   ================================= */

/* Staggered card entrance animation */
.player-card {
    animation: card-enter 0.4s ease-out backwards;
}

.player-card:nth-child(1) { animation-delay: 0.05s; }
.player-card:nth-child(2) { animation-delay: 0.1s; }
.player-card:nth-child(3) { animation-delay: 0.15s; }
.player-card:nth-child(4) { animation-delay: 0.2s; }
.player-card:nth-child(5) { animation-delay: 0.25s; }
.player-card:nth-child(6) { animation-delay: 0.3s; }
.player-card:nth-child(7) { animation-delay: 0.35s; }
.player-card:nth-child(8) { animation-delay: 0.4s; }
.player-card:nth-child(9) { animation-delay: 0.45s; }
.player-card:nth-child(10) { animation-delay: 0.5s; }
.player-card:nth-child(11) { animation-delay: 0.55s; }
.player-card:nth-child(12) { animation-delay: 0.6s; }

@keyframes card-enter {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* History item staggered entrance */
.history-item {
    animation: slide-in-left 0.3s ease-out backwards;
}

.history-item:nth-child(1) { animation-delay: 0.05s; }
.history-item:nth-child(2) { animation-delay: 0.1s; }
.history-item:nth-child(3) { animation-delay: 0.15s; }
.history-item:nth-child(4) { animation-delay: 0.2s; }
.history-item:nth-child(5) { animation-delay: 0.25s; }

@keyframes slide-in-left {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Loading text animation */
.loading-text {
    animation: pulse-opacity 1.5s ease-in-out infinite;
}

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

/* =================================
   ACCESSIBILITY
   ================================= */

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .player-card,
    .history-item {
        animation: none;
    }

    .btn-primary::before {
        animation: none;
    }

    .progress-fill::after {
        animation: none;
    }

    .login-logo {
        animation: none;
    }

    .nav-item.active::after {
        animation: none;
    }
}

/* Focus visible for keyboard navigation */
:focus-visible {
    outline: 3px solid var(--color-primary);
    outline-offset: 2px;
}

/* High contrast focus for buttons */
.btn:focus-visible {
    outline: 3px solid var(--color-accent);
    outline-offset: 2px;
}

/* =================================
   UTILITY CLASSES
   ================================= */

/* Hide label marker when needed */
.no-marker::before {
    display: none !important;
}

/* Help text improvements */
.help-text {
    font-family: var(--font-body);
    color: var(--color-text-muted);
    font-size: 0.875rem;
    margin-bottom: 12px;
    text-align: center;
}

/* Progress text improvements */
.progress-text {
    font-family: var(--font-body);
}

/* Error text improvements */
.error-text {
    font-family: var(--font-body);
}

/* =================================
   RESPONSIVE BREAKPOINTS
   ================================= */

/* Tablet (768px+) */
@media (min-width: 768px) {
    .container {
        max-width: 600px;
        padding: 32px 24px 96px;
    }

    .players-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 16px;
    }

    .history-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .result-actions {
        flex-direction: row;
        justify-content: center;
    }

    .lightbox-content {
        max-width: 80vw;
        max-height: 90vh;
    }
}

/* Desktop (1024px+) */
@media (min-width: 1024px) {
    .container {
        max-width: 720px;
        padding: 40px 32px 96px;
    }

    .players-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 16px;
    }

    .history-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Hover states — pointer devices only (no unintended sticky hover on mobile) */
@media (hover: hover) {
    .player-card:hover {
        transform: translateY(-4px);
        border-color: var(--color-primary);
        box-shadow: var(--shadow-lg);
    }

    .history-item:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-lg);
    }

    .lightbox-close:hover {
        transform: scale(1.15);
    }

    .modal-close:hover {
        color: var(--color-accent);
        transform: rotate(90deg);
    }
}

/* Empty text improvements */
.empty-text {
    font-family: var(--font-body);
}
