/* Calendar education page styles.
   Global (not component-scoped) because several selectors target elements
   created by JavaScript (.magnifier-lens) or rendered by child components
   (.education-highlight), which Blazor's scoped CSS cannot reach.
   Extracted from the inline <style> block formerly in PatientEducation.razor. */

/* Full-screen calendar layout */
.calendar-fullscreen {
    width: 100%;
    min-height: 100vh;
    padding: 20px;
    background: white;
    overflow-x: auto;
}

.calendar-content {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* === Tab navigation === */
.calendar-tab-nav .nav-tabs {
    border-bottom: 2px solid #dee2e6;
}

.calendar-tab-nav .nav-link {
    border: none;
    border-bottom: 3px solid transparent;
    color: #6c757d;
    font-weight: 500;
    padding: 8px 16px;
    cursor: pointer;
    background: none;
    transition: all 0.2s;
}

.calendar-tab-nav .nav-link:hover {
    color: #495057;
    border-bottom-color: #adb5bd;
}

.calendar-tab-nav .nav-link.active {
    color: #7b2cbf;
    border-bottom-color: #7b2cbf;
    font-weight: 600;
}

/* === IMAGE MODE: html2canvas rendered image === */
.calendar-image-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    overflow: auto;
    position: relative;
    background: #f8f9fa;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    touch-action: pan-x pan-y pinch-zoom; /* Enable native pinch-to-zoom */
    -webkit-overflow-scrolling: touch;
}

.calendar-image {
    display: block;
    width: 100%;
    height: auto;
    cursor: grab;
}

.calendar-image:active {
    cursor: grabbing;
}

/* === MAGNIFIER LENS === */
.magnifier-lens {
    position: absolute;
    border: 3px solid #7b2cbf;
    border-radius: 50%;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3), inset 0 0 10px rgba(0,0,0,0.1);
    pointer-events: none;
    z-index: 100;
    background-repeat: no-repeat;
    cursor: none;
}

.magnifier-hint {
    text-align: center;
    padding: 6px 12px;
    font-size: 0.8rem;
    color: #6c757d;
    background: rgba(248,249,250,0.9);
    border-top: 1px solid #dee2e6;
}

@media (min-width: 1025px) {
    .magnifier-hint {
        display: none;
    }
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .calendar-fullscreen {
        padding: 10px;
        padding-bottom: calc(45vh + 20px); /* Match modal height (45vh) + buffer */
        min-height: 100vh;
        overflow-y: auto;
    }

    .calendar-content {
        padding: 12px;
        overflow-x: visible;
        margin-bottom: 20px;
    }

    /* Image mode mobile */
    .calendar-image-container {
        border-radius: 0;
    }

    .calendar-image {
        min-width: 100%;
        width: auto;
    }

    .calendar-tab-nav .nav-link {
        padding: 6px 12px;
        font-size: 0.85rem;
    }

    /* Make tables responsive on mobile only — exclude the hidden conversion div */
    .calendar-content > table,
    .calendar-content > div:not(#calendar-html-temp) table {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
        font-size: 0.8rem;
    }

    .calendar-content > table th,
    .calendar-content > table td,
    .calendar-content > div:not(#calendar-html-temp) table th,
    .calendar-content > div:not(#calendar-html-temp) table td {
        font-size: 0.75rem !important;
        padding: 6px 4px !important;
    }

    /* Adjust logo and images on mobile */
    .calendar-content .logo {
        max-width: 100px !important;
    }

    .calendar-content > div:not(#calendar-html-temp) img {
        max-width: 100% !important;
        height: auto !important;
    }

    /* Adjust panel headings */
    .calendar-content .panel-heading {
        font-size: 0.9rem !important;
        padding: 8px !important;
    }

    /* Better text wrapping */
    .calendar-content > div:not(#calendar-html-temp) p,
    .calendar-content > div:not(#calendar-html-temp) div {
        word-wrap: break-word;
        overflow-wrap: break-word;
        font-size: 0.85rem;
    }

    /* Ensure calendar is scrollable and visible */
    body {
        overflow-y: scroll;
        -webkit-overflow-scrolling: touch;
    }
}

/* Audio button styling */
.btn-audio {
    background: linear-gradient(135deg, #7b2cbf 0%, #9d4edd 100%);
    border: none;
    color: white;
    padding: 8px 16px;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.2s;
    width: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-audio:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(123, 44, 191, 0.3);
    background: linear-gradient(135deg, #6a1faf 0%, #8d3dcd 100%);
    color: white;
}

.btn-audio:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.step-card {
    border-left: 4px solid #007bff;
    padding: 15px;
    background-color: #f8f9fa;
    border-radius: 5px;
}

/* Navigation section highlight */
.navigation-section {
    background: linear-gradient(135deg, #e8f5e9 0%, #f1f8e9 100%);
    border: 2px solid #81c784;
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.navigation-section h6 {
    color: #2e7d32;
    margin-bottom: 10px;
}

/* Make navigation buttons more prominent */
.btn-lg {
    font-size: 1.1rem;
    font-weight: 600;
    padding: 12px 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.btn-lg:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.btn-lg:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-success {
    background-color: #28a745;
    border-color: #28a745;
    animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    }
    50% {
        box-shadow: 0 2px 8px rgba(40, 167, 69, 0.4);
    }
}

.container-fluid {
    padding-top: 15px;
}

.row.flex-grow-1 {
    min-height: 0;
}

.col-md-3 {
    height: 100%;
    overflow-y: auto;
}

.col-md-9 {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.col-md-9 .card {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.col-md-9 .card-body {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 0;
}

.calendar-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: auto;
    position: relative;
    padding: 15px;
}

.calendar-container .logo {
    max-width: 200px;
    height: auto;
}

.calendar-container .umsImage {
    width: 40px;
    height: 40px;
}

.calendar-container .table {
    font-size: inherit;
}

.calendar-container .panel-heading {
    padding: 8px 15px;
}

.education-highlight {
    outline: 3px solid #ffc107;
    outline-offset: 2px;
    animation: pulse 2s infinite;
    background-color: rgba(255, 193, 7, 0.1) !important;
}

@keyframes pulse {
    0%, 100% {
        outline-color: #ffc107;
    }
    50% {
        outline-color: #ff9800;
    }
}

/* Hide calendar when quiz is fullscreen (mobile + tablet) */
@media (max-width: 1024px) {
    .calendar-fullscreen.quiz-active {
        visibility: hidden;
        height: 0;
        min-height: 0;
        padding: 0;
        overflow: hidden;
    }
}
