/* ============================================================
   nGage Sports Engagement Platform - Custom Styles
   Beyond Tailwind: sport-themed colors, card effects, badges,
   responsive grids, and component styles.
   ============================================================ */

/* ---- CSS Custom Properties (Sport Theme) ---- */
:root {
    --brand-primary: #0c93e7;
    --brand-dark: #015da0;
    --brand-light: #36adf6;
    --surface-bg: #020617;
    --surface-card: #0f172a;
    --surface-raised: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --border-subtle: rgba(148, 163, 184, 0.1);
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --live-red: #ef4444;
}

/* ---- Base Resets & Global ---- */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--surface-raised) var(--surface-card);
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: var(--surface-card);
}

::-webkit-scrollbar-thumb {
    background: var(--surface-raised);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #334155;
}

body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ---- Navigation Link ---- */
.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #94a3b8;
    transition: all 0.15s ease;
}

.nav-link:hover {
    background: rgba(30, 41, 59, 0.8);
    color: #e2e8f0;
}

.nav-link.active {
    background: rgba(12, 147, 231, 0.15);
    color: #36adf6;
}

.nav-link.active svg {
    color: #36adf6;
}

/* ---- Sport Badge ---- */
.sport-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.625rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    background: rgba(12, 147, 231, 0.2);
    color: #36adf6;
    text-transform: uppercase;
}

/* ---- Status Badges ---- */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.625rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.status-live {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    animation: pulse-badge 2s infinite;
}

.status-pending {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}

.status-approved {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
}

.status-posted {
    background: rgba(12, 147, 231, 0.2);
    color: #36adf6;
}

.status-skipped {
    background: rgba(100, 116, 139, 0.2);
    color: #94a3b8;
}

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

/* ---- Card Hover Effects ---- */
.role-card {
    display: block;
    padding: 1.5rem;
    background: var(--surface-card);
    border: 1px solid var(--border-subtle);
    border-radius: 0.75rem;
    transition: all 0.2s ease;
}

.role-card:hover {
    background: var(--surface-raised);
    border-color: rgba(12, 147, 231, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

/* ---- Image Preview Containers ---- */
.image-preview-trigger {
    position: relative;
    overflow: hidden;
}

.image-preview-trigger::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0);
    transition: background 0.2s ease;
}

.image-preview-trigger:hover::after {
    background: rgba(0, 0, 0, 0.3);
}

/* ---- Toast Notifications ---- */
.toast {
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    animation: toast-in 0.3s ease, toast-out 0.3s ease 3.7s forwards;
    max-width: 360px;
}

.toast-success {
    background: #065f46;
    color: #6ee7b7;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.toast-error {
    background: #7f1d1d;
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.toast-info {
    background: #1e3a5f;
    color: #93c5fd;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

@keyframes toast-in {
    from { opacity: 0; transform: translateY(1rem) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toast-out {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to { opacity: 0; transform: translateY(-0.5rem) scale(0.95); }
}

/* ---- Toggle Switch (for settings) ---- */
label:has(input[type="checkbox"].sr-only) {
    position: relative;
}

label:has(input[type="checkbox"].sr-only) > div:first-of-type {
    cursor: pointer;
}

label:has(input[type="checkbox"].sr-only:checked) > div:last-of-type {
    transform: translateX(1.25rem);
}

/* ---- Line Clamp Utility ---- */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ---- Responsive Grid Layouts ---- */
@media (max-width: 640px) {
    .grid-cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ---- Content card approved/skipped transition ---- */
.htmx-swapping {
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

/* ---- Community Checkbox Style ---- */
.community-checkbox input[type="checkbox"]:checked + div,
.community-checkbox input[type="checkbox"]:checked ~ div {
    color: white;
}

/* ---- Color picker size fix ---- */
input[type="color"] {
    -webkit-appearance: none;
    border: none;
    padding: 0;
    cursor: pointer;
}

input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

input[type="color"]::-webkit-color-swatch {
    border: 2px solid #374151;
    border-radius: 0.5rem;
}

/* ---- HTMX loading indicator ---- */
.htmx-request {
    opacity: 0.6;
    pointer-events: none;
}

.htmx-request::after {
    content: '';
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid transparent;
    border-top-color: var(--brand-primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-left: 0.5rem;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ---- Print styles for reports ---- */
@media print {
    aside, header, .nav-link, button {
        display: none !important;
    }

    main {
        padding: 0 !important;
    }

    .bg-surface-800 {
        background: white !important;
        border: 1px solid #e5e7eb !important;
    }

    .text-white, .text-gray-300, .text-gray-400 {
        color: #111827 !important;
    }

    .text-gray-500 {
        color: #6b7280 !important;
    }
}
