/* =========================================
   CUSTOM STYLES (Extracted from Inline)
   ========================================= */

/* --- INDEX.PHP --- */
.scoreboard {
    transition: background-color 0.5s ease, color 0.5s ease;
}

.scoreboard.offline {
    background-color: #ef4444 !important;
    color: white !important;
    border-color: #b91c1c !important;
    animation: pulse-red 2s infinite;
}

@keyframes pulse-red {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }

    100% {}
}

/* PUBLIC MODE STYLES */
.public-mode .match-controls,
.public-mode .timer-controls,
.public-mode .drag-handle,
.public-mode .manual-timer-input,
.public-mode .context-menu-trigger,
.public-mode .btn-add-event,
.public-mode .add-goal-btn,
.public-mode #btnEndMatch,
.public-mode #btnHistory,
.public-mode .bench-area button {
    display: none !important;
}

.public-mode .player-time-display {
    display: none !important;
}

.public-mode .event-item.type-substitution {
    display: none !important;
}


/* --- LOGIN.PHP (Scoped by .login-page) --- */
.login-page {
    height: 100vh;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-image: url('../img/login_bg.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 0;
}

.login-page .login-card {
    z-index: 10;
    width: 90%;
    max-width: 400px;
    background: transparent;
    padding: 40px 0;
    text-align: center;
}

.login-page .login-logo {
    width: 140px;
    height: auto;
    margin-bottom: 10px;
    filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.3));
}

.login-page h2 {
    margin-top: 0;
    color: #ffffff;
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: -0.5px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.login-page .subtitle {
    font-size: 14px;
    color: #cbd5e1;
    margin-bottom: 30px;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.login-page .text-muted {
    color: #cbd5e1 !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.login-page .error-msg {
    color: #ef4444;
    font-size: 13px;
    margin-bottom: 20px;
    background: #fef2f2;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #fecaca;
}


/* --- ADMIN.PHP (Scoped by .admin-page) --- */
html.admin-html,
body.admin-page {
    background: #f1f5f9;
    padding: 0;
    margin: 0;
    font-family: sans-serif;
    overflow-y: auto !important;
    height: auto !important;
    min-height: 100%;
}

body.admin-page {
    padding: 20px;
}

.admin-container {
    max-width: 1000px;
    margin: 0 auto;
}

.card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.h-title {
    font-size: 24px;
    font-weight: 800;
    color: #0f172a;
    margin-bottom: 20px;
}

.badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
}

.badge-super {
    background: #4f46e5;
    color: white;
}

.badge-admin {
    background: #dc2626;
    color: white;
}

.badge-user,
.badge-coach {
    background: #0ea5e9;
    color: white;
}

.admin-page table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.admin-page th,
.admin-page td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}

.admin-page th {
    background: #f8fafc;
    color: #64748b;
}

.btn-mini {
    padding: 4px 8px;
    font-size: 12px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
}

.form-row {
    display: flex;
    gap: 10px;
    align-items: end;
    margin-top: 10px;
}

.admin-page input,
.admin-page select {
    padding: 8px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    width: 100%;
}

.alert {
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-weight: bold;
}

.alert.success {
    background: #dcfce7;
    color: #166534;
}

.alert.error {
    background: #fee2e2;
    color: #991b1b;
}

.table-select {
    padding: 4px;
    font-size: 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    max-width: 120px;
}

/* =========================================
   UTILITIES (To replace inline styles)
   ========================================= */
.d-inline {
    display: inline;
}

.d-flex {
    display: flex;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-1 {
    gap: 5px;
}

.gap-2 {
    gap: 10px;
}

.flex-1 {
    flex: 1;
}

.flex-2 {
    flex: 2;
}

.flex-col {
    flex-direction: column;
}

.items-stretch {
    align-items: stretch;
}

.w-full {
    width: 100%;
}

.w-100px {
    width: 100px;
}

.m-0 {
    margin: 0;
}

.mt-2 {
    margin-top: 10px;
}

.mb-1 {
    margin-bottom: 2px;
}

.mb-2 {
    margin-bottom: 5px;
}

.mb-3 {
    margin-bottom: 10px;
}

.mb-4 {
    margin-bottom: 15px;
}

.mb-5 {
    margin-bottom: 20px;
}

.my-5 {
    margin-top: 20px;
    margin-bottom: 20px;
}

.p-2 {
    padding: 8px;
}

.p-3 {
    padding: 15px;
}

.bg-slate-dark {
    background: #0f172a;
}

.bg-slate-light {
    background: #f8fafc;
}

.bg-white {
    background: white;
}

.border-slate {
    border: 1px solid #e2e8f0;
}

.rounded {
    border-radius: 8px;
}

.rounded-sm {
    border-radius: 4px;
}

.no-list {
    list-style: none;
    padding: 0;
}

.text-center {
    text-align: center;
}

.text-sm {
    font-size: 13px;
}

.text-xs {
    font-size: 11px;
}

.text-bold {
    font-weight: bold;
}

.text-slate {
    color: #64748b;
}

.text-slate-light {
    color: #94a3b8;
}

.text-warning {
    color: #ccc;
}

.opacity-60 {
    opacity: 0.6;
}

/* Specific Components */
.live-badge {
    display: inline-flex;
    align-items: center;
    background: #1e293b;
    color: #22d3ee;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    margin-right: 4px;
    border: 1px solid #475569;
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.5);
}

.icon-blink {
    font-size: 8px;
    margin-right: 4px;
}

.btn-link-logout {
    font-size: 12px;
    border: none;
    background: none;
    color: #64748b;
    font-weight: 600;
    cursor: pointer;
}

.hr-dashed {
    border: 0;
    border-top: 1px dashed #cbd5e1;
    margin: 30px 0;
}

.color-input {
    width: 100%;
    height: 40px;
}

.overflow-x-auto {
    overflow-x: auto;
}

.d-block {
    display: block;
}

.italic {
    font-style: italic;
}

.overflow-y-auto {
    overflow-y: auto;
}

.pb-50px {
    padding-bottom: 50px;
}

.mt-3 {
    margin-top: 12px;
}

.mb-0 {
    margin-bottom: 0;
}

.justify-center {
    justify-content: center;
}

.footer-logo {
    height: 15px;
    filter: grayscale(100%);
    opacity: 0.7;
}

/* Login Warnings */
.warning-box {
    background: #fff7ed;
    border: 1px solid #fdba74;
    padding: 15px;
    border-radius: 8px;
    text-align: left;
}

.text-orange-bold {
    color: #c2410c;
    font-weight: bold;
    margin-bottom: 5px;
}

.warning-text {
    font-size: 13px;
    color: #9a3412;
    margin: 0 0 10px 0;
    line-height: 1.4;
}

.bg-slate-600 {
    background: #475569;
}

.no-underline {
    text-decoration: none;
}

.h-44 {
    height: 44px;
}

.text-14 {
    font-size: 14px;
}

/* Read Only UI Enhancements */
body.read-only-ui .inline-controls-compact button:not(#btnAdmin):not(#btnShareLive),
body.read-only-ui #pitchArea,
body.read-only-ui #bench,
body.read-only-ui #nonCalled,
body.read-only-ui .bottom-actions,
body.read-only-ui .formation-selector-container {
    opacity: 0.6;
    pointer-events: none;
    filter: grayscale(0.5);
}

body.read-only-ui::before {
    content: "MODO LECTURA (Espectador)";
    display: block;
    background: #f59e0b;
    color: #000;
    text-align: center;
    font-weight: bold;
    font-size: 12px;
    padding: 2px;
}

/* Version Watermark */
.version-watermark {
    position: fixed;
    bottom: 5px;
    right: 10px;
    font-size: 10px;
    color: rgba(0, 0, 0, 0.3);
    pointer-events: none;
    z-index: 9999;
    font-family: monospace;
}

body.dark-mode .version-watermark,
.login-page .version-watermark {
    color: rgba(255, 255, 255, 0.3);
}