/**
 * SwissProfs - Responsive CSS
 * Media queries et ajustements responsive uniquement
 * NE CONTIENT PAS de styles de base - seulement des overrides
 *
 * BREAKPOINTS:
 * - xs: < 480px (très petit mobile)
 * - sm: 480px - 639px (mobile)
 * - md: 640px - 767px (grand mobile / petit tablet)
 * - lg: 768px - 1023px (tablet)
 * - xl: 1024px - 1279px (petit desktop)
 * - 2xl: >= 1280px (desktop)
 *
 * @package SwissProfs
 */

/* ==========================================================================
   TRÈS PETIT MOBILE (< 480px)
   ========================================================================== */

@media (max-width: 479px) {
    /* Typography */
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    
    /* Container */
    .sp-container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    /* Buttons */
    .sp-btn {
        padding: 0.625rem 1rem;
        font-size: 0.875rem;
    }
    
    .sp-btn-block-xs {
        display: flex;
        width: 100%;
    }
    
    /* Cards */
    .sp-card,
    .sp-form-card {
        padding: 1rem;
        border-radius: 0.75rem;
    }
    
    .sp-card-header,
    .sp-card-footer {
        padding: 0.75rem 1rem;
    }
    
    .sp-card-body {
        padding: 1rem;
    }
    
    /* Modal */
    .sp-modal-content {
        border-radius: 1rem 1rem 0 0;
        max-height: 90vh;
    }
    
    .sp-modal-header,
    .sp-modal-body,
    .sp-modal-footer {
        padding: 1rem;
    }
    
    /* Forms */
    .sp-form-actions {
        flex-direction: column;
    }
    
    .sp-form-actions .sp-btn {
        width: 100%;
    }
}

/* ==========================================================================
   MOBILE (480px - 639px)
   ========================================================================== */

@media (min-width: 480px) and (max-width: 639px) {
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
}

/* ==========================================================================
   TABLET PORTRAIT (640px - 767px)
   ========================================================================== */

@media (min-width: 640px) and (max-width: 767px) {
    /* Hero */
    .sp-hero h1 {
        font-size: 2.25rem;
    }
    
    /* Search Bar horizontal */
    .sp-search-bar {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .sp-search-bar .sp-search-field {
        flex: 1;
        min-width: 200px;
    }
}

/* ==========================================================================
   TABLET LANDSCAPE (768px - 1023px)
   ========================================================================== */

@media (min-width: 768px) and (max-width: 1023px) {
    /* Hero */
    .sp-hero h1 {
        font-size: 2.5rem;
    }
    
    /* Dashboard */
    .sp-dashboard-main {
        padding: 1.5rem;
    }
    
    /* Profile */
    .sp-profile-layout {
        flex-direction: column;
    }
    
    .sp-profile-sidebar {
        width: 100%;
        position: static;
    }
}

/* ==========================================================================
   DESKTOP (>= 1024px)
   ========================================================================== */

@media (min-width: 1024px) {
    /* Hero */
    .sp-hero {
        text-align: left;
    }
    
    .sp-hero h1 {
        font-size: 3rem;
    }
    
    /* Hero Content Split */
    .sp-hero-content {
        flex-direction: row;
        align-items: center;
    }
    
    .sp-hero-text {
        flex: 1;
        padding-right: 3rem;
    }
    
    .sp-hero-image {
        flex: 1;
    }
    
    /* Navigation Desktop */
    .sp-nav-desktop {
        display: flex;
    }
    
    .sp-mobile-toggle {
        display: none;
    }
    
    /* Dashboard Sidebar */
    .sp-dashboard-sidebar {
        transform: translateX(0);
    }
    
    .sp-dashboard-main {
        margin-left: 280px;
        padding: 2rem;
    }
    
    .sp-sidebar-toggle {
        display: none;
    }
    
    /* Profile Two Column */
    .sp-profile-layout {
        flex-direction: row;
    }
    
    .sp-profile-main {
        flex: 1;
    }
    
    .sp-profile-sidebar {
        width: 360px;
        position: sticky;
        top: 100px;
        align-self: flex-start;
    }
    
    /* Booking Layout */
    .sp-booking-layout {
        flex-direction: row;
    }
    
    .sp-booking-form {
        flex: 1;
    }
    
    .sp-booking-summary-sticky {
        width: 350px;
        position: sticky;
        top: 100px;
        align-self: flex-start;
    }
}

/* ==========================================================================
   LARGE DESKTOP (>= 1280px)
   ========================================================================== */

@media (min-width: 1280px) {
    .sp-hero h1 {
        font-size: 3.5rem;
    }
    
    /* Wider Profile Sidebar */
    .sp-profile-sidebar {
        width: 400px;
    }
    
    /* Stats */
    .sp-stat-item .sp-stat-value {
        font-size: 3.5rem;
    }
}

/* ==========================================================================
   DASHBOARD RESPONSIVE
   ========================================================================== */

/* Mobile Dashboard */
@media (max-width: 1023px) {
    .sp-dashboard {
        flex-direction: column;
    }
    
    .sp-dashboard-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 280px;
        background: #1F2937;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 200;
    }
    
    .sp-dashboard-sidebar.is-open {
        transform: translateX(0);
    }
    
    .sp-dashboard-main {
        margin-left: 0;
        width: 100%;
    }
    
    .sp-sidebar-toggle {
        display: flex;
    }
    
    /* Dashboard Header */
    .sp-dashboard-header {
        flex-wrap: wrap;
        gap: 1rem;
    }
    
    .sp-dashboard-header h1 {
        font-size: 1.5rem;
        width: 100%;
        order: 2;
    }
}

/* ==========================================================================
   TABLES RESPONSIVE
   ========================================================================== */

@media (max-width: 768px) {
    /* Stack tables on mobile */
    .sp-table-stack {
        display: block;
    }
    
    .sp-table-stack thead {
        display: none;
    }
    
    .sp-table-stack tbody,
    .sp-table-stack tr,
    .sp-table-stack td {
        display: block;
    }
    
    .sp-table-stack tr {
        margin-bottom: 1rem;
        padding: 1rem;
        background: #fff;
        border-radius: 0.75rem;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }
    
    .sp-table-stack td {
        padding: 0.5rem 0;
        border: none;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .sp-table-stack td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 0.75rem;
        color: #6B7280;
        text-transform: uppercase;
    }
}

/* ==========================================================================
   PROFESSOR CARDS RESPONSIVE
   ========================================================================== */

@media (min-width: 768px) {
    .sp-professor-card-horizontal {
        display: flex;
        flex-direction: row;
    }
    
    .sp-professor-card-horizontal .sp-professor-photo {
        width: 200px;
        aspect-ratio: auto;
        flex-shrink: 0;
    }
    
    .sp-professor-card-horizontal .sp-professor-info {
        flex: 1;
    }
}

/* ==========================================================================
   FOOTER RESPONSIVE
   ========================================================================== */

@media (max-width: 767px) {
    .sp-footer-grid {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .sp-footer-brand {
        max-width: 100%;
    }
    
    .sp-footer-social {
        justify-content: center;
    }
    
    .sp-footer-bottom {
        flex-direction: column;
        text-align: center;
    }
    
    .sp-footer-legal {
        justify-content: center;
    }
}

/* ==========================================================================
   STATS SECTION RESPONSIVE
   ========================================================================== */

@media (max-width: 639px) {
    .sp-stats-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .sp-stat-item .sp-stat-value {
        font-size: 2.5rem;
    }
}

@media (min-width: 640px) and (max-width: 1023px) {
    .sp-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ==========================================================================
   SEARCH BAR RESPONSIVE
   ========================================================================== */

@media (max-width: 767px) {
    .sp-search-bar {
        flex-direction: column;
        padding: 1rem;
        gap: 0.75rem;
    }
    
    .sp-search-bar .sp-search-field {
        width: 100%;
    }
    
    .sp-search-bar .sp-btn {
        width: 100%;
    }
}

@media (min-width: 768px) {
    .sp-search-bar {
        flex-direction: row;
        padding: 0.5rem;
        gap: 0;
    }
    
    .sp-search-bar .sp-search-field {
        flex: 1;
    }
    
    .sp-search-bar .sp-search-field input,
    .sp-search-bar .sp-search-field select {
        border: none;
        border-right: 1px solid #E5E7EB;
        border-radius: 0;
    }
    
    .sp-search-bar .sp-search-field:last-of-type input,
    .sp-search-bar .sp-search-field:last-of-type select {
        border-right: none;
    }
}

/* ==========================================================================
   PAGINATION RESPONSIVE
   ========================================================================== */

@media (max-width: 479px) {
    .sp-pagination {
        gap: 0.125rem;
    }
    
    .sp-pagination a,
    .sp-pagination span {
        min-width: 2rem;
        height: 2rem;
        padding: 0 0.5rem;
        font-size: 0.875rem;
    }
    
    /* Hide some page numbers on mobile */
    .sp-pagination .page-numbers:not(.prev):not(.next):not(.current):not(:first-child):not(:last-child) {
        display: none;
    }
    
    .sp-pagination .dots {
        display: inline-flex;
    }
}

/* ==========================================================================
   MODAL RESPONSIVE
   ========================================================================== */

@media (max-width: 479px) {
    .sp-modal {
        padding: 0;
        align-items: flex-end;
    }
    
    .sp-modal-content {
        border-radius: 1rem 1rem 0 0;
        max-height: 90vh;
    }
}

@media (min-width: 480px) {
    .sp-modal {
        padding: 1rem;
        align-items: center;
    }
    
    .sp-modal-content {
        border-radius: 1rem;
        max-height: calc(100vh - 2rem);
    }
}

/* ==========================================================================
   FORM WIZARD RESPONSIVE
   ========================================================================== */

@media (max-width: 639px) {
    .sp-form-steps {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
    }
    
    .sp-form-step {
        padding: 1rem 0;
        border-bottom: 1px solid #E5E7EB;
    }
    
    .sp-form-step:last-child {
        border-bottom: none;
    }
    
    .sp-form-step:not(:last-child)::after {
        display: none;
    }
}

/* ==========================================================================
   AUTH PAGES RESPONSIVE
   ========================================================================== */

@media (max-width: 1023px) {
    .sp-auth-sidebar {
        display: none;
    }
    
    .sp-auth-main {
        width: 100%;
    }
    
    .sp-auth-logo {
        display: inline-block;
    }
}

@media (max-width: 479px) {
    .sp-auth-main {
        padding: 1rem;
    }
    
    .sp-auth-form {
        padding: 1.5rem;
    }
    
    .sp-auth-header h1 {
        font-size: 1.5rem;
    }
    
    .sp-role-cards {
        grid-template-columns: 1fr;
    }
    
    .sp-otp-inputs {
        gap: 0.5rem;
    }
    
    .sp-otp-input {
        width: 2.5rem;
        height: 3rem;
        font-size: 1.125rem;
    }
}

/* ==========================================================================
   PAYMENT PAGE RESPONSIVE
   ========================================================================== */

@media (max-width: 899px) {
    .sp-payment-container {
        grid-template-columns: 1fr;
    }
    
    .sp-payment-sidebar {
        order: -1;
    }
}

/* ==========================================================================
   BOOKING LAYOUT RESPONSIVE
   ========================================================================== */

@media (max-width: 1023px) {
    .sp-booking-layout {
        flex-direction: column;
        gap: 1.5rem;
    }
    
    .sp-booking-form {
        width: 100%;
    }
    
    .sp-booking-summary-sticky {
        width: 100%;
        position: static;
    }
}

/* ==========================================================================
   UTILITY RESPONSIVE OVERRIDES
   ========================================================================== */

/* Text alignment responsive */
@media (max-width: 767px) {
    .sp-text-center-mobile {
        text-align: center;
    }
    
    .sp-text-left-mobile {
        text-align: left;
    }
}

/* Flex direction responsive */
@media (max-width: 767px) {
    .sp-flex-column-mobile {
        flex-direction: column;
    }
    
    .sp-flex-row-mobile {
        flex-direction: row;
    }
}

/* Gap responsive */
@media (max-width: 767px) {
    .sp-gap-sm-mobile {
        gap: 0.5rem;
    }
    
    .sp-gap-md-mobile {
        gap: 1rem;
    }
}

/* Spacing responsive */
.sp-mb-responsive {
    margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
    .sp-mb-responsive {
        margin-bottom: 2rem;
    }
}

@media (min-width: 1024px) {
    .sp-mb-responsive {
        margin-bottom: 2.5rem;
    }
}

/* ==========================================================================
   TOUCH DEVICE OPTIMIZATIONS
   ========================================================================== */

@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    .sp-btn {
        min-height: 48px;
    }
    
    .sp-form-control {
        min-height: 48px;
    }
    
    /* Disable hover effects that don't work on touch */
    .sp-professor-card:hover {
        transform: none;
    }
    
    .sp-dropdown:hover .sp-dropdown-menu {
        opacity: 0;
        visibility: hidden;
    }
    
    .sp-dropdown.is-open .sp-dropdown-menu {
        opacity: 1;
        visibility: visible;
    }
}

/* ==========================================================================
   REDUCED MOTION
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .sp-spinner {
        animation: none;
        border: 3px solid #E63946;
    }
}

/* ==========================================================================
   HIGH CONTRAST MODE
   ========================================================================== */

@media (prefers-contrast: high) {
    .sp-btn {
        border-width: 3px;
    }
    
    .sp-form-control {
        border-width: 3px;
    }
    
    .sp-card {
        border: 2px solid #000;
    }
}

/* ==========================================================================
   DARK MODE PREPARATION (pour future implémentation)
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    /* Préparé pour une future implémentation du dark mode */
    /* Les variables CSS dans main.css seront overridées ici */
}
