/* ============================================
   Opleidingscentrum XP - Custom Styles
   Beyond Tailwind utilities
   ============================================ */

/* --- Smooth Transitions --- */
*,
*::before,
*::after {
    scroll-behavior: smooth;
}

/* --- Card Styles --- */
.xp-card {
    background: #fff;
    border-radius: 0.75rem;
    overflow: hidden;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
}

.xp-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.1), 0 4px 8px rgba(0, 0, 0, 0.06);
}

.xp-card-image {
    position: relative;
    overflow: hidden;
}

.xp-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.xp-card:hover .xp-card-image img {
    transform: scale(1.05);
}

.xp-card-badge {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.025em;
    backdrop-filter: blur(8px);
}

.xp-card-badge--available {
    background: rgba(16, 185, 129, 0.9);
    color: #fff;
}

.xp-card-badge--full {
    background: rgba(239, 68, 68, 0.9);
    color: #fff;
}

.xp-card-badge--limited {
    background: rgba(245, 158, 11, 0.9);
    color: #fff;
}

/* --- Filter Tags --- */
.xp-filter-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 1rem;
    border-radius: 9999px;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1.5px solid #e5e7eb;
    background: #fff;
    color: #6b7280;
    user-select: none;
}

.xp-filter-tag:hover {
    border-color: #F26622;
    color: #F26622;
    background: #fff7ed;
}

.xp-filter-tag.active {
    border-color: #F26622;
    background: #F26622;
    color: #fff;
}

.xp-filter-tag.active:hover {
    background: #d4551a;
    border-color: #d4551a;
}

/* --- Loading Animation --- */
.xp-loader {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
}

.xp-loader-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: #F26622;
    animation: xp-bounce 1.4s infinite ease-in-out both;
}

.xp-loader-dot:nth-child(1) { animation-delay: -0.32s; }
.xp-loader-dot:nth-child(2) { animation-delay: -0.16s; }
.xp-loader-dot:nth-child(3) { animation-delay: 0s; }

@keyframes xp-bounce {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Full-overlay loader */
.xp-loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(2px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.xp-loading-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* Spinner variant */
.xp-spinner {
    width: 2.5rem;
    height: 2.5rem;
    border: 3px solid #f3f4f6;
    border-top-color: #F26622;
    border-radius: 50%;
    animation: xp-spin 0.7s linear infinite;
}

@keyframes xp-spin {
    to { transform: rotate(360deg); }
}

/* --- Custom Scrollbar --- */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f9fafb;
}

::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Firefox */
html {
    scrollbar-width: thin;
    scrollbar-color: #d1d5db #f9fafb;
}

/* --- View Toggle --- */
.xp-view-toggle {
    display: inline-flex;
    border-radius: 0.5rem;
    overflow: hidden;
    border: 1.5px solid #e5e7eb;
    background: #fff;
}

.xp-view-toggle button {
    padding: 0.5rem 0.75rem;
    background: transparent;
    border: none;
    cursor: pointer;
    color: #9ca3af;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.xp-view-toggle button:hover {
    color: #F26622;
    background: #fff7ed;
}

.xp-view-toggle button.active {
    color: #fff;
    background: #F26622;
}

.xp-view-toggle button + button {
    border-left: 1px solid #e5e7eb;
}

/* --- Search Input --- */
.xp-search {
    position: relative;
}

.xp-search input {
    width: 100%;
    padding: 0.625rem 1rem 0.625rem 2.75rem;
    border: 1.5px solid #e5e7eb;
    border-radius: 0.75rem;
    font-size: 0.875rem;
    background: #fff;
    color: #1f2937;
    transition: all 0.2s ease;
    outline: none;
}

.xp-search input::placeholder {
    color: #9ca3af;
}

.xp-search input:focus {
    border-color: #F26622;
    box-shadow: 0 0 0 3px rgba(242, 102, 34, 0.1);
}

.xp-search-icon {
    position: absolute;
    left: 0.875rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    pointer-events: none;
}

/* --- Mobile Filter Panel --- */
.xp-mobile-filters {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: flex;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.xp-mobile-filters.open {
    pointer-events: auto;
    opacity: 1;
}

.xp-mobile-filters-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
}

.xp-mobile-filters-panel {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 85%;
    max-width: 24rem;
    background: #fff;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.xp-mobile-filters.open .xp-mobile-filters-panel {
    transform: translateX(0);
}

/* --- Calendar Day Cell --- */
.xp-cal-day {
    min-height: 5rem;
    padding: 0.375rem;
    border: 1px solid #f3f4f6;
    border-radius: 0.375rem;
    transition: background 0.15s ease;
}

.xp-cal-day:hover {
    background: #fef3ec;
}

.xp-cal-day.today {
    background: #fff7ed;
    border-color: #F26622;
}

.xp-cal-event {
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-size: 0.6875rem;
    font-weight: 500;
    margin-bottom: 0.125rem;
    cursor: pointer;
    transition: opacity 0.15s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    background: rgba(242, 102, 34, 0.12);
    color: #d4551a;
}

.xp-cal-event:hover {
    opacity: 0.8;
}

/* --- Pagination --- */
.xp-pagination {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.xp-pagination a,
.xp-pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.25rem;
    height: 2.25rem;
    padding: 0 0.5rem;
    border-radius: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
}

.xp-pagination a {
    color: #6b7280;
    border: 1px solid #e5e7eb;
    background: #fff;
}

.xp-pagination a:hover {
    color: #F26622;
    border-color: #F26622;
    background: #fff7ed;
}

.xp-pagination .active {
    color: #fff;
    background: #F26622;
    border-color: #F26622;
}

.xp-pagination .disabled {
    color: #d1d5db;
    border-color: #f3f4f6;
    background: #f9fafb;
    pointer-events: none;
}

/* --- Button Styles --- */
.xp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    text-decoration: none;
}

.xp-btn-primary {
    background: #F26622;
    color: #fff;
}

.xp-btn-primary:hover {
    background: #d4551a;
    box-shadow: 0 4px 12px rgba(242, 102, 34, 0.3);
}

.xp-btn-outline {
    background: transparent;
    color: #F26622;
    border: 1.5px solid #F26622;
}

.xp-btn-outline:hover {
    background: #F26622;
    color: #fff;
}

.xp-btn-ghost {
    background: transparent;
    color: #6b7280;
}

.xp-btn-ghost:hover {
    background: #f3f4f6;
    color: #374151;
}

/* --- Skeleton Loading --- */
.xp-skeleton {
    background: linear-gradient(90deg, #f3f4f6 25%, #e5e7eb 50%, #f3f4f6 75%);
    background-size: 200% 100%;
    animation: xp-shimmer 1.5s ease-in-out infinite;
    border-radius: 0.5rem;
}

@keyframes xp-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* --- Fade-in animation for cards --- */
.xp-fade-in {
    opacity: 0;
    transform: translateY(12px);
    animation: xp-fade-up 0.4s ease forwards;
}

@keyframes xp-fade-up {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Stagger children */
.xp-stagger > *:nth-child(1) { animation-delay: 0.05s; }
.xp-stagger > *:nth-child(2) { animation-delay: 0.1s; }
.xp-stagger > *:nth-child(3) { animation-delay: 0.15s; }
.xp-stagger > *:nth-child(4) { animation-delay: 0.2s; }
.xp-stagger > *:nth-child(5) { animation-delay: 0.25s; }
.xp-stagger > *:nth-child(6) { animation-delay: 0.3s; }
.xp-stagger > *:nth-child(7) { animation-delay: 0.35s; }
.xp-stagger > *:nth-child(8) { animation-delay: 0.4s; }
.xp-stagger > *:nth-child(9) { animation-delay: 0.45s; }
.xp-stagger > *:nth-child(10) { animation-delay: 0.5s; }
.xp-stagger > *:nth-child(11) { animation-delay: 0.55s; }
.xp-stagger > *:nth-child(12) { animation-delay: 0.6s; }

/* --- Focus styles for accessibility --- */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
    outline: 2px solid #F26622;
    outline-offset: 2px;
}

/* --- Tooltip --- */
.xp-tooltip {
    position: relative;
}

.xp-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 0.5rem);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    padding: 0.375rem 0.75rem;
    background: #1f2937;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 0.375rem;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: all 0.2s ease;
    z-index: 50;
}

.xp-tooltip:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* --- Print styles --- */
@media print {
    nav, footer, .xp-filter-tag, .xp-view-toggle, .xp-search {
        display: none !important;
    }

    .xp-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #e5e7eb;
    }

    main {
        min-height: auto !important;
    }
}

/* --- Mobile Adjustments --- */
@media (max-width: 640px) {
    .xp-card {
        border-radius: 0.5rem;
    }

    .xp-pagination a,
    .xp-pagination span {
        min-width: 2rem;
        height: 2rem;
        font-size: 0.75rem;
    }

    .xp-filter-tag {
        padding: 0.3rem 0.75rem;
        font-size: 0.75rem;
    }
}
