/* Calendar Guide Modal Styles */

.calendar-guide-modal {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1050;
    display: none;
}

.calendar-guide-modal.show {
    display: block;
}

/* Minimized Modal Button */
.modal-minimized-button {
    position: relative;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7b2cbf 0%, #9d4edd 100%);
    border: none;
    color: white;
    font-size: 1.5rem;
    box-shadow: 0 4px 16px rgba(123, 44, 191, 0.4);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse-bounce 2s infinite;
}

.modal-minimized-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(123, 44, 191, 0.6);
}

.modal-minimized-button .step-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ff6b6b;
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 12px;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

@keyframes pulse-bounce {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.calendar-guide-modal.minimized .calendar-guide-content {
    display: none;
}

/* Mobile scroll hint */
.mobile-scroll-hint {
    display: none;
}

.calendar-guide-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 450px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: slideInRight 0.3s ease-out;
    overflow: hidden;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Header */
.calendar-guide-header {
    background: linear-gradient(135deg, #7b2cbf 0%, #9d4edd 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.calendar-guide-header .modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    flex: 1;
}

.calendar-guide-header .header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.calendar-guide-header .btn-icon,
.calendar-guide-header .btn-close-modal {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}

.calendar-guide-header .btn-icon:hover,
.calendar-guide-header .btn-close-modal:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Progress Bar */
.progress-container {
    padding: 15px 20px 10px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
}

.progress {
    height: 6px;
    background-color: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #7b2cbf 0%, #9d4edd 100%);
    transition: width 0.3s ease;
}

.progress-text {
    color: #6c757d;
    font-size: 0.875rem;
    display: block;
    text-align: center;
}

/* Body */
.calendar-guide-body {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
}

.calendar-guide-body::-webkit-scrollbar {
    width: 8px;
}

.calendar-guide-body::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.calendar-guide-body::-webkit-scrollbar-thumb {
    background: #9d4edd;
    border-radius: 4px;
}

/* Footer */
.calendar-guide-footer {
    padding: 16px 20px;
    background: #f8f9fa;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    gap: 12px;
}

.calendar-guide-footer .btn {
    font-weight: 500;
    padding: 10px 24px;
    border-radius: 8px;
    transition: all 0.2s;
}

.btn-previous {
    background: #6c757d;
    border: none;
    color: white;
}

.btn-previous:hover:not(:disabled) {
    background: #5a6268;
}

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

.btn-next {
    background: linear-gradient(135deg, #7b2cbf 0%, #9d4edd 100%);
    background-color: #7b2cbf !important;
    border: none;
    color: white !important;
    flex: 1;
}

.btn-next:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(123, 44, 191, 0.4);
}

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

/* Knowledge Check Styles */
.knowledge-check-content {
    padding: 0;
}

/* Quiz buttons - purple for desktop and mobile */
.knowledge-check-content .btn-primary {
    background: linear-gradient(135deg, #7b2cbf 0%, #9d4edd 100%) !important;
    border: none !important;
}

.knowledge-check-content .btn-primary:hover {
    background: linear-gradient(135deg, #6a1faf 0%, #8d3dcd 100%) !important;
}

/* Role selection buttons - purple theme */
.role-select-btn {
    border: 2px solid #7b2cbf;
    color: #7b2cbf;
    transition: all 0.2s ease;
}

.role-select-btn small {
    color: #6c757d;
    transition: color 0.2s ease;
}

.role-select-btn:hover {
    background: linear-gradient(135deg, #7b2cbf 0%, #9d4edd 100%);
    color: white;
    border-color: #7b2cbf;
}

.role-select-btn:hover small {
    color: rgba(255, 255, 255, 0.85);
}

/* Complete Education button - purple instead of green */
.calendar-guide-body .btn-success {
    background: linear-gradient(135deg, #7b2cbf 0%, #9d4edd 100%) !important;
    border: none !important;
}

.calendar-guide-body .btn-success:hover {
    background: linear-gradient(135deg, #6a1faf 0%, #8d3dcd 100%) !important;
}

/* Yes/No buttons - centered on desktop */
.yes-no-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 1rem;
}

.yes-no-buttons .btn {
    min-width: 120px;
}

.question-header {
    margin-bottom: 20px;
}

.question-text {
    font-size: 1.125rem;
    font-weight: 600;
    color: #2c3e50;
    line-height: 1.5;
}

.answer-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.answer-option {
    padding: 16px 20px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
    text-align: left;
}

.answer-option:hover {
    border-color: #9d4edd;
    background: #f8f3ff;
}

.answer-option.selected {
    border-color: #7b2cbf;
    background: #f0e6ff;
}

.answer-option.correct {
    border-color: #28a745;
    background: #d4edda;
}

.answer-option.incorrect {
    border-color: #dc3545;
    background: #f8d7da;
}

/* Ensure correct/incorrect styling overrides selected in results view */
.answer-option.correct.selected {
    border-color: #28a745;
    background: #d4edda;
}

.answer-option.incorrect.selected {
    border-color: #dc3545;
    background: #f8d7da;
}

.option-text {
    flex: 1;
    font-size: 1rem;
}

.option-check,
.option-icon {
    font-size: 1.25rem;
    margin-left: 12px;
}

.option-check {
    color: #7b2cbf;
}

.answer-results .answer-option {
    cursor: default;
    pointer-events: none;
}

.answer-results .answer-option:hover {
    border-color: inherit;
    background: inherit;
}

/* Preferences Styles */
.preferences-content {
    padding: 0;
}

.preference-section {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.preference-section:last-of-type {
    border-bottom: none;
}

.preference-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.preference-icon {
    font-size: 1.5rem;
    color: #7b2cbf;
}

.preference-header h6 {
    margin: 0;
    font-weight: 600;
    font-size: 1.125rem;
}

.preference-description {
    margin-bottom: 16px;
}

.language-buttons {
    display: flex;
    gap: 12px;
}

.language-btn {
    flex: 1;
    padding: 12px 20px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.language-btn:hover {
    border-color: #9d4edd;
    background: #f8f3ff;
}

.language-btn.active {
    border-color: #7b2cbf;
    background: linear-gradient(135deg, #7b2cbf 0%, #9d4edd 100%);
    color: white;
}

/* Toggle Switch */
.toggle-switch {
    display: flex;
    align-items: center;
    gap: 12px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 54px;
    height: 28px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 28px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

input:checked + .slider {
    background: linear-gradient(135deg, #7b2cbf 0%, #9d4edd 100%);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.toggle-label {
    font-weight: 500;
    color: #495057;
}

.preference-info {
    padding: 12px;
    background: #e7f3ff;
    border-radius: 6px;
    display: flex;
    align-items: center;
    margin-top: 20px;
}

/* Spotlight Highlighting (always on) */
.highlight-spotlight {
    animation: spotlightPulse 2s infinite;
    box-shadow: 0 0 0 4px rgba(123, 44, 191, 0.5);
    border-radius: 4px;
}

@keyframes spotlightPulse {
    0%, 100% {
        box-shadow: 0 0 0 4px rgba(123, 44, 191, 0.5);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(123, 44, 191, 0.3), 0 0 20px rgba(123, 44, 191, 0.4);
    }
}

/* Responsive Design - Mobile optimizations */
@media (max-width: 768px) {
    .calendar-guide-modal {
        bottom: 10px; /* Prevent edge gesture conflicts */
        right: 10px;
        left: 10px;
        padding: 0;
    }

    .calendar-guide-modal.minimized {
        bottom: 20px;
        right: 20px;
        left: auto;
    }

    .modal-minimized-button {
        width: 56px;
        height: 56px;
        font-size: 1.25rem;
    }

    /* Mobile scroll hint bar - hide to save space */
    .mobile-scroll-hint {
        display: none; /* Removed to save vertical space */
    }

    .calendar-guide-content {
        max-width: 100%;
        max-height: 45vh; /* Increased from 30vh - allows 55% screen for calendar */
        min-height: 280px; /* Ensure minimum usable space */
        border-radius: 16px 16px 0 0;
        animation: slideInUp 0.3s ease-out;
        position: relative;
    }

    @keyframes slideInUp {
        from {
            transform: translateY(100%);
            opacity: 0;
        }
        to {
            transform: translateY(0);
            opacity: 1;
        }
    }

    .calendar-guide-header {
        padding: 6px 10px; /* Minimal padding */
        min-height: 36px; /* Reduced height */
        background: linear-gradient(135deg, #7b2cbf 0%, #9d4edd 100%) !important; /* Purple gradient back */
        color: white !important; /* White text on purple */
        border-bottom: none;
    }

    .calendar-guide-header .modal-title {
        font-size: 0.8rem; /* Keep small */
        font-weight: 600;
        color: white !important;
    }

    .calendar-guide-header .btn-icon {
        background: rgba(255, 255, 255, 0.2) !important; /* Light white for buttons on purple */
        color: white !important;
        width: 28px !important;
        height: 28px !important;
        font-size: 0.7rem;
    }

    .calendar-guide-header .btn-icon:hover {
        background: rgba(255, 255, 255, 0.3) !important;
    }

    .calendar-guide-body {
        padding: 10px 12px; /* Tighter padding */
        max-height: calc(45vh - 105px); /* More space for content */
        font-size: 0.8rem; /* Smaller text for mobile */
        line-height: 1.4; /* Compact line spacing */
        overflow-y: auto;
        -webkit-overflow-scrolling: touch; /* Smooth iOS scrolling */
    }

    .calendar-guide-body p {
        margin-bottom: 0.4rem; /* Reduce paragraph spacing */
    }

    /* Make modal narrower on very small screens */
    @media (max-width: 480px) {
        .calendar-guide-content {
            margin: 0 5px; /* Add side margins to make it narrower */
        }

        .calendar-guide-body {
            font-size: 0.75rem; /* Even smaller on tiny screens */
            padding: 8px 10px;
        }

        .calendar-guide-header .modal-title {
            font-size: 0.7rem;
        }
    }

    .calendar-guide-footer {
        flex-direction: row;
        padding: 4px 8px; /* Even more compact */
        gap: 6px;
    }

    .calendar-guide-footer .btn {
        padding: 5px 8px; /* Smaller buttons */
        font-size: 0.75rem; /* Smaller text */
    }

    .btn-previous {
        flex: 0 0 auto;
        min-width: 55px; /* Compact */
    }

    .btn-next {
        flex: 0 0 auto; /* Don't grow */
        min-width: 80px; /* Fixed reasonable width */
        max-width: 100px; /* Don't get huge */
    }

    /* Adjust audio button for mobile */
    .btn-audio {
        font-size: 0.85rem;
        padding: 6px 12px;
        margin: 2px auto;
        display: inline-block;
    }

    .audio-section {
        margin-bottom: 0.25rem !important; /* Remove extra space below audio section */
        margin-top: 0.25rem !important; /* Remove extra space above audio section */
        text-align: center;
    }

    /* Better spacing for yes/no buttons */
    .yes-no-buttons {
        display: flex;
        flex-direction: row;
        gap: 8px;
        margin-top: 0.5rem;
    }

    .yes-no-buttons .btn {
        width: 100%;
        margin: 0 !important;
        padding: 8px 12px; /* Reduced from 10px 16px */
        font-size: 0.85rem; /* Reduced from 0.9rem */
    }

    /* Compact progress bar */
    .progress-container {
        padding: 6px 14px; /* Reduced padding */
        margin-bottom: 8px; /* Reduce spacing */
    }

    .progress-text {
        font-size: 0.75rem; /* Slightly smaller */
    }

    .progress-bar {
        height: 6px; /* Slightly thinner */
    }

    /* Smaller quiz text on mobile */
    .question-text {
        font-size: 0.9rem; /* Reduced from 1.125rem */
        line-height: 1.3;
        margin-bottom: 0.75rem;
    }

    .answer-option {
        padding: 10px 12px; /* Reduced from 16px 20px */
        font-size: 0.85rem;
    }

    .option-text {
        font-size: 0.85rem;
    }

    /* Quiz button styling - smaller and purple on mobile */
    .knowledge-check-content .btn-primary {
        background: linear-gradient(135deg, #7b2cbf 0%, #9d4edd 100%) !important;
        border: none !important;
        padding: 8px 16px !important; /* Reduced from default btn-lg */
        font-size: 0.85rem !important;
    }

    .knowledge-check-content .btn-primary:hover {
        background: linear-gradient(135deg, #6a1faf 0%, #8d3dcd 100%) !important;
    }
}

@media (max-width: 480px) {
    .language-buttons {
        flex-direction: column;
    }

    .language-btn {
        width: 100%;
    }

    .modal-minimized-button {
        width: 52px;
        height: 52px;
        font-size: 1.15rem;
    }

    .modal-minimized-button .step-badge {
        font-size: 0.7rem;
        padding: 3px 6px;
    }
}

/* ============================================
   Full-screen quiz mode (mobile + tablet <1024px)
   ============================================ */
@media (max-width: 1024px) {
    .calendar-guide-modal.quiz-fullscreen {
        top: 0;
        bottom: 0;
        left: 0;
        right: 0;
        padding: 0;
        z-index: 1060;
    }

    .calendar-guide-modal.quiz-fullscreen .calendar-guide-content {
        max-height: 100vh;
        height: 100vh;
        min-height: 100vh;
        border-radius: 0;
        animation: quizFadeIn 0.3s ease-out;
    }

    .calendar-guide-modal.quiz-fullscreen .calendar-guide-body {
        max-height: calc(100vh - 130px);
        padding: 16px 20px;
        font-size: 1rem;
        line-height: 1.6;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .calendar-guide-modal.quiz-fullscreen .calendar-guide-header {
        padding: 12px 16px;
        min-height: 44px;
    }

    .calendar-guide-modal.quiz-fullscreen .calendar-guide-header .modal-title {
        font-size: 1rem;
        font-weight: 600;
    }

    .calendar-guide-modal.quiz-fullscreen .question-text {
        font-size: 1.1rem;
        line-height: 1.5;
        margin-bottom: 1rem;
    }

    .calendar-guide-modal.quiz-fullscreen .answer-option {
        padding: 14px 16px;
        font-size: 1rem;
        min-height: 48px;
    }

    .calendar-guide-modal.quiz-fullscreen .option-text {
        font-size: 1rem;
    }

    .calendar-guide-modal.quiz-fullscreen .knowledge-check-content .btn-primary {
        padding: 12px 24px !important;
        font-size: 1rem !important;
    }

    /* Quiz progress bar prominence in fullscreen */
    .calendar-guide-modal.quiz-fullscreen .knowledge-check-content .progress {
        height: 8px;
        margin-bottom: 12px;
    }

    .calendar-guide-modal.quiz-fullscreen .question-header h6 {
        font-size: 1rem;
        font-weight: 600;
        color: #7b2cbf;
    }

    /* Smooth transition for modal content growing/shrinking */
    .calendar-guide-content {
        transition: max-height 0.3s ease-in-out, height 0.3s ease-in-out, border-radius 0.3s ease-in-out;
    }

    @keyframes quizFadeIn {
        from { opacity: 0; }
        to { opacity: 1; }
    }
}

/* ============================================
   Printed calendar prompt (shown during quiz)
   ============================================ */
.printed-calendar-prompt {
    background: linear-gradient(135deg, #e7f3ff 0%, #f0e6ff 100%);
    border: 1px solid #b8d4ff;
    border-radius: 8px;
    padding: 12px 16px;
    font-weight: 500;
    font-size: 0.95rem;
    color: #2c3e50;
    animation: promptSlideDown 0.3s ease-out;
}

.printed-calendar-prompt i {
    color: #7b2cbf;
    animation: pointRight 1.5s ease-in-out infinite;
}

@keyframes pointRight {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(4px); }
}

@keyframes promptSlideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Accessibility */
.btn:focus-visible,
.answer-option:focus-visible,
.language-btn:focus-visible {
    outline: 3px solid #7b2cbf;
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .calendar-guide-modal {
        display: none !important;
    }
}
