/* ================================
   Calendar Page Styles
   Purple Theme Edition
   ================================ */

/* Theme Colors */
:root {
    --cal-primary: #8b5cf6;
    --cal-primary-dark: #7c3aed;
    --cal-primary-light: rgba(139, 92, 246, 0.15);
    --cal-available: #8b5cf6;
    --cal-partial: #f59e0b;
    --cal-busy: #ef4444;
}

.calendar-main {
    min-height: 100vh;
    padding: 120px 40px 80px;
    position: relative;
    z-index: 1;
    max-width: 1400px;
    margin: 0 auto;
}

.calendar-header {
    text-align: center;
    margin-bottom: 50px;
}

.calendar-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 16px;
    background: linear-gradient(135deg, var(--text-primary) 0%, #8b5cf6 50%, #7c3aed 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.calendar-title .title-icon {
    display: flex;
    color: #8b5cf6;
    -webkit-text-fill-color: initial;
}

.calendar-subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
}

/* ================================
   Calendar Container
   ================================ */
.calendar-container {
    display: grid;
    grid-template-columns: 1fr 420px;
    gap: 30px;
    margin-bottom: 50px;
}

/* ================================
   Calendar Widget
   ================================ */
.calendar-widget {
    padding: 30px;
    border-radius: var(--radius-xl);
}

.calendar-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.cal-nav-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.cal-nav-btn:hover {
    background: var(--cal-primary-light);
    border-color: rgba(139, 92, 246, 0.3);
    color: var(--cal-primary);
    transform: scale(1.05);
}

.cal-month-year {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Calendar Grid */
.calendar-grid {
    margin-bottom: 24px;
}

.cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.cal-weekdays span {
    text-align: center;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 8px 0;
}

.cal-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
}

/* Day Cell - New Design */
.cal-day {
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: transparent;
    border: 2px solid transparent;
}

.cal-day .day-number {
    position: relative;
    z-index: 2;
    font-weight: 600;
}

/* Hover State */
.cal-day:hover:not(.disabled):not(.other-month) {
    background: var(--cal-primary-light);
    border-color: rgba(139, 92, 246, 0.4);
    color: var(--text-primary);
    transform: scale(1.08);
}

/* Other Month Days */
.cal-day.other-month {
    color: var(--text-muted);
    opacity: 0.3;
    cursor: default;
}

/* Today */
.cal-day.today {
    background: rgba(139, 92, 246, 0.1);
    border-color: rgba(139, 92, 246, 0.5);
    color: var(--cal-primary);
    font-weight: 700;
}

.cal-day.today::after {
    content: '';
    position: absolute;
    bottom: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    background: var(--cal-primary);
    border-radius: 50%;
}

/* Selected Day */
.cal-day.selected {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: #fff;
    font-weight: 700;
    border-color: transparent;
    box-shadow: 0 8px 25px rgba(139, 92, 246, 0.5);
    transform: scale(1.08);
}

.cal-day.selected::after {
    display: none;
}

/* Disabled Days */
.cal-day.disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

/* Availability Status - Full Background */
.cal-day.status-available {
    background: rgba(139, 92, 246, 0.08);
    border-color: rgba(139, 92, 246, 0.2);
}

.cal-day.status-available:hover:not(.disabled):not(.selected) {
    background: rgba(139, 92, 246, 0.2);
    border-color: rgba(139, 92, 246, 0.5);
}

.cal-day.status-partial {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.3);
}

.cal-day.status-partial:hover:not(.disabled):not(.selected) {
    background: rgba(245, 158, 11, 0.2);
    border-color: rgba(245, 158, 11, 0.5);
}

.cal-day.status-busy {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.2);
}

.cal-day.status-busy:hover:not(.disabled):not(.selected) {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.4);
}

/* Legend */
.calendar-legend {
    display: flex;
    justify-content: center;
    gap: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--glass-border);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 4px;
}

.legend-dot.available {
    background: rgba(139, 92, 246, 0.3);
    border: 2px solid var(--cal-primary);
}

.legend-dot.partial {
    background: rgba(245, 158, 11, 0.3);
    border: 2px solid var(--cal-partial);
}

.legend-dot.busy {
    background: rgba(239, 68, 68, 0.3);
    border: 2px solid var(--cal-busy);
}

/* ================================
   Time Slots Panel - Redesigned
   ================================ */
.timeslots-panel {
    padding: 30px;
    border-radius: var(--radius-xl);
    display: flex;
    flex-direction: column;
}

.timeslots-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--glass-border);
}

.timeslots-header h3 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.timeslots-header p {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.timeslots-content {
    flex: 1;
    overflow-y: auto;
}

.no-date-selected {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 300px;
    text-align: center;
    color: var(--text-muted);
}

.no-date-selected svg {
    margin-bottom: 16px;
    opacity: 0.5;
    color: var(--cal-primary);
}

.no-date-selected p {
    max-width: 200px;
}

/* Time Slots Grid - New Design */
.timeslots-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.timeslot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--bg-card);
    border: 2px solid var(--glass-border);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.timeslot.available:hover {
    background: var(--cal-primary-light);
    border-color: var(--cal-primary);
    transform: translateX(6px);
    box-shadow: 0 4px 20px rgba(139, 92, 246, 0.2);
}

.timeslot.booked {
    opacity: 0.5;
    cursor: not-allowed;
    background: rgba(239, 68, 68, 0.05);
    border-color: rgba(239, 68, 68, 0.2);
}

.timeslot-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.timeslot-time {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.timeslot-time svg {
    color: var(--cal-primary);
}

.time-duration {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-left: 28px;
}

.timeslot-action {
    display: flex;
    align-items: center;
}

.timeslot-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-weight: 500;
}

.timeslot-status.available {
    background: var(--cal-primary-light);
    color: var(--cal-primary);
}

.timeslot-status.booked {
    background: rgba(239, 68, 68, 0.15);
    color: var(--cal-busy);
}

/* ================================
   Info Cards
   ================================ */
.info-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.info-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
    border-radius: var(--radius-lg);
}

.info-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--cal-primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--cal-primary);
    flex-shrink: 0;
}

.info-text h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.info-text p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ================================
   Day Tooltip
   ================================ */
.day-tooltip {
    position: fixed;
    z-index: 1000;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 16px;
    min-width: 220px;
    max-width: 280px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    pointer-events: none;
}

.day-tooltip.visible {
    opacity: 1;
    visibility: visible;
}

.tooltip-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--glass-border);
}

.tooltip-date {
    font-weight: 600;
    color: var(--text-primary);
}

.tooltip-status {
    font-size: 0.75rem;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    font-weight: 500;
}

.tooltip-status.available {
    background: var(--cal-primary-light);
    color: var(--cal-primary);
}

.tooltip-status.partial {
    background: rgba(245, 158, 11, 0.15);
    color: var(--cal-partial);
}

.tooltip-status.busy {
    background: rgba(239, 68, 68, 0.15);
    color: var(--cal-busy);
}

.tooltip-events {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tooltip-event {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.85rem;
}

.tooltip-event-time {
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 50px;
}

.tooltip-event-title {
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tooltip-event-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--cal-busy);
    flex-shrink: 0;
}

.tooltip-no-events {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
}

/* ================================
   Booking Modal - Purple Theme
   ================================ */
.booking-modal {
    max-width: 480px;
    width: 100%;
}

.booking-step {
    animation: fadeIn 0.3s ease;
}

.booking-step.hidden {
    display: none;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.step-header {
    text-align: center;
    margin-bottom: 32px;
}

.step-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--cal-primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--cal-primary);
    margin: 0 auto 20px;
}

.step-icon.success {
    background: rgba(139, 92, 246, 0.2);
}

.step-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.step-header p {
    color: var(--text-muted);
}

.step-header p span {
    color: var(--cal-primary);
    font-weight: 500;
}

/* Code Input */
.code-inputs {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.code-input {
    width: 52px;
    height: 60px;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    background: var(--bg-card);
    border: 2px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.code-input:focus {
    outline: none;
    border-color: var(--cal-primary);
    box-shadow: 0 0 0 3px var(--cal-primary-light);
}

.link-btn {
    display: block;
    width: 100%;
    margin-top: 16px;
    padding: 12px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.9rem;
    cursor: pointer;
    transition: color 0.3s ease;
}

.link-btn:hover {
    color: var(--cal-primary);
}

/* Form hints */
.form-hint {
    display: block;
    margin-top: 8px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Success Animation */
.success-animation {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
}

.checkmark {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    stroke-width: 2;
    stroke: var(--cal-primary);
    stroke-miterlimit: 10;
    animation: fill 0.4s ease-in-out 0.4s forwards, scale 0.3s ease-in-out 0.9s both;
}

.checkmark-circle {
    stroke-dasharray: 166;
    stroke-dashoffset: 166;
    stroke-width: 2;
    stroke-miterlimit: 10;
    stroke: var(--cal-primary);
    fill: none;
    animation: stroke 0.6s cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

.checkmark-check {
    transform-origin: 50% 50%;
    stroke-dasharray: 48;
    stroke-dashoffset: 48;
    stroke-width: 3;
    animation: stroke 0.3s cubic-bezier(0.65, 0, 0.45, 1) 0.8s forwards;
}

@keyframes stroke {
    100% { stroke-dashoffset: 0; }
}

@keyframes scale {
    0%, 100% { transform: none; }
    50% { transform: scale3d(1.1, 1.1, 1); }
}

@keyframes fill {
    100% { box-shadow: inset 0 0 0 100px var(--cal-primary-light); }
}

/* Booking Summary */
.booking-summary {
    padding: 20px;
    border-radius: var(--radius-lg);
    margin: 24px 0;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
}

.summary-row:not(:last-child) {
    border-bottom: 1px solid var(--glass-border);
}

.summary-row span {
    color: var(--text-muted);
}

.summary-row strong {
    color: var(--text-primary);
}

/* ================================
   Calendar nav active state
   ================================ */
.nav-link.active {
    color: var(--cal-primary) !important;
}

.nav-link.active::before {
    background: var(--cal-primary) !important;
}

/* ================================
   Responsive
   ================================ */
@media (max-width: 1024px) {
    .calendar-container {
        grid-template-columns: 1fr;
    }
    
    .timeslots-panel {
        min-height: 400px;
    }
}

@media (max-width: 768px) {
    .calendar-main {
        padding: 100px 20px 60px;
    }
    
    .calendar-title {
        font-size: 2rem;
        flex-direction: column;
        gap: 12px;
    }
    
    .info-cards {
        grid-template-columns: 1fr;
    }
    
    .calendar-widget,
    .timeslots-panel {
        padding: 20px;
    }
    
    .code-inputs {
        gap: 8px;
    }
    
    .code-input {
        width: 44px;
        height: 52px;
        font-size: 1.2rem;
    }
}

/* ================================
   Loading States
   ================================ */
.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-xl);
    z-index: 10;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--glass-border);
    border-top-color: var(--cal-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ================================
   Toast Notifications
   ================================ */
.toast-notification {
    position: fixed;
    bottom: 30px;
    right: 30px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 20px 24px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    z-index: 9999;
    max-width: 420px;
    transform: translateX(120%);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toast-notification.toast-show {
    transform: translateX(0);
    opacity: 1;
}

.toast-success .toast-icon { color: var(--cal-primary); }
.toast-error .toast-icon { color: #ef4444; }
.toast-warning .toast-icon { color: #f59e0b; }
.toast-info .toast-icon { color: #3b82f6; }

.toast-icon { flex-shrink: 0; }
.toast-content { flex: 1; }
.toast-message { font-size: 0.95rem; line-height: 1.5; color: var(--text-primary); margin: 0; }

.toast-close {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.toast-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    animation: toast-progress 5s linear forwards;
}

.toast-success .toast-progress { background: linear-gradient(90deg, #8b5cf6, #7c3aed); }
.toast-error .toast-progress { background: linear-gradient(90deg, #ef4444, #dc2626); }

@keyframes toast-progress {
    from { width: 100%; }
    to { width: 0%; }
}

/* ================================
   Modal Overlay (Base styles)
   ================================ */
#bookingModal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.85) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 9999 !important;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    padding: 20px;
}

#bookingModal.active {
    opacity: 1 !important;
    visibility: visible !important;
}

#bookingModal .modal {
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 40px;
    border-radius: 20px;
    position: relative;
    background: rgba(20, 20, 30, 0.95) !important;
    border: 1px solid rgba(139, 92, 246, 0.2);
    box-shadow: 0 25px 80px rgba(139, 92, 246, 0.15);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#bookingModal.active .modal {
    transform: scale(1) translateY(0);
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

/* Form Elements */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-input,
.form-textarea {
    width: 100%;
    padding: 14px 18px;
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--cal-primary);
    box-shadow: 0 0 0 3px var(--cal-primary-light);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--text-muted);
}

.form-textarea {
    min-height: 100px;
    resize: vertical;
}

.submit-btn {
    width: 100%;
    padding: 16px 24px;
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    border: none;
    border-radius: var(--radius-md);
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
}

.submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(139, 92, 246, 0.4);
}

.submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}
