/* Schedule Page Specific Styles */

/* Page Hero */
.page-hero {
    background: var(--secondary-color);
    padding: 120px 0 60px;
    text-align: center;
    color: var(--text-light);
}

.page-hero-content h1 {
    font-size: 3rem;
    font-weight: 300;
    letter-spacing: 5px;
    margin-bottom: 1rem;
}

.page-hero-content .subtitle {
    font-size: 1.3rem;
    font-weight: 300;
}

/* Schedule Section */
.schedule-section {
    padding: 3rem 0;
    background: var(--text-light);
}

/* Class Tabs */
.class-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-bottom: 2rem;
}

.tab-button {
    padding: 0.5rem 1.5rem;
    border: 2px solid var(--primary-color);
    background: var(--text-light);
    color: var(--primary-color);
    border-radius: 25px;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
    font-weight: 500;
}

.tab-button:hover {
    background: var(--primary-color);
    color: var(--text-light);
}

.tab-button.active {
    background: var(--primary-color);
    color: var(--text-light);
}

/* Calendar Container */
.calendar-container {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 800px;
    margin-bottom: 2rem;
    border: 1px solid #ddd;
    border-radius: 10px;
    background: var(--text-light);
    position: relative;
}

/* Mobile Navigation Controls */
.calendar-navigation {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: var(--gray-light);
    border-bottom: 1px solid #ddd;
    border-radius: 10px 10px 0 0;
}

.nav-button {
    background: var(--primary-color);
    color: var(--text-light);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    font-size: 1.2rem;
    touch-action: manipulation;
}

.nav-button:hover {
    background: var(--secondary-color);
    transform: scale(1.1);
}

.nav-button:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.day-indicator {
    font-weight: 500;
    color: var(--primary-color);
    text-align: center;
    min-width: 120px;
}

.today-button {
    background: var(--secondary-color);
    color: var(--text-light);
    border: none;
    border-radius: 20px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
    touch-action: manipulation;
}

.today-button:hover {
    background: var(--primary-color);
}

/* Sticky wrapper for navigation + header: sticks inside the container's
   internal scroll on desktop, and to the page viewport on mobile */
.calendar-sticky-head {
    position: sticky;
    top: 0;
    z-index: 100;
}

/* Calendar Header */
.calendar-header {
    display: grid;
    grid-template-columns: 80px repeat(7, 1fr);
    background: var(--primary-color);
    color: var(--text-light);
    font-weight: 600;
}

.calendar-header > div {
    padding: 1rem;
    text-align: center;
    border-right: 1px solid rgba(255,255,255,0.2);
}

.calendar-header > div:last-child {
    border-right: none;
}

.time-column {
    background: var(--primary-color);
    font-size: 0.9rem;
}

/* Calendar Body */
.calendar-body {
    display: grid;
    grid-template-columns: 80px repeat(7, 1fr);
    min-height: 200px;
    position: relative;
}

/* Time Slots */
.time-slot {
    grid-column: 1;
    padding: 0.25rem;
    text-align: center;
    border-right: 1px solid #ddd;
    border-bottom: 1px solid #ddd;
    background: #f9f9f9;
    font-size: 0.75rem;
    font-weight: 500;
    color: #666;
    min-height: 25px;
    height: 25px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 0.15rem;
}

/* Class Items */
.class-item {
    padding: 0.3rem;
    margin: 0;
    border-radius: 4px;
    font-size: 0.7rem;
    cursor: pointer;
    transition: var(--transition);
    position: absolute;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    z-index: 10;
    line-height: 1.2;
}

.class-item:hover {
    transform: scale(1.02);
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}

/* Row height for proper overlap calculation */
.calendar-body > div {
    min-height: 25px;
    height: 25px;
}

.class-time {
    font-size: 0.65rem;
    opacity: 0.7;
    margin-top: 0.1rem;
}

/* Class Type Colors */
.class-item.morning {
    background: #FFE4B5;
    color: #8B6914;
}

.class-item.suave {
    background: #E6E6FA;
    color: #483D8B;
}

.class-item.dinamico {
    background: #FFB6C1;
    color: #8B1538;
}

.class-item.embarazo {
    background: #F0E68C;
    color: #6B6B00;
}

.class-item.post-parto {
    background: #DDA0DD;
    color: #8B008B;
}

.class-item.hipopresivos {
    background: #B0E0E6;
    color: #4682B4;
}

.class-item.terapeutico {
    background: #98FB98;
    color: #228B22;
}

.class-title {
    font-weight: 600;
    margin-bottom: 0.1rem;
    font-size: 0.75rem;
}

.class-instructor {
    font-size: 0.6rem;
    opacity: 0.6;
    font-weight: 400;
    margin-bottom: 0.2rem;
    line-height: 1;
}

/* Day Cells */
.day-cell {
    border-right: 1px solid #ddd;
    border-bottom: 1px solid #ddd;
    min-height: 25px;
    height: 25px;
    position: relative;
    padding: 0;
    overflow: visible;
}

.day-cell:last-child {
    border-right: none;
}

/* Collapsed empty-hours row (mobile day view). The .calendar-body > .time-gap
   selector must outrank the .calendar-body > div height rules */
.calendar-body > .time-gap {
    grid-column: 1 / -1;
    min-height: 24px;
    height: 24px;
    background: #f4f4f4;
    border-bottom: 1px solid #ddd;
    color: #aaa;
    font-size: 0.8rem;
    letter-spacing: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Download Section */
.download-section {
    text-align: center;
    margin: 2rem 0;
}

.btn-primary {
    background: var(--primary-color);
    color: var(--text-light);
    padding: 12px 30px;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: var(--transition);
}

.btn-primary:hover {
    background: var(--secondary-color);
    transform: translateY(-2px);
}

/* Admin Link */
.admin-link {
    text-align: center;
    margin-top: 2rem;
}

.admin-link a {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.9rem;
    opacity: 0.7;
    transition: var(--transition);
}

.admin-link a:hover {
    opacity: 1;
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 1024px) {
    /* Show navigation controls on tablets and mobile */
    .calendar-navigation {
        display: flex;
    }

    /* Single page scroller on touch layouts: any overflow other than visible
       would create an inner scroll area and break page-relative sticky */
    .calendar-container {
        max-height: none;
        overflow: visible;
    }

    /* Stick below the fixed site navbar (height measured in schedule.js) */
    .calendar-sticky-head {
        top: var(--navbar-height, 70px);
    }
}

@media (max-width: 768px) {
    .page-hero-content h1 {
        font-size: 2.5rem;
    }
    
    /* Tablet: Show 2-3 days */
    .calendar-header,
    .calendar-body {
        grid-template-columns: 80px repeat(var(--visible-days, 3), 1fr);
    }
    
    .calendar-container {
        font-size: 0.9rem;
    }
    
    .class-tabs {
        gap: 0.3rem;
        padding: 0 1rem;
    }
    
    .tab-button {
        padding: 0.4rem 1rem;
        font-size: 0.8rem;
    }
    
    /* Larger class items for better touch interaction */
    .class-item {
        padding: 0.5rem;
        font-size: 0.8rem;
        min-height: 40px;
        border-radius: 6px;
    }
    
    .class-title {
        font-size: 0.85rem;
        margin-bottom: 0.2rem;
    }
    
    .class-time {
        font-size: 0.7rem;
    }
    
    .class-instructor {
        font-size: 0.65rem;
    }
    
    /* Larger time slots */
    .time-slot {
        min-height: 40px;
        height: 40px;
        font-size: 0.8rem;
        padding: 0.5rem 0.2rem;
    }
    
    .calendar-body > div {
        min-height: 40px;
        height: 40px;
    }
    
    .calendar-header > div {
        padding: 1rem 0.5rem;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    /* Mobile: Show 1 day */
    .calendar-header,
    .calendar-body {
        grid-template-columns: 80px 1fr;
    }
    
    .calendar-container {
        margin: 0 -1rem 2rem -1rem;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
    
    .calendar-navigation {
        border-radius: 0;
    }
    
    /* Even larger touch targets for mobile */
    .class-item {
        padding: 0.75rem;
        font-size: 0.9rem;
        min-height: 50px;
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }
    
    .class-title {
        font-size: 1rem;
        margin-bottom: 0.3rem;
    }
    
    .class-time {
        font-size: 0.8rem;
        margin-top: 0.2rem;
    }
    
    .class-instructor {
        font-size: 0.75rem;
        margin-bottom: 0.3rem;
    }
    
    /* Larger time slots for mobile */
    .time-slot {
        min-height: 50px;
        height: 50px;
        font-size: 0.9rem;
        padding: 0.75rem 0.3rem;
    }
    
    .calendar-body > div {
        min-height: 50px;
        height: 50px;
    }
    
    .calendar-header > div {
        padding: 1.2rem 0.5rem;
        font-size: 1rem;
    }
    
    /* Mobile-specific tab styling - Horizontal scroll approach */
    .class-tabs {
        flex-wrap: nowrap;
        gap: 0.5rem;
        padding: 0 1rem;
        justify-content: flex-start;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        margin: 0 -1rem 2rem -1rem;
        padding: 1rem;
    }
    
    .class-tabs::-webkit-scrollbar {
        display: none;
    }
    
    .tab-button {
        padding: 0.5rem 1rem;
        font-size: 0.75rem;
        flex: 0 0 auto;
        min-width: fit-content;
        text-align: center;
        white-space: nowrap;
        border-radius: 20px;
        border-width: 1px;
    }
}

/* Extra small screens */
@media (max-width: 360px) {
    .tab-button {
        padding: 0.4rem 0.8rem;
        font-size: 0.7rem;
    }
    
    .class-tabs {
        gap: 0.3rem;
    }
}

/* Touch feedback */
.calendar-container {
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
}

@media (hover: none) and (pointer: coarse) {
    /* Touch device specific styles */
    .class-item:active {
        transform: scale(0.98);
        transition: transform 0.1s ease;
    }
    
    .nav-button:active {
        transform: scale(0.95);
    }
    
    .tab-button:active {
        transform: scale(0.98);
    }
}
