﻿/* ==========================================
   RESPONSIVE ADMIN UTILITIES - MOBILE FIRST
   Estilos globales para panel de administración
   ========================================== */

/* --- VARIABLES CSS --- */
:root {
  --mobile-breakpoint: 768px;
  --tablet-breakpoint: 1024px;
  --touch-target-min: 44px;
  --mobile-spacing: 1rem;
  --desktop-spacing: 2rem;
}

/* --- UTILIDADES DE DISPLAY --- */
.mobile-only {
  display: block;
}

.desktop-only {
  display: none;
}

@media (min-width: 768px) {
  .mobile-only {
    display: none;
  }
  .desktop-only {
    display: block;
  }
}

/* --- CONTENEDORES RESPONSIVE --- */
.admin-container {
  max-width: 100%;
  padding: 0.75rem;
}

@media (min-width: 768px) {
  .admin-container {
    max-width: 1280px;
    padding: 1.5rem;
  }
}

/* --- CARDS MOBILE --- */
.mobile-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 1rem;
  margin-bottom: 0.75rem;
}

.mobile-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid #f3f4f6;
}

.mobile-card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
}

.mobile-card-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: #6b7280;
  margin-bottom: 0.25rem;
}

.mobile-card-value {
  font-size: 0.875rem;
  color: #111827;
  font-weight: 500;
}

/* --- BOTONES TOUCH-FRIENDLY --- */
.btn-touch {
  min-height: 44px;
  padding: 0.75rem 1.25rem;
  font-size: 0.9375rem;
  font-weight: 600;
  border-radius: 0.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

@media (max-width: 767px) {
  .btn-touch-full {
    width: 100%;
  }
}

/* --- FORMULARIOS MOBILE --- */
.form-mobile {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-field-mobile {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-field-mobile label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: #374151;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.form-field-mobile input,
.form-field-mobile select,
.form-field-mobile textarea {
  min-height: 44px;
  padding: 0.75rem;
  font-size: 1rem;
  border: 1px solid #d1d5db;
  border-radius: 0.5rem;
  width: 100%;
}

.form-field-mobile input:focus,
.form-field-mobile select:focus,
.form-field-mobile textarea:focus {
  outline: none;
  border-color: #059669;
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}

/* --- GRIDS RESPONSIVE --- */
.grid-responsive-1 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

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

/* --- TABLAS → CARDS EN MOBILE --- */
.table-desktop {
  display: none;
}

.table-mobile-cards {
  display: block;
}

@media (min-width: 768px) {
  .table-desktop {
    display: table;
  }
  .table-mobile-cards {
    display: none;
  }
}

/* --- MODALES RESPONSIVE --- */
@media (max-width: 767px) {
  .modal-responsive {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    margin: 0;
    border-radius: 0;
  }
  
  .modal-responsive-content {
    height: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* --- TABS MOBILE (Scrolleable horizontal SOLO para tabs) --- */
.tabs-container-mobile {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.tabs-container-mobile::-webkit-scrollbar {
  display: none;
}

.tabs-list {
  display: flex;
  gap: 0.5rem;
  min-width: min-content;
  padding: 0 0.5rem;
}

@media (min-width: 768px) {
  .tabs-list {
    padding: 0;
  }
}

/* --- SIDEBAR RESPONSIVE (Settings) --- */
.sidebar-mobile {
  position: relative;
  width: 100%;
  margin-bottom: 1.5rem;
}

.sidebar-desktop {
  display: none;
}

@media (min-width: 768px) {
  .sidebar-mobile {
    display: none;
  }
  .sidebar-desktop {
    display: block;
    width: 16rem;
    flex-shrink: 0;
  }
}

/* --- KANBAN RESPONSIVE --- */
.kanban-mobile {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.kanban-desktop {
  display: none;
}

@media (min-width: 1024px) {
  .kanban-mobile {
    display: none;
  }
  .kanban-desktop {
    display: flex;
    overflow-x: auto;
  }
}

/* --- HEADER STICKY RESPONSIVE --- */
.admin-header-sticky {
  position: sticky;
  top: 0;
  z-index: 40;
  background: white;
  border-bottom: 1px solid #e5e7eb;
}

@media (max-width: 767px) {
  .admin-header-sticky {
    padding: 0.75rem 1rem;
  }
  
  .admin-header-title {
    font-size: 1.25rem;
  }
}

/* --- ESPACIADO RESPONSIVE --- */
.spacing-mobile {
  padding: 0.75rem;
}

.spacing-desktop {
  padding: 1.5rem;
}

@media (min-width: 768px) {
  .spacing-mobile {
    padding: 1.5rem;
  }
}

/* --- OVERFLOW PREVENTION --- */
@media (max-width: 767px) {
  body {
    overflow-x: hidden;
  }
  
  * {
    max-width: 100vw;
  }
  
  img {
    max-width: 100%;
    height: auto;
  }
}

/* --- CUSTOM SCROLLBAR (Solo desktop) --- */
@media (min-width: 768px) {
  .custom-scrollbar::-webkit-scrollbar {
    width: 8px;
    height: 8px;
  }
  
  .custom-scrollbar::-webkit-scrollbar-track {
    background: #f3f4f6;
    border-radius: 4px;
  }
  
  .custom-scrollbar::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
  }
  
  .custom-scrollbar::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
  }
}

/* --- HIDE SCROLLBAR (Mobile) --- */
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.no-scrollbar::-webkit-scrollbar {
  display: none;
}

/* --- TOUCHABLE AREAS --- */
@media (max-width: 767px) {
  button,
  a,
  .clickable {
    min-height: 44px;
    min-width: 44px;
  }
}

/* --- TEXT RESPONSIVE --- */
.text-mobile-sm {
  font-size: 0.875rem;
}

.text-mobile-base {
  font-size: 1rem;
}

@media (min-width: 768px) {
  .text-mobile-sm {
    font-size: 1rem;
  }
  .text-mobile-base {
    font-size: 1.125rem;
  }
}

/* --- UTILITIES --- */
.prevent-zoom {
  touch-action: manipulation;
}

.safe-area-bottom {
  padding-bottom: env(safe-area-inset-bottom);
}

.safe-area-top {
  padding-top: env(safe-area-inset-top);
}
