/* ===================================
   KC Promosyon -  Responsive
   Mobile-first responsive styles
   =================================== */

/* ============ TABLET (768px - 1024px) ============ */
@media (max-width: 1024px) {
  /* Container adjustments */
  .container {
    padding: 0 var(--spacing-lg);
  }
  
  /* Grid adjustments */
  .grid-4 {
    grid-template-columns: repeat(3, 1fr);
  }
  
  .grid-6 {
    grid-template-columns: repeat(4, 1fr);
  }
  
  /* Product card adjustments */
  .product-card-title {
    font-size: var(--font-size-sm);
  }
  
  /* Category card */
  .category-card-image {
    height: 180px;
  }
  
  .category-card-overlay {
    padding: 12px 16px;
  }
  
  .category-card-title {
    font-size: var(--font-size-base);
  }
}

/* ============ MOBILE LANDSCAPE (640px - 768px) ============ */
@media (max-width: 768px) {
  /* Grid adjustments */
  .grid-3,
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .grid-6 {
    grid-template-columns: repeat(3, 1fr);
  }
  
  /* Spacing adjustments */
  .section {
    padding: var(--spacing-2xl) 0;
  }
  
  .section-lg {
    padding: var(--spacing-3xl) 0;
  }
  
  /* Modal adjustments */
  .modal {
    max-width: 95vw;
    max-height: 95vh;
  }
  
  .modal-header,
  .modal-body,
  .modal-footer {
    padding: var(--spacing-lg);
  }
  
  /* Category card */
  .category-card-image {
    height: 160px;
  }
  
  .category-card-overlay {
    padding: 14px 18px;
  }
  
  .category-card-title {
    font-size: var(--font-size-base);
  }
}

/* ============ MOBILE PORTRAIT (< 640px) ============ */
@media (max-width: 640px) {
  /* Container */
  .container {
    padding: 0 var(--spacing-md);
  }
  
  /* Typography scale down */
  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);
  }
  
  /* Grid to single column */
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
    gap: var(--spacing-md);
  }
  
  .grid-6 {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--spacing-md);
  }
  
  /* Section spacing */
  .section {
    padding: var(--spacing-xl) 0;
  }
  
  .section-sm {
    padding: var(--spacing-lg) 0;
  }
  
  .section-lg {
    padding: var(--spacing-2xl) 0;
  }
  
  /* Button adjustments */
  .btn {
    width: 100%;
    justify-content: center;
  }
  
  .btn-sm {
    padding: 10px 16px;
  }
  
  .btn-lg {
    padding: 14px 24px;
  }
  
  /* Card adjustments */
  .card-body,
  .card-header,
  .card-footer {
    padding: var(--spacing-md);
  }
  
  /* Product card mobile */
  .product-card-content {
    padding: var(--spacing-md);
  }
  
  .product-card-actions {
    opacity: 1;
    transform: translateX(0);
  }
  
  .product-card-badge {
    top: var(--spacing-sm);
    left: var(--spacing-sm);
    font-size: 10px;
    padding: 2px 8px;
  }
  
  /* Category card mobile */
  .category-card-image {
    height: 140px;
  }
  
  .category-card-overlay {
    padding: 10px 14px;
  }
  
  .category-card-title {
    font-size: 0.9rem;
  }
  
  .category-card-count {
    font-size: var(--font-size-xs);
  }
  
  /* Form adjustments */
  .form-input,
  .form-select,
  .form-textarea {
    font-size: 16px; /* Prevent zoom on iOS */
  }
  
  /* Modal full screen on mobile */
  .modal {
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    transform: none;
  }
  
  .modal-header {
    padding: var(--spacing-md);
  }
  
  .modal-body {
    padding: var(--spacing-md);
  }
  
  .modal-footer {
    padding: var(--spacing-md);
    flex-direction: column-reverse;
  }
  
  .modal-footer .btn {
    width: 100%;
  }
  
  /* Pagination mobile */
  .pagination {
    gap: var(--spacing-xs);
  }
  
  .pagination-item {
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
    font-size: var(--font-size-sm);
  }
  
  /* Breadcrumb mobile */
  .breadcrumb {
    font-size: var(--font-size-xs);
    gap: var(--spacing-xs);
  }
  
  /* Flexbox direction changes */
  .flex-between-mobile-col {
    flex-direction: column;
    align-items: stretch;
    gap: var(--spacing-md);
  }
  
  /* Hide on mobile */
  .mobile-hidden {
    display: none !important;
  }
  
  /* Show only on mobile */
  .mobile-only {
    display: block !important;
  }
}

/* ============ EXTRA SMALL MOBILE (< 375px) ============ */
@media (max-width: 375px) {
  h1 {
    font-size: var(--font-size-2xl);
  }
  
  h2 {
    font-size: var(--font-size-xl);
  }
  
  .container {
    padding: 0 var(--spacing-sm);
  }
  
  .category-card {
    height: 160px;
  }
  
  .product-card-action-btn {
    width: 36px;
    height: 36px;
  }
}

/* ============ LANDSCAPE ORIENTATION ============ */
@media (max-height: 500px) and (orientation: landscape) {
  .modal {
    max-height: 95vh;
    overflow-y: auto;
  }
  
  .category-card {
    height: 200px;
  }
}

/* ============ DESKTOP LARGE (> 1440px) ============ */
@media (min-width: 1440px) {
  .container {
    max-width: 1440px;
  }
  
  .grid-4 {
    grid-template-columns: repeat(5, 1fr);
  }
  
  .category-card {
    height: 320px;
  }
}

/* ============ DESKTOP EXTRA LARGE (> 1920px) ============ */
@media (min-width: 1920px) {
  .container {
    max-width: 1600px;
  }
  
  .grid-4 {
    grid-template-columns: repeat(6, 1fr);
  }
}

/* ============ PRINT STYLES ============ */
@media print {
  /* Hide non-essential elements */
  .header,
  .footer,
  .btn,
  .product-card-actions,
  .pagination,
  .no-print {
    display: none !important;
  }
  
  /* Adjust colors for print */
  body {
    background: white;
    color: black;
  }
  
  .card {
    box-shadow: none;
    border: 1px solid #ddd;
    page-break-inside: avoid;
  }
  
  /* Remove interactive states */
  a {
    text-decoration: underline;
    color: black;
  }
  
  /* Optimize spacing for print */
  .section {
    padding: 20px 0;
  }
}

/* ============ ACCESSIBILITY - REDUCED MOTION ============ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============ HIGH CONTRAST MODE ============ */
@media (prefers-contrast: high) {
  :root {
    --color-border: #000000;
    --color-text-light: #000000;
  }
  
  .card {
    border: 2px solid var(--color-border);
  }
  
  .btn {
    border-width: 2px;
  }
}

/* ============ DARK MODE PREFERENCE ============ */
@media (prefers-color-scheme: dark) {
  /* Optional: Add dark mode support later */
  /* For now, we keep light theme only */
}

/* ============ TOUCH DEVICE OPTIMIZATIONS ============ */
@media (hover: none) and (pointer: coarse) {
  /* Increase tap targets for touch devices */
  .btn {
    min-height: 44px;
  }
  
  .form-input,
  .form-select {
    min-height: 44px;
  }
  
  .pagination-item {
    min-width: 44px;
    min-height: 44px;
  }
  
  /* Always show product card actions on touch devices */
  .product-card-actions {
    opacity: 1;
    transform: translateX(0);
  }
  
  /* Remove hover effects that don't work on touch */
  .card:hover {
    transform: none;
  }
}
