/* ========================================
   LOCALSHOP - RESPONSIVE DESIGN PROFESSIONNEL
   Media queries et adaptations mobiles
   ======================================== */

/* ========================================
   BREAKPOINTS PROFESSIONNELS
   ======================================== */
/* 
  Mobile: 320px - 767px
  Tablet: 768px - 1023px
  Desktop: 1024px+
  Large Desktop: 1440px+
*/

/* ========================================
   BASE MOBILE-FIRST
   ======================================== */
/* Styles de base déjà optimisés pour mobile dans style.css */

/* ========================================
   NAVIGATION RESPONSIVE
   ======================================== */
@media (max-width: 768px) {
  .nav-container {
    padding: 0 var(--spacing-4);
  }
  
  .mobile-menu-toggle {
    display: flex;
  }
  
  .nav-links {
    position: fixed;
    top: 70px;
    left: -100%;
    width: 100%;
    height: calc(100vh - 70px);
    background: var(--white);
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    gap: var(--spacing-4);
    padding: var(--spacing-8) var(--spacing-4);
    transition: left 0.3s ease;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
  }
  
  .nav-links .btn-admin {
    background: var(--primary-color);
    color: var(--white) !important;
    border: 1px solid var(--primary-color);
  }
  
  .nav-links .btn-admin:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
  }
  
  .nav-links.active {
    left: 0;
  }
  
  .nav-links a {
    width: 100%;
    text-align: center;
    padding: var(--spacing-4);
    border-radius: var(--border-radius-lg);
    font-size: var(--font-size-lg);
    border: 1px solid var(--border-color);
    margin-bottom: var(--spacing-2);
  }
  
  .logo h1 {
    font-size: var(--font-size-xl);
  }
  
  .logo span {
    font-size: var(--font-size-xs);
  }
}

@media (max-width: 480px) {
  .logo span {
    display: none;
  }
  
  .nav-container {
    padding: 0 var(--spacing-3);
  }
  
  .logo h1 {
    font-size: var(--font-size-lg);
  }
  
  .hero-section {
    padding: 90px 0 50px;
  }
  
  .hero-content h1 {
    font-size: var(--font-size-2xl);
  }
  
  .cities-grid {
    grid-template-columns: 1fr;
    gap: var(--spacing-3);
  }
  
  /* ========================================
     SHOP PAGE RESPONSIVE
     ======================================== */
  .shop-header {
    padding: var(--spacing-4) 0;
  }

  .shop-header h1 {
    font-size: var(--font-size-xl);
    margin-bottom: var(--spacing-2);
  }

  .shop-header p {
    font-size: var(--font-size-sm);
    margin-bottom: var(--spacing-3);
  }
  
  .search-bar {
    flex-direction: row;
    gap: var(--spacing-2);
    margin-top: var(--spacing-3);
  }
  
  .search-bar input {
    flex: 1;
    margin-bottom: 0;
  }
  
  .filters-section {
    padding: var(--spacing-3) 0;
  }
  
  .filters-container {
    flex-direction: column;
    gap: var(--spacing-3);
  }
  
  .mobile-filters-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-3);
    background: var(--primary-color);
    color: var(--white);
    border-radius: var(--border-radius);
    cursor: pointer;
    margin-bottom: var(--spacing-3);
    font-weight: var(--font-weight-medium);
  }
  
  .toggle-icon {
    transition: transform 0.3s ease;
  }
  
  .mobile-filters-toggle.active .toggle-icon {
    transform: rotate(180deg);
  }
  
  .filters-container {
    display: none;
  }
  
  .filters-container.show {
    display: flex;
  }
  
  .filters-left {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-2);
    width: 100%;
  }
  
  .filter-group {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }
  
  .filter-group label {
    margin-bottom: var(--spacing-1);
    font-weight: var(--font-weight-medium);
    font-size: var(--font-size-xs);
  }
  
  .filter-select,
  .price-input {
    width: 100%;
    margin-bottom: 0;
    padding: var(--spacing-2);
    font-size: var(--font-size-sm);
  }
  
  .price-filter {
    grid-column: span 2;
    flex-direction: row;
    align-items: center;
    gap: var(--spacing-2);
  }
  
  .price-filter input {
    flex: 1;
    margin-bottom: 0;
  }
  
  .price-filter span {
    display: inline;
    font-size: var(--font-size-sm);
  }
  
  .price-filter button {
    padding: var(--spacing-2) var(--spacing-3);
    font-size: var(--font-size-xs);
    white-space: nowrap;
  }
  
  .view-toggle {
    grid-column: span 2;
    justify-content: center;
    margin-top: var(--spacing-2);
  }
  
  .results-info {
    font-size: var(--font-size-xs);
    text-align: center;
  }
  
  .products-section {
    padding: var(--spacing-4) 0;
  }
  
  .products-grid {
    grid-template-columns: 1fr;
    gap: var(--spacing-4);
    margin-top: var(--spacing-4);
  }
  
  .product-card {
    max-width: 100%;
    position: relative;
    z-index: 1;
  }
  
  .product-image {
    height: 200px;
  }
  
  .product-actions {
    flex-direction: column;
    gap: var(--spacing-2);
  }
  
  .product-actions button {
    width: 100% !important;
    margin-top: 0 !important;
  }
  
  .pagination {
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--spacing-2);
  }
  
  .pagination a,
  .pagination span {
    min-width: 40px;
    text-align: center;
  }
  
  .cart-float {
    bottom: 20px;
    right: 20px;
    padding: 12px 16px;
    font-size: var(--font-size-sm);
  }
  
  .city-card {
    padding: var(--spacing-4);
  }
  
  .city-selector h3 {
    font-size: var(--font-size-lg);
  }
}

/* ========================================
   TABLETTE RESPONSIVE (768px+)
   ======================================== */
@media (min-width: 768px) {
  .nav-toggle {
    display: none;
  }
  
  .mobile-filters-toggle {
    display: none;
  }
  
  .filters-container {
    display: flex !important;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  
  .filters-left {
    display: flex;
    flex-direction: row;
    gap: var(--spacing-4);
    width: auto;
  }
  
  .filter-group {
    flex-direction: row;
    align-items: center;
    width: auto;
  }
  
  .filter-group label {
    margin-bottom: 0;
    margin-right: var(--spacing-2);
  }
  
  .price-filter {
    flex-direction: row;
    align-items: center;
  }
  
  .price-filter input {
    width: 80px;
    margin-bottom: 0;
    margin-right: var(--spacing-2);
  }
  
  .price-filter span {
    display: inline;
    margin: 0 var(--spacing-1);
  }
  
  .products-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .search-bar {
    flex-direction: row;
    align-items: center;
  }
  
  .search-bar input {
    flex: 1;
    margin-bottom: 0;
    margin-right: var(--spacing-2);
  }
}

/* ========================================
   DESKTOP RESPONSIVE (1024px+)
   ======================================== */
@media (min-width: 1024px) {
  .products-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .filter-group {
    min-width: auto;
  }
  
  .price-filter input {
    width: 100px;
  }
}

/* ========================================
   LARGE DESKTOP (1440px+)
   ======================================== */
@media (min-width: 1440px) {
  .products-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  
  .container {
    max-width: 1400px;
  }
}

/* ========================================
   CONTENEURS RESPONSIVE
   ======================================== */
@media (max-width: 640px) {
  .container {
    padding: 0 var(--spacing-3);
  }
  
  .hero-section {
    padding: 100px 0 60px;
  }
  
  .hero-content {
    padding: 0 var(--spacing-4);
  }
  
  .hero-content h1 {
    font-size: var(--font-size-3xl);
  }
  
  .hero-content p {
    font-size: var(--font-size-base);
  }
  
  .cities-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-4);
  }
  
  .city-selector h3 {
    font-size: var(--font-size-xl);
  }
}

@media (min-width: 641px) and (max-width: 1023px) {
  .container {
    max-width: 768px;
  }
}

@media (min-width: 1024px) {
  .container {
    max-width: 1200px;
  }
}

@media (min-width: 1440px) {
  .container {
    max-width: 1400px;
  }
}

/* ========================================
   GRILLE RESPONSIVE
   ======================================== */
@media (max-width: 767px) {
  .row {
    margin: 0 calc(var(--spacing-2) * -1);
  }
  
  .col {
    padding: 0 var(--spacing-2);
  }
  
  .col-1, .col-2, .col-3, .col-4, .col-5, .col-6,
  .col-7, .col-8, .col-9, .col-10, .col-11, .col-12 {
    flex: 0 0 100%;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .col-md-1 { flex: 0 0 8.333333%; }
  .col-md-2 { flex: 0 0 16.666667%; }
  .col-md-3 { flex: 0 0 25%; }
  .col-md-4 { flex: 0 0 33.333333%; }
  .col-md-5 { flex: 0 0 41.666667%; }
  .col-md-6 { flex: 0 0 50%; }
  .col-md-7 { flex: 0 0 58.333333%; }
  .col-md-8 { flex: 0 0 66.666667%; }
  .col-md-9 { flex: 0 0 75%; }
  .col-md-10 { flex: 0 0 83.333333%; }
  .col-md-11 { flex: 0 0 91.666667%; }
  .col-md-12 { flex: 0 0 100%; }
}

/* ========================================
   TYPOGRAPHIE RESPONSIVE
   ======================================== */
@media (max-width: 767px) {
  h1 {
    font-size: var(--font-size-3xl);
  }
  
  h2 {
    font-size: var(--font-size-2xl);
  }
  
  h3 {
    font-size: var(--font-size-xl);
  }
  
  h4 {
    font-size: var(--font-size-lg);
  }
  
  .text-sm-center {
    text-align: center;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  h1 {
    font-size: var(--font-size-4xl);
  }
}

/* ========================================
   BOUTONS RESPONSIVE
   ======================================== */
@media (max-width: 767px) {
  .btn {
    width: 100%;
    justify-content: center;
    padding: var(--spacing-4) var(--spacing-6);
  }
  
  .btn-sm {
    width: auto;
    padding: var(--spacing-3) var(--spacing-4);
  }
  
  .btn-group {
    flex-direction: column;
    gap: var(--spacing-3);
  }
  
  .btn-group .btn {
    margin: 0;
  }
}

/* ========================================
   FORMULAIRES RESPONSIVE
   ======================================== */
@media (max-width: 767px) {
  .form-group {
    margin-bottom: var(--spacing-4);
  }
  
  .form-control {
    font-size: 16px; /* Évite le zoom sur iOS */
  }
  
  .form-row {
    flex-direction: column;
  }
  
  .form-row .form-group {
    margin-right: 0;
    margin-bottom: var(--spacing-4);
  }
}

@media (min-width: 768px) {
  .form-row {
    display: flex;
    gap: var(--spacing-4);
  }
  
  .form-row .form-group {
    flex: 1;
    margin-bottom: var(--spacing-5);
  }
}

/* ========================================
   CARTES RESPONSIVE
   ======================================== */
@media (max-width: 767px) {
  .card {
    margin-bottom: var(--spacing-4);
  }
  
  .card-header,
  .card-body,
  .card-footer {
    padding: var(--spacing-4);
  }
  
  .cards-grid {
    grid-template-columns: 1fr;
    gap: var(--spacing-4);
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .cards-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-5);
  }
}

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

/* ========================================
   PRODUITS RESPONSIVE
   ======================================== */
@media (max-width: 767px) {
  .products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-3);
  }
  
  .product-card {
    border-radius: var(--border-radius);
  }
  
  .product-image {
    height: 150px;
  }
  
  .product-info {
    padding: var(--spacing-3);
  }
  
  .product-title {
    font-size: var(--font-size-base);
    line-height: var(--line-height-tight);
  }
  
  .product-price {
    font-size: var(--font-size-lg);
  }
  
  .product-actions {
    flex-direction: column;
    gap: var(--spacing-2);
  }
  
  .product-actions .btn {
    font-size: var(--font-size-sm);
    padding: var(--spacing-2) var(--spacing-3);
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .products-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--spacing-4);
  }
  
  .product-image {
    height: 180px;
  }
}

@media (min-width: 1024px) {
  .products-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: var(--spacing-5);
  }
  
  .product-image {
    height: 200px;
  }
}

@media (min-width: 1440px) {
  .products-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

/* ========================================
   TABLEAUX RESPONSIVE
   ======================================== */
@media (max-width: 767px) {
  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .table {
    min-width: 600px;
    font-size: var(--font-size-sm);
  }
  
  .table th,
  .table td {
    padding: var(--spacing-2) var(--spacing-3);
    white-space: nowrap;
  }
  
  /* Table cards pour mobile */
  .table-cards {
    display: block;
  }
  
  .table-cards .table {
    display: none;
  }
  
  .table-card {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin-bottom: var(--spacing-3);
    padding: var(--spacing-4);
  }
  
  .table-card-header {
    font-weight: var(--font-weight-semibold);
    color: var(--primary-color);
    margin-bottom: var(--spacing-2);
  }
  
  .table-card-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-1) 0;
    border-bottom: 1px solid var(--gray-200);
  }
  
  .table-card-row:last-child {
    border-bottom: none;
  }
  
  .table-card-label {
    font-weight: var(--font-weight-medium);
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
  }
  
  .table-card-value {
    color: var(--text-primary);
    text-align: right;
  }
}

/* ========================================
   MODALES RESPONSIVE
   ======================================== */
@media (max-width: 767px) {
  .modal {
    padding: var(--spacing-4);
  }
  
  .modal-content {
    width: 100%;
    max-width: none;
    margin: 0;
    border-radius: var(--border-radius-lg);
  }
  
  .modal-header,
  .modal-body,
  .modal-footer {
    padding: var(--spacing-4);
  }
  
  .modal-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--spacing-2);
  }
  
  .modal-close {
    position: absolute;
    top: var(--spacing-4);
    right: var(--spacing-4);
  }
}

/* ========================================
   DASHBOARD RESPONSIVE
   ======================================== */
/* Bouton toggle sidebar mobile */
.sidebar-toggle {
  display: none;
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  background: var(--primary-color);
  color: var(--white);
  border: none;
  border-radius: 50%;
  width: 56px;
  height: 56px;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: all 0.3s ease;
}

.sidebar-toggle:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.sidebar-toggle:active {
  transform: scale(0.95);
}

@media (max-width: 1023px) {
  .dashboard-container {
    flex-direction: column;
    padding-top: 70px;
  }
  
  .dashboard-sidebar {
    position: fixed;
    top: 70px;
    left: 0;
    width: 280px;
    height: calc(100vh - 70px);
    background: var(--white);
    border-right: 1px solid var(--gray-200);
    padding: var(--spacing-4);
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    z-index: 999;
    overflow-y: auto;
  }
  
  .dashboard-sidebar.active {
    transform: translateX(0);
    box-shadow: 4px 0 12px rgba(0, 0, 0, 0.1);
  }
  
  .sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-2);
  }
  
  .sidebar-menu li {
    margin-bottom: 0;
  }
  
  .sidebar-menu a {
    padding: var(--spacing-3) var(--spacing-4);
    border-radius: var(--border-radius);
    display: block;
  }
  
  .sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .dashboard-content {
    padding: var(--spacing-4);
    width: 100%;
  }
  
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-4);
  }
  
  .quick-actions {
    flex-direction: column;
    gap: var(--spacing-3);
  }
  
  /* Overlay pour fermer le sidebar */
  .sidebar-overlay {
    display: none;
    position: fixed;
    top: 70px;
    left: 0;
    width: 100%;
    height: calc(100vh - 70px);
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s ease;
  }
  
  .sidebar-overlay.active {
    display: block;
    opacity: 1;
  }
}

@media (max-width: 767px) {
  .stats-grid {
    grid-template-columns: 1fr;
    gap: var(--spacing-3);
  }
  
  .stat-card {
    padding: var(--spacing-4);
  }
  
  .stat-number {
    font-size: var(--font-size-2xl);
  }
  
  .dashboard-sidebar {
    width: 85%;
    max-width: 300px;
  }
}

/* ========================================
   FILTRES ET RECHERCHE RESPONSIVE
   ======================================== */
@media (max-width: 767px) {
  .filters-container {
    flex-direction: column;
    align-items: stretch;
    gap: var(--spacing-4);
  }
  
  .filters-left {
    flex-direction: column;
    gap: var(--spacing-3);
  }
  
  .filter-group {
    flex-direction: column;
    align-items: stretch;
    gap: var(--spacing-2);
  }
  
  .filter-select {
    width: 100%;
  }
  
  .price-filter {
    flex-direction: column;
    align-items: stretch;
    gap: var(--spacing-2);
  }
  
  .price-inputs {
    display: flex;
    gap: var(--spacing-2);
  }
  
  .price-input {
    flex: 1;
  }
  
  .view-toggle {
    justify-content: center;
  }
  
  .search-bar {
    flex-direction: column;
    gap: var(--spacing-3);
    padding: var(--spacing-4);
  }
  
  .search-bar input {
    margin-bottom: var(--spacing-2);
  }
  
  .search-bar button {
    margin-left: 0;
    width: 100%;
  }
}

/* ========================================
   UTILITAIRES RESPONSIVE
   ======================================== */
@media (max-width: 767px) {
  .hidden-mobile {
    display: none !important;
  }
  
  .visible-mobile {
    display: block !important;
  }
  
  .text-center-mobile {
    text-align: center !important;
  }
  
  .full-width-mobile {
    width: 100% !important;
  }
  
  .no-padding-mobile {
    padding: 0 !important;
  }
  
  .no-margin-mobile {
    margin: 0 !important;
  }
}

@media (min-width: 768px) {
  .hidden-desktop {
    display: none !important;
  }
  
  .visible-desktop {
    display: block !important;
  }
}

/* ========================================
   ANIMATIONS RESPONSIVE
   ======================================== */
@media (prefers-reduced-motion: reduce) {
  .product-card:hover {
    transform: none;
  }
  
  .btn:hover {
    transform: none;
  }
  
  .card:hover {
    transform: none;
  }
}

/* ========================================
   ACCESSIBILITÉ TACTILE
   ======================================== */
@media (hover: none) and (pointer: coarse) {
  .btn {
    min-height: 44px;
    min-width: 44px;
  }
  
  .form-control {
    min-height: 44px;
  }
  
  .nav-links a {
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .product-card {
    cursor: default;
  }
  
  .product-card:hover {
    transform: none;
    box-shadow: var(--shadow);
  }
}

/* ========================================
   PRINT STYLES
   ======================================== */
@media print {
  .navbar,
  .btn,
  .nav-links,
  .filters-section,
  .cart-float {
    display: none !important;
  }
  
  .container {
    max-width: none;
    padding: 0;
  }
  
  .card {
    box-shadow: none;
    border: 1px solid var(--gray-300);
  }
  
  .product-card {
    break-inside: avoid;
  }
  
  body {
    font-size: 12pt;
    line-height: 1.4;
  }
  
  h1, h2, h3, h4, h5, h6 {
    page-break-after: avoid;
  }
}
