/* ===== KIM STATION RESPONSIVE FRAMEWORK ENTERPRISE ===== */
/* Versione: 1.0 - Agosto 2025 */
/* Breakpoints Standard Kim Station:
   - Mobile: 320px - 767px
   - Tablet: 768px - 1023px  
   - Desktop: 1024px - 1199px
   - Large: 1200px+
*/

/* ===== BASE RESPONSIVE LAYOUT ===== */
.main-layout {
  display: grid; 
  grid-template-columns: 1fr 1fr; 
  gap: 30px; 
  margin-bottom: 30px;
}

/* Large Desktop (1200px+) */
@media (min-width: 1200px) {
  .main-layout { gap: 40px; }
  .kpi-section { gap: 25px; }
}

/* Desktop (1024px - 1199px) */
@media (max-width: 1199px) {
  .main-layout { gap: 25px; }
}

/* Tablet (768px - 1023px) */
@media (max-width: 1023px) {
  .main-layout {
    grid-template-columns: 1fr; 
    gap: 20px;
  }
  .kpi-section { grid-template-columns: 1fr; gap: 15px; }
}

/* Mobile (320px - 767px) */
@media (max-width: 767px) {
  .main-layout { gap: 15px; margin-bottom: 20px; }
  .kpi-section { gap: 10px; }
}

/* ===== TABELLE RESPONSIVE ENTERPRISE ===== */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Tablet: Compatta le colonne */
@media (max-width: 1023px) {
  .new-table, .table, table {
    font-size: 14px;
  }
  .new-table th, .new-table td,
  .table th, .table td,
  table th, table td {
    padding: 8px 6px;
    white-space: nowrap;
  }
}

/* Mobile: Stack layout per tabelle complesse */
@media (max-width: 767px) {
  .new-table, .table, table {
    font-size: 12px;
    border: 0;
  }
  
  .new-table thead, .table thead, table thead {
    display: none;
  }
  
  .new-table tbody tr, .table tbody tr, table tbody tr {
    display: block;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 10px;
    padding: 10px;
    background: #fff;
  }
  
  .new-table tbody td, .table tbody td, table tbody td {
    display: block;
    text-align: left;
    border: none;
    padding: 5px 0;
    position: relative;
    padding-left: 40%;
  }
  
  .new-table tbody td:before, .table tbody td:before, table tbody td:before {
    content: attr(data-label);
    position: absolute;
    left: 0;
    width: 35%;
    font-weight: bold;
    color: #374151;
    font-size: 11px;
    text-transform: uppercase;
  }
}

/* ===== CONTROLLI TOUCH RESPONSIVE ===== */
input[type="range"] {
  width: 100%;
  height: 8px;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background: #e5e7eb;
  border-radius: 4px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  background: #3b82f6;
  border-radius: 50%;
  cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: #3b82f6;
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

/* Tablet: Controlli più grandi */
@media (max-width: 1023px) {
  input[type="range"] {
    height: 10px;
  }
  input[type="range"]::-webkit-slider-thumb {
    width: 24px;
    height: 24px;
  }
  input[type="range"]::-moz-range-thumb {
    width: 24px;
    height: 24px;
  }
}

/* Mobile: Controlli touch-friendly */
@media (max-width: 767px) {
  input[type="range"] {
    height: 12px;
    margin: 10px 0;
  }
  input[type="range"]::-webkit-slider-thumb {
    width: 28px;
    height: 28px;
  }
  input[type="range"]::-moz-range-thumb {
    width: 28px;
    height: 28px;
  }
}

/* ===== BUTTONS E NAVIGATION RESPONSIVE ===== */
.btn, .button, button {
  padding: 12px 24px;
  border-radius: 8px;
  border: none;
  background: #3b82f6;
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 44px; /* Touch target iOS */
}

.btn:hover, .button:hover, button:hover {
  background: #2563eb;
  transform: translateY(-1px);
}

/* Mobile: Pulsanti touch-friendly */
@media (max-width: 767px) {
  .btn, .button, button {
    width: 100%;
    padding: 16px 24px;
    font-size: 16px;
    min-height: 48px;
  }
  
  .card {
    padding: 16px;
    margin-bottom: 16px;
  }
  
  .card h3 {
    font-size: 16px;
    margin-bottom: 12px;
  }
  
  .section {
    padding: 16px;
    margin-bottom: 16px;
  }
  
  /* Progress bars più visibili su mobile */
  .progress-bar {
    height: 12px;
    border-radius: 6px;
  }
  
  /* Badge responsive */
  .badge {
    font-size: 12px;
    padding: 6px 12px;
  }
}

/* Tablet: Layout intermedio */
@media (max-width: 1023px) {
  .btn, .button, button {
    padding: 14px 20px;
    min-height: 46px;
  }
  
  .card {
    padding: 18px;
  }
  
  .progress-bar {
    height: 10px;
  }
}

/* ===== KPI CARDS RESPONSIVE ===== */
.kpi-section {
  display: grid; 
  grid-template-columns: 1fr 1fr; 
  gap: 20px;
}

.kpi-card {
  background: #fff; 
  border: 1px solid #e5e7eb; 
  border-radius: 12px; 
  padding: 20px; 
  text-align: center;
}

.kpi-value {
  font-size: 28px; 
  font-weight: 700; 
  margin-bottom: 5px;
}

.kpi-label {
  color: #6b7280; 
  font-size: 14px;
}

@media (max-width: 767px) {
  .kpi-card {
    padding: 15px;
  }
  .kpi-value {
    font-size: 24px;
  }
  .kpi-label {
    font-size: 12px;
  }
}

/* ===== DASHBOARD GRIDS RESPONSIVE ===== */
.dashboard-grid {
  display: grid;
  gap: 20px;
}

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

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

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

@media (max-width: 767px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }
}

/* ===== FORMS RESPONSIVE ===== */
.form-container {
  max-width: 100%;
}

@media (max-width: 767px) {
  .form-container {
    padding: 16px;
  }
  
  .form-group {
    margin-bottom: 16px;
  }
  
  input, select, textarea {
    width: 100%;
    padding: 12px;
    font-size: 16px; /* Prevent zoom on iOS */
    border-radius: 8px;
    border: 1px solid #d1d5db;
  }
  
  label {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 6px;
    display: block;
  }
}

/* ===== NAVIGATION RESPONSIVE ===== */
@media (max-width: 767px) {
  .nav-menu {
    flex-direction: column;
    width: 100%;
  }
  
  .nav-item {
    width: 100%;
    margin-bottom: 8px;
  }
  
  .nav-link {
    padding: 12px 16px;
    display: block;
    text-align: center;
  }
}

/* ===== MODALS RESPONSIVE ===== */
@media (max-width: 767px) {
  .modal {
    width: 95%;
    max-width: none;
    margin: 10px;
  }
  
  .modal-header {
    padding: 16px;
  }
  
  .modal-body {
    padding: 16px;
  }
  
  .modal-footer {
    padding: 16px;
    flex-direction: column;
  }
  
  .modal-footer .btn {
    width: 100%;
    margin-bottom: 8px;
  }
}

/* ===== UTILITY CLASSES ===== */
.mobile-hidden {
  display: block;
}

.mobile-only {
  display: none;
}

@media (max-width: 767px) {
  .mobile-hidden {
    display: none;
  }
  
  .mobile-only {
    display: block;
  }
}

.tablet-hidden {
  display: block;
}

.tablet-only {
  display: none;
}

@media (max-width: 1023px) and (min-width: 768px) {
  .tablet-hidden {
    display: none;
  }
  
  .tablet-only {
    display: block;
  }
}

/* ===== PRINT STYLES ===== */
@media print {
  .mobile-only,
  .tablet-only,
  .btn,
  .button,
  button {
    display: none;
  }
  
  .main-layout {
    grid-template-columns: 1fr;
  }
  
  .card {
    break-inside: avoid;
  }
}
