/**
 * FullCalendar Integration Styles
 * ApprenticeshipHQ Directory - Enhanced Mobile-Responsive Version
 */

/* FullCalendar Wrapper - Light Theme */
.ahq-fullcalendar-wrapper {
    margin: 2rem 0;
    padding: 1.5rem;
    background: #ffffff;
    border-radius: 0; /* Square design */
    box-shadow: none;
    border: none;
}

/* FullCalendar Container - Light Theme */
.ahq-fullcalendar {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: #ffffff !important;
    border-radius: 0; /* Square design */
    color: #1f2937;
    width: 100% !important;
}

/* Mobile/Desktop specific styling */
.ahq-fullcalendar.ahq-mobile-calendar {
    font-size: 0.9rem;
}

.ahq-fullcalendar.ahq-desktop-calendar {
    font-size: 1rem;
}

/* View-specific styling */
.ahq-fullcalendar.ahq-view-list {
    /* List view specific styles */
}

.ahq-fullcalendar.ahq-view-month {
    /* Month view specific styles */
}

/* Loading Indicator */
.ahq-calendar-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: #666;
}

.ahq-loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3788d8;
    border-radius: 0; /* Square design */
    animation: ahq-spin 1s linear infinite;
    margin-right: 0.75rem;
}

@keyframes ahq-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.ahq-loading-text {
    font-size: 0.9rem;
}

/* Empty State */
.ahq-calendar-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: #666;
}

.ahq-empty-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    opacity: 0.7;
}

.ahq-empty-title {
    margin: 0 0 0.5rem;
    font-size: 1.2rem;
    color: #333;
}

.ahq-empty-description {
    margin: 0;
    font-size: 0.9rem;
    color: #666;
}

/* Light Theme Event Details Modal */
.ahq-event-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.ahq-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.ahq-modal-content {
    position: relative;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 0; /* Square design */
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow: hidden;
    animation: ahq-modal-appear 0.2s ease-out;
}

@keyframes ahq-modal-appear {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.ahq-modal-header {
    padding: 1.5rem 1.5rem 0;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
}

.ahq-modal-title {
    margin: 0 1rem 1rem 0;
    font-size: 1.3rem;
    color: #1f2937;
    line-height: 1.4;
}

.ahq-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #6b7280;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0; /* Square design */
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.ahq-modal-close:hover {
    background: #f3f4f6;
    color: #1f2937;
}

.ahq-modal-body {
    padding: 1.5rem;
    max-height: 60vh;
    overflow-y: auto;
}

.ahq-event-details {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.ahq-event-meta {
    display: grid;
    gap: 0.75rem;
}

.ahq-event-meta-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.ahq-meta-label {
    font-weight: 600;
    color: #6b7280;
    min-width: 80px;
    flex-shrink: 0;
}

.ahq-meta-value {
    color: #1f2937;
    flex: 1;
}

.ahq-event-description {
    padding-top: 1rem;
    border-top: 1px solid #e5e7eb;
}

.ahq-description-title {
    margin: 0 0 0.75rem;
    color: #1f2937;
}

.ahq-description-content {
    color: #4b5563;
    line-height: 1.6;
}

.ahq-modal-footer {
    padding: 1rem 1.5rem 1.5rem;
    border-top: 1px solid #e5e7eb;
}

.ahq-modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

/* Button Styles */
.ahq-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border: none;
    border-radius: 0; /* Square design */
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 16px;
    font-weight: 700 !important;
    padding: .3em 1em;
    line-height: 1.7em !important;
}

.ahq-btn:after {
    width: 0
}

.ahq-btn-primary {
    background: #5eadb5;
    color: white;
    border: 1px solid #5eadb5;
}

.ahq-btn-primary:hover {
    background: #2563eb;
    border: none;
    color: white;
    text-decoration: none;
}

.ahq-btn-secondary {
    background: #f3f4f6;
    color: #1f2937;
    border: 1px solid #d1d5db;
}

.ahq-btn-secondary:hover {
    background: #e5e7eb;
    border-color: #9ca3af;
    color: #111827;
    text-decoration: none;
}

/* FullCalendar Light Theme Customizations */
.fc {
    --fc-border-color: #e5e7eb;
    --fc-button-text-color: #374151;
    --fc-button-bg-color: #ffffff;
    --fc-button-border-color: #d1d5db;
    --fc-button-hover-bg-color: #f3f4f6;
    --fc-button-hover-border-color: #9ca3af;
    --fc-button-active-bg-color: #5eadb5;
    --fc-button-active-border-color: #5eadb5;
    --fc-button-active-text-color: #ffffff;
    --fc-event-bg-color: #5eadb5;
    --fc-event-border-color: #5eadb5;
    --fc-event-text-color: #ffffff;
    --fc-today-bg-color: rgba(59, 130, 246, 0.1);
    --fc-neutral-bg-color: #ffffff;
    --fc-neutral-text-color: #1f2937;
}

/* Calendar Header Styling */
.fc-toolbar {
    margin-bottom: 1.5rem !important;
    padding: 0.75rem 0 !important;
}

.fc-toolbar-title {
    font-size: 1.5rem !important;
    font-weight: 700 !important;
    color: #1f2937 !important;
    margin: 0 !important;
}

.fc-button {
    font-size: 0.875rem !important;
    font-weight: 500 !important;
    padding: 0.625rem 1rem !important;
    border-radius: 0 !important; /* Square design */
    transition: all 0.2s ease !important;
    text-transform: none !important;
    margin: 0 0.25rem !important;
}

.fc-button:not(:disabled):active,
.fc-button:not(:disabled).fc-button-active {
    background-color: #5eadb5 !important;
    border-color: #5eadb5 !important;
    color: #ffffff !important;
}

.fc-button:focus {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3) !important;
}

.fc-button-group .fc-button {
    margin: 0 !important;
}

.fc-button-group .fc-button:first-child {
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
}

.fc-button-group .fc-button:last-child {
    border-top-left-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
}

.fc-button-group .fc-button:not(:first-child):not(:last-child) {
    border-radius: 0 !important;
}

.fc-event {
    border-radius: 0 !important; /* Square design */
    font-weight: 500 !important;
    cursor: pointer !important;
}

.fc-event:hover {
    opacity: 0.9 !important;
    transform: translateY(-1px);
    transition: all 0.2s ease;
}

/* Mobile Event Styling */
.ahq-mobile-event {
    font-size: 0.7rem !important;
    padding: 1px 3px !important;
    line-height: 1.1 !important;
    min-height: 16px !important;
}

.ahq-mobile-list-event {
    padding: 0.5rem !important;
    margin: 0.125rem 0 !important;
}

/* Month View Event Styling - Multi-line titles */
.fc-daygrid-event {
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    padding: 1px 2px !important;
    margin: 0 !important;
    border-radius: 0 !important; /* Square design */
    line-height: 1.1 !important;
    white-space: normal !important;
    overflow: visible !important;
    display: block !important;
    text-overflow: initial !important;
    min-height: auto !important;
    max-height: none !important;
    height: auto !important;
    word-wrap: break-word !important;
    word-break: break-word !important;
}

.fc-daygrid-event-harness {
    margin: 0 !important;
    overflow: visible !important;
}

.fc-daygrid-event .fc-event-title {
    font-weight: 600 !important;
    color: inherit !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
    white-space: normal !important;
    word-wrap: break-word !important;
}

/* Remove time display in month view */
.fc-daygrid-event .fc-event-time {
    display: none !important;
}

.fc-daygrid-event .fc-event-title-container {
    padding: 0 !important;
    margin: 0 !important;
    overflow: visible !important;
}

/* Day cell styling for better event visibility */
.fc-daygrid-day {
    min-height: 140px !important;
}

.fc-daygrid-day-frame {
    min-height: 140px !important;
}

.fc-daygrid-day-events {
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
}

.fc-daygrid-day-top {
    flex-shrink: 0 !important;
}

.fc-daygrid-day-number {
    color: #6b7280 !important;
    font-weight: 500 !important;
    padding: 2px 4px !important;
}

.fc-day-today .fc-daygrid-day-number {
    background: rgba(94, 173, 181, 0.2) !important;
    color: #5eadb5 !important;
    border-radius: 0 !important; /* Square design */
    font-weight: 700 !important;
}

/* Show more events link styling */
.fc-daygrid-more-link {
    color: #2563eb !important;
    background: rgba(59, 130, 246, 0.1) !important;
    border: 1px solid rgba(59, 130, 246, 0.2) !important;
    border-radius: 0 !important; /* Square design */
    font-size: 0.75rem !important;
    font-weight: 500 !important;
    padding: 1px 4px !important;
    margin: 1px !important;
}

.fc-daygrid-more-link:hover {
    background: rgba(59, 130, 246, 0.2) !important;
    color: #1d4ed8 !important;
}

/* Day names header light theme */
.fc-scrollgrid-section-header {
    background: #f9fafb !important;
}

.fc-scrollgrid-section-header td {
    background: #f9fafb !important;
    border-color: #e5e7eb !important;
}

.fc-col-header-cell {
    background: #f9fafb !important;
    border-color: #e5e7eb !important;
}

.fc-col-header-cell-cushion {
    color: #374151 !important;
    font-weight: 600 !important;
    padding: 8px 4px !important;
}

/* Calendar grid light theme - full width */
.fc-scrollgrid {
    border-color: #e5e7eb !important;
    background: #ffffff !important;
    width: 100% !important;
}

.fc-scrollgrid-section {
    border-color: #e5e7eb !important;
    background: #ffffff !important;
}

.fc-scrollgrid-section-liquid {
    background: #ffffff !important;
}

.fc-scrollgrid-section-body {
    background: #ffffff !important;
}

.fc-daygrid-body {
    background: #ffffff !important;
    width: 100% !important;
}

.fc-daygrid-day {
    background: #ffffff !important;
    border-color: #e5e7eb !important;
    padding: 2px !important;
}

.fc-daygrid-day-frame {
    background: #ffffff !important;
    padding: 1px !important;
}

.fc-daygrid-day-top {
    background: #ffffff !important;
}

.fc-daygrid-day-bg {
    background: #ffffff !important;
}

/* Light theme backgrounds */
.fc-view-harness,
.fc-view-harness-active {
    background: #ffffff !important;
}

.fc-daygrid {
    background: #ffffff !important;
}

.fc-scrollgrid-sync-table {
    background: #ffffff !important;
}

/* Force light backgrounds on all possible elements */
.fc table,
.fc tbody,
.fc tr,
.fc td,
.fc th {
    background: #ffffff !important;
    border-color: #e5e7eb !important;
}

.fc-theme-standard td,
.fc-theme-standard th {
    background: #ffffff !important;
    border-color: #e5e7eb !important;
}

/* Full width table */
.fc-daygrid-body table,
.fc-col-header table {
    width: 100% !important;
    table-layout: fixed !important;
}

.fc-col-header-cell {
    width: calc(100% / 7) !important;
}

.fc-daygrid-day {
    width: calc(100% / 7) !important;
}

/* Enhanced List View Styling with Mobile Support */
.fc-list-table {
    border: none !important;
    background: #ffffff !important;
}

.fc-list-event {
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    border: none !important;
    padding: 0.75rem 1rem !important;
    margin: 0.25rem 0 !important;
    border-radius: 0 !important; /* Square design */
    background: rgba(243, 244, 246, 0.5) !important;
    border-left: 4px solid transparent !important;
}

.fc-list-event:hover {
    background-color: rgba(59, 130, 246, 0.1) !important;
    transform: translateX(4px) !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
    border-left-color: #5eadb5 !important;
}

.fc-list-event:hover .fc-list-event-title a,
.fc-list-event:hover .fc-list-event-time {
    color: #2563eb !important;
}

.fc-list-event-title {
    padding: 0 !important;
}

.fc-list-event-title a {
    color: #1f2937 !important;
    text-decoration: none !important;
    font-weight: 600 !important;
    font-size: 0.95rem !important;
    line-height: 1.4 !important;
}

.fc-list-event-title a:hover {
    color: #2563eb !important;
}

.fc-list-event-time {
    color: #6b7280 !important;
    font-weight: 500 !important;
    font-size: 0.875rem !important;
    padding: 0 !important;
    white-space: nowrap !important;
}

.fc-list-event-dot {
    width: 10px !important;
    height: 10px !important;
    border-radius: 0 !important; /* Square design */
    margin-right: 0.75rem !important;
    flex-shrink: 0 !important;
}

.fc-list-day-cushion {
    background-color: #5eadb5 !important;
    color: #ffffff !important;
    font-weight: 600 !important;
    padding: 0.75rem 1rem !important;
    border-radius: 0 !important; /* Square design */
    margin: 1rem 0 0.5rem !important;
    font-size: 1rem !important;
}

/* Fix blue link color in date headings */
.fc-list-day-cushion a,
.fc-list-day-text,
.fc-list-day-text a,
.fc-list-day-side-text,
.fc-list-day-side-text a {
    color: #ffffff !important;
    text-decoration: none !important;
}
}

/* Mobile-specific list view enhancements */
.ahq-mobile-calendar .fc-list-event {
    padding: 1rem !important;
    margin: 0.5rem 0 !important;
    background: rgba(249, 250, 251, 0.8) !important;
}

.ahq-mobile-calendar .fc-list-event-title a {
    font-size: 1rem !important;
    font-weight: 600 !important;
}

.ahq-mobile-calendar .fc-list-event-time {
    font-size: 0.9rem !important;
    margin-top: 0.25rem !important;
}

.ahq-mobile-calendar .fc-list-day-cushion {
    font-size: 1.1rem !important;
    font-weight: 700 !important;
    padding: 1rem !important;
    text-align: center !important;
    background-color: #5eadb5 !important;
    color: white !important;
}

/* Remove default borders and dark theme adjustments */
.fc-list-day th,
.fc-list-event td {
    border: none !important;
    background: transparent !important;
}

.fc-list-day th {
    background: #ffffff !important;
}

.fc-list-empty {
    background: #ffffff !important;
    color: #6b7280 !important;
    padding: 2rem !important;
    text-align: center !important;
    font-size: 1rem !important;
}

.ahq-mobile-calendar .fc-list-empty {
    padding: 3rem 1rem !important;
    font-size: 1.1rem !important;
}

/* Mobile-first Responsive Adjustments */
@media (max-width: 767px) {
    /* Mobile-first approach */
    .ahq-fullcalendar-wrapper {
        margin: 1rem 0;
        padding: 0.75rem;
    }

    /* Enhanced mobile calendar styling */
    .ahq-fullcalendar {
        font-size: 0.85rem !important;
    }

    /* Mobile toolbar adjustments */
    .fc-toolbar {
        flex-direction: column !important;
        gap: 1rem !important;
        margin-bottom: 1rem !important;
    }

    .fc-toolbar-chunk {
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
        gap: 0.5rem !important;
    }

    .fc-toolbar-title {
        font-size: 1.25rem !important;
        text-align: center !important;
        order: 1 !important;
    }

    .fc-button {
        font-size: 0.8rem !important;
        padding: 0.5rem 0.75rem !important;
        margin: 0 0.125rem !important;
    }

    /* Mobile day cells */
    .fc-daygrid-day {
        min-height: 80px !important;
        font-size: 0.75rem !important;
    }

    .fc-daygrid-day-frame {
        min-height: 80px !important;
    }

    .fc-daygrid-day-number {
        font-size: 0.8rem !important;
        padding: 1px 2px !important;
    }

    /* Mobile events in month view */
    .fc-daygrid-event {
        font-size: 0.65rem !important;
        padding: 0px 1px !important;
        margin: 0 !important;
        line-height: 1 !important;
        min-height: 14px !important;
    }

    .fc-daygrid-event .fc-event-title {
        font-size: 0.65rem !important;
        line-height: 1 !important;
    }

    /* Mobile list view optimization */
    .fc-list-event {
        padding: 0.75rem 0.5rem !important;
        margin: 0.25rem 0 !important;
        border-left: 3px solid transparent !important;
    }

    .fc-list-event:hover {
        transform: none !important;
        border-left-color: #5eadb5 !important;
    }

    .fc-list-event-title a {
        font-size: 0.9rem !important;
        line-height: 1.3 !important;
    }

    .fc-list-event-time {
        font-size: 0.8rem !important;
        margin-top: 0.25rem !important;
        display: block !important;
    }

    .fc-list-day-cushion {
        font-size: 1rem !important;
        padding: 0.75rem 0.5rem !important;
        text-align: center !important;
        margin: 0.75rem 0 0.25rem !important;
    }

    /* Mobile modal adjustments */
    .ahq-modal-content {
        margin: 0.5rem;
        max-width: none;
        max-height: 90vh;
    }

    .ahq-modal-header,
    .ahq-modal-body,
    .ahq-modal-footer {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .ahq-modal-title {
        font-size: 1.1rem !important;
        margin-right: 0.5rem;
    }

    .ahq-modal-actions {
        flex-direction: column;
        gap: 0.5rem;
    }

    .ahq-event-meta-item {
        flex-direction: column;
        gap: 0.25rem;
    }

    .ahq-meta-label {
        min-width: auto;
        font-size: 0.875rem;
        font-weight: 700;
    }

    .ahq-meta-value {
        font-size: 0.9rem;
    }

    /* Hide unnecessary elements on mobile */
    .fc-daygrid-more-link {
        font-size: 0.7rem !important;
        padding: 0px 2px !important;
    }
}

/* Tablet adjustments */
@media (min-width: 768px) and (max-width: 1024px) {
    .ahq-fullcalendar-wrapper {
        padding: 1.25rem;
    }

    .fc-toolbar-title {
        font-size: 1.4rem !important;
    }

    .fc-daygrid-day {
        min-height: 120px !important;
    }

    .fc-daygrid-day-frame {
        min-height: 120px !important;
    }

    .fc-daygrid-event {
        font-size: 0.7rem !important;
    }
}

/* Desktop enhancements */
@media (min-width: 1025px) {
    .ahq-fullcalendar-wrapper {
        padding: 2rem;
    }

    .fc-toolbar {
        margin-bottom: 2rem !important;
    }

    .fc-daygrid-day {
        min-height: 160px !important;
    }

    .fc-daygrid-day-frame {
        min-height: 160px !important;
    }

    /* Desktop list view with larger spacing */
    .fc-list-event {
        padding: 1rem 1.5rem !important;
        margin: 0.5rem 0 !important;
    }

    .fc-list-event-title a {
        font-size: 1rem !important;
    }

    .fc-list-event-time {
        font-size: 0.9rem !important;
    }

    .fc-list-day-cushion {
        font-size: 1.1rem !important;
        padding: 1rem 1.5rem !important;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .ahq-modal-content {
        background: #1f2937;
        color: #f9fafb;
    }

    .ahq-modal-title {
        color: #f9fafb;
    }

    .ahq-meta-label {
        color: #d1d5db;
    }

    .ahq-meta-value {
        color: #f3f4f6;
    }

    .ahq-description-content {
        color: #d1d5db;
    }
}

/* Accessibility Enhancements */
.ahq-modal-content:focus {
    outline: 3px solid #3788d8;
    outline-offset: -3px;
}

.ahq-modal-close:focus,
.ahq-btn:focus {
    outline: 2px solid #3788d8;
    outline-offset: 2px;
}

.fc-button:focus {
    outline: 2px solid #3788d8 !important;
    outline-offset: 2px !important;
}

/* Improved keyboard navigation */
.fc-event:focus {
    outline: 2px solid #3788d8 !important;
    outline-offset: 1px !important;
    z-index: 10 !important;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .ahq-fullcalendar-wrapper {
        border: 2px solid #000;
    }

    .ahq-btn-primary {
        background: #000;
        border: 2px solid #000;
    }

    .ahq-btn-secondary {
        background: #fff;
        border: 2px solid #000;
        color: #000;
    }

    .fc-event {
        border: 2px solid #000 !important;
    }

    .fc-button {
        border: 2px solid #000 !important;
    }
}

/* Print styles */
@media print {
    .ahq-fullcalendar-wrapper {
        margin: 0;
        padding: 0;
        box-shadow: none;
        border: none;
    }

    .fc-toolbar {
        display: none !important;
    }

    .ahq-modal-overlay,
    .ahq-event-modal {
        display: none !important;
    }

    .fc-event {
        background: #fff !important;
        color: #000 !important;
        border: 1px solid #000 !important;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .ahq-loading-spinner {
        animation: none;
    }

    .ahq-modal-content {
        animation: none;
    }

    .fc-event:hover {
        transform: none;
        transition: none;
    }

    .fc-list-event:hover {
        transform: none;
        transition: none;
    }
}