/* ===================================
   LLOTA - Common Styles
   Lagos y Lagunas On The Air
   =================================== */

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

body {
    font-family: var(--font-family);
    background-color: var(--color-bg);
    background-image: radial-gradient(var(--color-border-light) 1px, transparent 1px);
    background-size: 24px 24px;
    color: var(--color-text);
    min-height: 100vh;
    line-height: 1.6;
}

/* --- Selection --- */
::selection {
    background-color: var(--color-focus-ring);
    color: var(--color-brand);
}

::-moz-selection {
    background-color: var(--color-focus-ring);
    color: var(--color-brand);
}

/* --- Glass Panel Utilities --- */
.glass {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-sm);
}

.glass-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-md);
    transition: box-shadow 0.3s ease;
}

.glass-card:hover {
    box-shadow: var(--shadow-lg);
}

.glass-panel {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
}

/* --- Custom Gradients --- */
.bg-gradient-brand {
    background: linear-gradient(135deg, var(--color-brand) 0%, #3B82F6 100%);
}

/* --- Animations --- */
@keyframes pulse-ring {
    0% {
        transform: scale(0.33);
        opacity: 1;
    }

    80%,
    100% {
        opacity: 0;
    }
}

@keyframes pulse-dot {
    0% {
        transform: scale(0.8);
    }

    50% {
        transform: scale(1);
    }

    100% {
        transform: scale(0.8);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.animate-fade-in {
    animation: fadeIn 0.3s ease-out;
}

.live-indicator {
    position: relative;
}

.live-indicator::before {
    content: '';
    position: absolute;
    left: -4px;
    top: -4px;
    right: -4px;
    bottom: -4px;
    background-color: var(--color-active-indicator);
    border-radius: 50%;
    animation: pulse-ring 1.5s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
    z-index: -1;
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: var(--scrollbar-width);
    height: var(--scrollbar-width);
}

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

::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}

/* --- Form Elements --- */
.input-field {
    transition: all 0.2s ease;
    border: 1px solid var(--color-text-tertiary) !important;
    background-color: var(--color-bg) !important;
    color: var(--color-text) !important;
    min-height: 44px;
    padding: 0.75rem 1rem;
}

.input-field::placeholder {
    color: var(--color-text-secondary) !important;
    opacity: 1;
}

.input-field:focus {
    box-shadow: 0 0 0 4px var(--color-focus-ring);
    outline: none;
}

/* --- Buttons --- */
.btn-primary {
    background: linear-gradient(135deg, var(--color-brand) 0%, #3B82F6 100%);
    color: white;
    padding: 0.75rem 1.5rem;
    min-height: 44px;
    min-width: 44px;
    border-radius: var(--radius-md);
    font-weight: 700;
    box-shadow: var(--shadow-brand);
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-primary:hover {
    box-shadow: 0 10px 15px -3px rgba(110, 63, 141, 0.4);
    transform: translateY(-2px);
}

.btn-secondary {
    background: var(--color-surface);
    color: var(--color-brand);
    padding: 0.75rem 1.5rem;
    min-height: 44px;
    min-width: 44px;
    border-radius: var(--radius-md);
    font-weight: 700;
    border: 2px solid var(--color-border-light);
    transition: all 0.3s ease;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

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

/* --- Tab Navigation --- */
.tab-btn {
    border-bottom: 2px solid transparent;
    transition: all 0.3s;
    color: var(--color-text-secondary);
    min-height: 44px;
    padding: 0.75rem 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.tab-btn.active {
    border-color: var(--color-brand);
    color: var(--color-brand);
    font-weight: 600;
}

/* --- Utility Classes --- */
.container-custom {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1rem;
}

@media (min-width: 640px) {
    .container-custom {
        padding: 0 1.5rem;
    }
}

@media (min-width: 1024px) {
    .container-custom {
        padding: 0 2rem;
    }
}

/* --- Page Transitions --- */
.page-transition {
    animation: fadeIn 0.4s ease-out;
}

/* --- Loading Spinner --- */
.spinner {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    border: 3px solid var(--color-focus-ring);
    border-radius: 50%;
    border-top-color: var(--color-brand);
    animation: spin 0.8s linear infinite;
}

/* --- Responsive Helpers --- */
@media (max-width: 768px) {
    body {
        font-size: 14px;
    }
}

/* --- Accessibility --- */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* --- Focus Styles --- */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[role="button"]:focus-visible,
[role="combobox"]:focus-visible,
[role="menuitem"]:focus-visible {
    outline: 2px solid var(--color-brand);
    outline-offset: 2px;
}


/* --- Dark Mode Toggle Class --- */
html.dark-mode {
    color-scheme: dark;
}

html.dark-mode {
    --color-bg: #0f172a;
    --color-bg-secondary: #1e293b;
    --color-text: #f1f5f9;
    --color-text-secondary: #cbd5e1;
    --color-text-tertiary: #94a3b8;
    --color-surface: #1e293b;
    --color-surface-light: #0f172a;
    --color-border: rgba(100, 116, 139, 0.2);
    --color-border-light: #334155;
    --color-focus-ring: rgba(139, 92, 246, 0.2);
    --color-hover-brand: rgba(139, 92, 246, 0.15);
    --scrollbar-track: #1e293b;
    --scrollbar-thumb: #475569;
    --scrollbar-thumb-hover: #64748b;
}

html.dark-mode .bg-white {
    background-color: var(--color-surface) !important;
}

html.dark-mode .bg-slate-50,
html.dark-mode .bg-gray-50 {
    background-color: var(--color-bg) !important;
}

html.dark-mode .bg-slate-100,
html.dark-mode .bg-gray-100 {
    background-color: var(--color-bg-secondary) !important;
}

html.dark-mode .bg-slate-200,
html.dark-mode .bg-gray-200 {
    background-color: #334155 !important;
}

html.dark-mode .text-slate-600,
html.dark-mode .text-gray-600 {
    color: var(--color-text-secondary) !important;
}

html.dark-mode .text-slate-700,
html.dark-mode .text-gray-700,
html.dark-mode .text-slate-800,
html.dark-mode .text-gray-800 {
    color: var(--color-text) !important;
}

html.dark-mode .border-slate-200,
html.dark-mode .border-gray-200 {
    border-color: var(--color-border) !important;
}

html.dark-mode .border-slate-100,
html.dark-mode .border-gray-100 {
    border-color: var(--color-border) !important;
}

/* Dark mode toggle button styling */
.dark-mode-toggle {
    padding: 0.5rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-surface);
    color: var(--color-text);
    cursor: pointer;
    transition: all 0.3s ease;
}

.dark-mode-toggle:hover {
    background: var(--color-hover-brand);
    border-color: var(--color-brand);
}

.dark-mode-toggle:focus-visible {
    outline: 2px solid var(--color-brand);
    outline-offset: 2px;
}
