/**
 * Custom CSS for SGT (Sistema de Gestión de Turnos)
 * Servicoop Puerto Madryn
 */

/* Root Variables */
:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --border-radius: 0.375rem;
    --box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --box-shadow-lg: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

/* Global Styles */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--dark-color);
}

body.home-page,
body.shared-background-page {
    min-height: 100vh;
    background-color: var(--sgt-background-fallback, #0b315d);
    background-image: var(--sgt-background-image, none);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    overflow-x: hidden;
    position: relative;
    isolation: isolate;
}

body.home-page::before,
body.home-page::after,
body.shared-background-page::before,
body.shared-background-page::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
}

body.home-page::before,
body.shared-background-page::before {
    display: none;
}

body.home-page::after,
body.shared-background-page::after {
    z-index: 0;
    background:
        linear-gradient(180deg, rgba(5, 25, 46, 0.56) 0%, rgba(6, 33, 61, 0.45) 35%, rgba(7, 38, 70, 0.72) 100%);
}

body.home-page > *,
body.shared-background-page > * {
    position: relative;
    z-index: 1;
}

body.home-page .navbar,
body.home-page footer {
    background: rgba(13, 110, 253, 0.82) !important;
    backdrop-filter: blur(10px);
}

body.home-page .alert {
    background-color: rgba(255, 255, 255, 0.9);
}

/* Custom Navbar */
.navbar-brand {
    font-weight: 600;
    font-size: 1.5rem;
}

.navbar-nav .nav-link {
    font-weight: 500;
    transition: color 0.3s ease, text-decoration-color 0.3s ease, font-weight 0.3s ease;
    color: #ffffff !important;
    text-decoration: underline 2px solid transparent;
    text-underline-offset: 4px;
}

.navbar-nav .nav-link:hover,
.navbar-nav .nav-link:focus-visible {
    color: #ffffff !important;
    text-decoration-color: rgba(255, 255, 255, 0.55);
}

.navbar-nav .nav-link.active {
    color: #ffffff !important;
    font-weight: 700;
    text-decoration-color: #ffffff;
}

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    min-height: 60vh;
    display: flex;
    align-items: center;
}

.home-hero-section {
    background: transparent;
    min-height: calc(100vh - 72px);
}

.home-hero-copy,
.home-hero-visual {
    background: rgba(9, 26, 48, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 1.25rem;
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.22);
    backdrop-filter: blur(12px);
}

.home-hero-copy {
    color: #fff;
    padding: 2.5rem;
}

.home-hero-copy .display-4,
.home-hero-copy .lead {
    color: #fff;
    text-shadow: 0 2px 14px rgba(0, 0, 0, 0.25);
}

.home-hero-visual {
    color: #fff;
    padding: 2.5rem 1.5rem;
}

.home-hero-visual .display-1 {
    color: rgba(255, 255, 255, 0.92) !important;
    opacity: 0.95;
}

.home-page-section h2 {
    color: #fff;
    text-shadow: 0 2px 18px rgba(0, 0, 0, 0.28);
}

.hero-section .display-1 {
    color: var(--primary-color);
    opacity: 0.1;
    font-size: 8rem;
}

/* Cards */
.card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    transition: all 0.3s ease;
}

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

body.home-page .card {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(8px);
}

.card-header {
    border-bottom: none;
    border-radius: var(--border-radius) var(--border-radius) 0 0 !important;
}

.card-footer {
    border-top: 1px solid rgba(0, 0, 0, 0.125);
    border-radius: 0 0 var(--border-radius) var(--border-radius) !important;
}

/* Buttons */
.btn {
    border-radius: var(--border-radius);
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1.1rem;
}

.btn-outline-info {
    --bs-btn-color: #055160;
    --bs-btn-border-color: #055160;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: #055160;
    --bs-btn-hover-border-color: #055160;
    --bs-btn-focus-shadow-rgb: 5, 81, 96;
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: #055160;
    --bs-btn-active-border-color: #055160;
    --bs-btn-disabled-color: #055160;
    --bs-btn-disabled-border-color: #055160;
}

/* Forms */
.form-control {
    border-radius: var(--border-radius);
    border: 1px solid #ced4da;
    transition: all 0.3s ease;
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.form-select {
    border-radius: var(--border-radius);
}

.input-group .btn {
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
}

/* Alerts */
.alert {
    border: none;
    border-radius: var(--border-radius);
    border-left: 4px solid;
}

.alert-success {
    border-left-color: var(--success-color);
    background-color: rgba(25, 135, 84, 0.1);
}

.alert-danger {
    border-left-color: var(--danger-color);
    background-color: rgba(220, 53, 69, 0.1);
}

.alert-warning {
    border-left-color: var(--warning-color);
    background-color: rgba(255, 193, 7, 0.1);
}

.alert-info {
    border-left-color: var(--info-color);
    background-color: rgba(13, 202, 240, 0.1);
}

/* Dashboard Styles */
.dashboard-card {
    background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
    border-left: 4px solid var(--primary-color);
}

.dashboard-card .card-body {
    padding: 2rem;
}

.dashboard-stat {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

.dashboard-label {
    font-size: 0.9rem;
    color: var(--secondary-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Tables */
.table {
    border-radius: var(--border-radius);
    overflow: hidden;
}

.table thead th {
    background-color: var(--primary-color);
    color: white;
    border: none;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

.table tbody tr {
    transition: background-color 0.3s ease;
}

.table tbody tr:hover {
    background-color: rgba(13, 110, 253, 0.05);
}

/* Status Badges */
.status-badge {
    padding: 0.375rem 0.75rem;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-pendiente {
    background-color: rgba(255, 193, 7, 0.2);
    color: #856404;
}

.status-confirmado {
    background-color: rgba(25, 135, 84, 0.2);
    color: #0f5132;
}

.status-reservado {
    background-color: rgba(255, 193, 7, 0.2);
    color: #856404;
}

.status-llamado {
    background-color: rgba(255, 193, 7, 0.35);
    color: #664d03;
}

.status-atendiendo {
    background-color: rgba(13, 202, 240, 0.2);
    color: #055160;
}

.status-completado {
    background-color: rgba(25, 135, 84, 0.2);
    color: #0f5132;
}

.status-atendido {
    background-color: rgba(13, 202, 240, 0.2);
    color: #055160;
}

.status-cancelado {
    background-color: rgba(220, 53, 69, 0.2);
    color: #58151c;
}

/* Sidebar */
.sidebar {
    background: linear-gradient(180deg, var(--primary-color) 0%, #0a58ca 100%);
    min-height: 100vh;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
}

.sidebar .nav-link {
    color: rgba(255, 255, 255, 0.92);
    padding: 1rem 1.5rem;
    border-radius: 0;
    transition: all 0.3s ease;
    border-left: 3px solid transparent;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    color: white;
    background-color: rgba(255, 255, 255, 0.1);
    border-left-color: white;
}

.sidebar .nav-link i {
    width: 20px;
    text-align: center;
}

/* Content Area */
.content-area {
    background-color: #f8f9fa;
    min-height: 100vh;
    padding: 2rem;
}

/* Calendar Styles */
.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #dee2e6;
    cursor: pointer;
    transition: all 0.3s ease;
}

.calendar-day:hover {
    background-color: rgba(13, 110, 253, 0.1);
}

.calendar-day.available {
    background-color: rgba(25, 135, 84, 0.1);
    color: var(--success-color);
}

.calendar-day.unavailable {
    background-color: rgba(220, 53, 69, 0.1);
    color: var(--danger-color);
    cursor: not-allowed;
}

.calendar-day.selected {
    background-color: var(--primary-color);
    color: white;
}

/* Time Slots (three-state) */
.time-slot {
    padding: 0.75rem;
    border: 2px solid #dee2e6;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    position: relative;
}

.time-slot:hover {
    border-color: var(--primary-color);
    background-color: rgba(13, 110, 253, 0.05);
    transform: translateY(-1px);
}

.time-slot.available {
    border-color: var(--success-color);
    background-color: rgba(25, 135, 84, 0.08);
}

.time-slot.available:hover {
    box-shadow: 0 0.35rem 0.9rem rgba(25, 135, 84, 0.18);
}

.time-slot.unavailable {
    cursor: not-allowed;
    opacity: 0.9;
}

.time-slot.unavailable:hover {
    transform: none;
}

.time-slot.capacity-full {
    border-color: #f59e0b;
    background-color: rgba(245, 158, 11, 0.1);
}

.time-slot.member-conflict {
    border-color: #6c757d;
    background-color: rgba(108, 117, 125, 0.12);
}

.time-slot.member-conflict::after {
    content: "reserved";
    position: absolute;
    z-index: 2;
    top: 0;
    right: 0;
    background-color: #6c757d;
    color: white;
    font-size: 0.6rem;
    letter-spacing: 0.05em;
    padding: 0.1rem 0.35rem;
    border-bottom-left-radius: 0.4rem;
    border-top-right-radius: calc(var(--border-radius) - 2px);
    text-transform: none;
    font-weight: 700;
    pointer-events: none;
    white-space: nowrap;
    line-height: 1.1;
}

.time-slot.legend-swatch {
    width: 5.25rem;
    min-width: 5.25rem;
    max-width: 5.25rem;
    height: 3.5rem;
    min-height: 3.5rem;
    max-height: 3.5rem;
    display: inline-flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 0.75rem;
    line-height: 1;
    white-space: nowrap;
    overflow: visible;
    text-align: center;
    font-size: 0.95rem;
    font-weight: 700;
    vertical-align: middle;
}

.time-slot.legend-swatch strong {
    font-weight: 700;
    font-size: 0.95rem;
    line-height: 1;
    white-space: nowrap;
    letter-spacing: 0;
}

.time-slot.legend-swatch.member-conflict::after {
    font-size: 0.55rem;
    padding: 0.08rem 0.3rem;
}

.time-slot.selected {
    border-color: var(--primary-color);
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 0.5rem 1rem rgba(13, 110, 253, 0.25);
}

.time-slot.selected.member-conflict::after,
.time-slot.selected.capacity-full::after {
    background-color: white;
    color: var(--primary-color);
}

/* Loading Spinner */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .hero-section {
        min-height: 50vh;
        text-align: center;
    }

    .home-hero-copy,
    .home-hero-visual {
        padding: 1.5rem;
    }
    
    .hero-section .display-1 {
        font-size: 4rem;
    }
    
    .dashboard-card .card-body {
        padding: 1.5rem;
    }
    
    .content-area {
        padding: 1rem;
    }
    
    .sidebar {
        min-height: auto;
    }
}

@media (max-width: 576px) {
    .hero-section .display-4 {
        font-size: 1.8rem;
    }
    
    .dashboard-stat {
        font-size: 2rem;
    }
    
    .btn-lg {
        padding: 0.5rem 1rem;
        font-size: 1rem;
    }
}

/* Print Styles */
@media print {
    .navbar,
    .sidebar,
    .btn,
    .alert {
        display: none !important;
    }
    
    .content-area {
        padding: 0;
        background: white;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #dee2e6;
    }
}

/* Utility Classes */
.text-primary-custom {
    color: var(--primary-color) !important;
}

.bg-primary-custom {
    background-color: var(--primary-color) !important;
}

.border-primary-custom {
    border-color: var(--primary-color) !important;
}

.shadow-custom {
    box-shadow: var(--box-shadow-lg) !important;
}

.rounded-custom {
    border-radius: var(--border-radius) !important;
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-in {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

/* Focus Styles for Accessibility */
.btn:focus,
.form-control:focus,
.form-select:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .card {
        border: 2px solid var(--dark-color);
    }
    
    .btn {
        border-width: 2px;
    }
}

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