/* ========================================
   RDP - Styles Responsive Globaux
======================================== */

/* ========== Tables Responsive ========== */
.responsive-table {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
    .responsive-table table {
        min-width: 600px;
    }
    
    /* Stack table on very small screens */
    .table-stack {
        min-width: unset !important;
    }
    
    .table-stack thead {
        display: none;
    }
    
    .table-stack tbody tr {
        display: block;
        margin-bottom: 1rem;
        border: 1px solid #e5e7eb;
        border-radius: 0.5rem;
        padding: 1rem;
    }
    
    .table-stack tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.5rem 0;
        border: none;
    }
    
    .table-stack tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #374151;
        margin-right: 1rem;
    }
}

/* ========== Cards Grid ========== */
.cards-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(1, 1fr);
}

@media (min-width: 640px) {
    .cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .cards-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1280px) {
    .cards-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ========== Form Responsive ========== */
@media (max-width: 640px) {
    .form-grid {
        grid-template-columns: 1fr !important;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions > * {
        width: 100%;
        justify-content: center;
    }
}

/* ========== Modal Responsive ========== */
.modal-content {
    width: 95%;
    max-width: 500px;
    margin: 1rem auto;
    max-height: calc(100vh - 2rem);
    overflow-y: auto;
}

@media (min-width: 768px) {
    .modal-content {
        width: 90%;
        max-width: 600px;
        margin: 2rem auto;
    }
}

/* ========== Stats Cards ========== */
.stat-card {
    padding: 1rem;
}

@media (min-width: 640px) {
    .stat-card {
        padding: 1.5rem;
    }
}

@media (min-width: 1024px) {
    .stat-card {
        padding: 2rem;
    }
}

/* ========== Buttons Responsive ========== */
@media (max-width: 640px) {
    .btn-group {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-group > * {
        width: 100%;
        justify-content: center;
    }
    
    .btn-icon-only span {
        display: none;
    }
}

/* ========== Typography Responsive ========== */
@media (max-width: 640px) {
    h1, .text-4xl {
        font-size: 1.75rem !important;
    }
    
    h2, .text-3xl {
        font-size: 1.5rem !important;
    }
    
    h3, .text-2xl {
        font-size: 1.25rem !important;
    }
}

/* ========== Navigation Tabs ========== */
.nav-tabs {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
    position: relative;
}

.nav-tabs::-webkit-scrollbar {
    height: 6px;
    display: block;
}

.nav-tabs::-webkit-scrollbar-track {
    background: transparent;
}

.nav-tabs::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 3px;
}

.nav-tabs::-webkit-scrollbar-thumb:hover {
    background-color: #94a3b8;
}

/* Masquer la scrollbar sur mobile pour un look plus propre */
@media (max-width: 768px) {
    .nav-tabs {
        scrollbar-width: none;
    }
    
    .nav-tabs::-webkit-scrollbar {
        display: none;
    }
}

@media (max-width: 640px) {
    .nav-tabs a {
        white-space: nowrap;
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
}

/* ========== Admin Dashboard ========== */
@media (max-width: 1023px) {
    .dashboard-grid {
        grid-template-columns: 1fr !important;
    }
    
    .dashboard-stats {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media (max-width: 640px) {
    .dashboard-stats {
        grid-template-columns: 1fr !important;
    }
}

/* ========== Padding & Margin Responsive ========== */
@media (max-width: 640px) {
    .p-6 {
        padding: 1rem !important;
    }
    
    .px-6 {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
    
    .py-6 {
        padding-top: 1rem !important;
        padding-bottom: 1rem !important;
    }
}

/* ========== Hide/Show Elements ========== */
.hide-mobile {
    display: none !important;
}

@media (min-width: 640px) {
    .hide-mobile {
        display: block !important;
    }
    
    .show-mobile {
        display: none !important;
    }
}

/* ========== Touch Friendly ========== */
@media (max-width: 768px) {
    button,
    a.btn,
    input[type="submit"],
    input[type="button"] {
        min-height: 44px;
        min-width: 44px;
    }
    
    /* Larger tap targets for links in lists */
    nav a,
    .menu-item {
        padding: 0.75rem 1rem;
    }
}

/* ========== Images Responsive ========== */
.img-responsive {
    max-width: 100%;
    height: auto;
}

.img-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ========== Aspect Ratio Boxes ========== */
.aspect-video {
    aspect-ratio: 16 / 9;
}

.aspect-square {
    aspect-ratio: 1 / 1;
}

/* ========== Safe Area (iPhone notch) ========== */
@supports (padding: max(0px)) {
    body {
        padding-left: max(0px, env(safe-area-inset-left));
        padding-right: max(0px, env(safe-area-inset-right));
    }
    
    .safe-bottom {
        padding-bottom: max(1rem, env(safe-area-inset-bottom));
    }
}

/* ========== Print Styles ========== */
@media print {
    nav,
    aside,
    .no-print,
    button,
    .btn {
        display: none !important;
    }
    
    body {
        font-size: 12pt;
        background: white !important;
    }
    
    .container {
        width: 100% !important;
        max-width: none !important;
    }
}

