/*
 * =====================================================
 * AICCPS - Sistema de Responsive Design Universal
 * =====================================================
 * Fecha: 2025-12-08
 * Optimizado para: móviles, tablets, desktop
 * Breakpoints: 320px, 480px, 640px, 768px, 1024px, 1280px
 * =====================================================
 */

/* =====================================================
   VARIABLES RESPONSIVE
   ===================================================== */
:root {
    /* Breakpoints */
    --mobile-s: 320px;
    --mobile-m: 375px;
    --mobile-l: 425px;
    --tablet: 768px;
    --laptop: 1024px;
    --desktop: 1280px;
    
    /* Spacing responsive */
    --space-mobile: 16px;
    --space-tablet: 24px;
    --space-desktop: 32px;
    
    /* Font sizes responsive */
    --h1-mobile: 28px;
    --h1-tablet: 36px;
    --h1-desktop: 48px;
    
    --h2-mobile: 24px;
    --h2-tablet: 30px;
    --h2-desktop: 40px;
    
    --h3-mobile: 20px;
    --h3-tablet: 24px;
    --h3-desktop: 32px;
    
    --body-mobile: 14px;
    --body-tablet: 15px;
    --body-desktop: 16px;
}

/* =====================================================
   BASE RESPONSIVE
   ===================================================== */
* {
    box-sizing: border-box;
}

html {
    /* Prevenir zoom en inputs en iOS */
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
}

body {
    /* Prevenir scroll horizontal */
    overflow-x: hidden;
    width: 100%;
}

img,
video {
    max-width: 100%;
    height: auto;
    display: block;
}

/* =====================================================
   CONTAINERS RESPONSIVE
   ===================================================== */
.container {
    width: 100%;
    margin: 0 auto;
    padding: 0 var(--space-mobile);
}

@media (min-width: 768px) {
    .container {
        padding: 0 var(--space-tablet);
        max-width: 720px;
    }
}

@media (min-width: 1024px) {
    .container {
        padding: 0 var(--space-desktop);
        max-width: 960px;
    }
}

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

/* =====================================================
   GRIDS RESPONSIVE
   ===================================================== */
.grid {
    display: grid;
    gap: 20px;
    grid-template-columns: 1fr;
}

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

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

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

/* =====================================================
   MENÚ HAMBURGUESA
   ===================================================== */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 10px;
    z-index: 1001;
}

@media (max-width: 768px) {
    .mobile-menu-toggle {
        display: block;
    }
    
    .nav-links {
        position: fixed;
        top: 0;
        left: -100%;
        width: 80%;
        max-width: 300px;
        height: 100vh;
        background: rgba(15, 15, 30, 0.98);
        backdrop-filter: blur(20px);
        padding: 80px 30px 30px;
        display: flex;
        flex-direction: column;
        gap: 20px;
        transition: left 0.3s ease;
        z-index: 1000;
        overflow-y: auto;
    }
    
    .nav-links.active {
        left: 0;
    }
    
    .nav-links .nav-link,
    .nav-links .btn-nav {
        width: 100%;
        text-align: left;
        padding: 15px 20px;
        display: block;
    }
    
    /* Overlay cuando el menú está abierto */
    .mobile-menu-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.5);
        z-index: 999;
    }
    
    .mobile-menu-overlay.active {
        display: block;
    }
}

/* =====================================================
   TARJETAS RESPONSIVE
   ===================================================== */
.card {
    width: 100%;
}

.professional-card,
.user-card,
.admin-card {
    width: 100%;
    min-height: auto;
}

@media (max-width: 640px) {
    .card {
        padding: 16px !important;
    }
    
    .card h3 {
        font-size: 18px !important;
    }
    
    .card p {
        font-size: 14px !important;
    }
}

/* =====================================================
   FORMULARIOS RESPONSIVE
   ===================================================== */
.form-group {
    width: 100%;
}

input,
textarea,
select {
    /* Prevenir zoom en iOS */
    font-size: 16px !important;
    width: 100%;
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

@media (min-width: 768px) {
    .form-row {
        flex-direction: row;
    }
    
    .form-row .form-group {
        flex: 1;
    }
}

/* =====================================================
   BOTONES RESPONSIVE
   ===================================================== */
.btn {
    width: 100%;
    padding: 12px 20px;
    font-size: 14px;
}

@media (min-width: 640px) {
    .btn {
        width: auto;
        min-width: 120px;
    }
}

.btn-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

@media (min-width: 640px) {
    .btn-group {
        flex-direction: row;
        justify-content: flex-start;
    }
}

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

table {
    min-width: 600px;
}

@media (max-width: 768px) {
    table {
        font-size: 14px;
    }
    
    th,
    td {
        padding: 8px 6px !important;
    }
}

/* =====================================================
   SIDEBAR RESPONSIVE
   ===================================================== */
.sidebar {
    width: 100%;
}

@media (max-width: 968px) {
    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        height: 100vh;
        transition: left 0.3s ease;
        z-index: 1001;
    }
    
    .sidebar.active {
        left: 0;
    }
    
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }
}

/* =====================================================
   DASHBOARD RESPONSIVE
   ===================================================== */
.stats-grid {
    grid-template-columns: 1fr;
    gap: 16px;
}

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

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

/* =====================================================
   MENSAJERÍA RESPONSIVE
   ===================================================== */
.chat-container {
    flex-direction: column;
    height: calc(100vh - 80px);
}

@media (max-width: 768px) {
    .conversations-sidebar {
        width: 100%;
        height: 40%;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .chat-panel {
        width: 100%;
        height: 60%;
    }
}

/* =====================================================
   MODALES RESPONSIVE
   ===================================================== */
.modal-content {
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

@media (max-width: 640px) {
    .modal-content {
        width: 95%;
        margin: 20px auto;
    }
}

/* =====================================================
   TIPOGRAFÍA RESPONSIVE
   ===================================================== */
h1 {
    font-size: var(--h1-mobile);
    line-height: 1.2;
}

h2 {
    font-size: var(--h2-mobile);
    line-height: 1.3;
}

h3 {
    font-size: var(--h3-mobile);
    line-height: 1.4;
}

body,
p {
    font-size: var(--body-mobile);
    line-height: 1.6;
}

@media (min-width: 768px) {
    h1 {
        font-size: var(--h1-tablet);
    }
    
    h2 {
        font-size: var(--h2-tablet);
    }
    
    h3 {
        font-size: var(--h3-tablet);
    }
    
    body,
    p {
        font-size: var(--body-tablet);
    }
}

@media (min-width: 1024px) {
    h1 {
        font-size: var(--h1-desktop);
    }
    
    h2 {
        font-size: var(--h2-desktop);
    }
    
    h3 {
        font-size: var(--h3-desktop);
    }
    
    body,
    p {
        font-size: var(--body-desktop);
    }
}

/* =====================================================
   UTILIDADES DE VISIBILIDAD
   ===================================================== */
.hide-mobile {
    display: none;
}

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

.show-mobile {
    display: block;
}

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

/* =====================================================
   ESPACIADO RESPONSIVE
   ===================================================== */
.section {
    padding: 40px var(--space-mobile);
}

@media (min-width: 768px) {
    .section {
        padding: 60px var(--space-tablet);
    }
}

@media (min-width: 1024px) {
    .section {
        padding: 80px var(--space-desktop);
    }
}

/* =====================================================
   TOUCH TARGETS (iOS/Android)
   ===================================================== */
button,
a,
input[type="button"],
input[type="submit"] {
    /* Tamaño mínimo de 44x44px para touch targets */
    min-height: 44px;
    min-width: 44px;
}

/* =====================================================
   ORIENTACIÓN (Portrait/Landscape)
   ===================================================== */
@media (max-width: 768px) and (orientation: landscape) {
    .hero {
        min-height: auto;
        padding: 60px 20px;
    }
    
    .modal-content {
        max-height: 80vh;
    }
}

/* =====================================================
   FIX PARA iOS SAFARI
   ===================================================== */
@supports (-webkit-touch-callout: none) {
    /* Fix para altura del viewport en iOS */
    .full-height {
        height: -webkit-fill-available;
    }
}

/* =====================================================
   ANIMACIONES RESPONSIVE (reducir en móviles)
   ===================================================== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* =====================================================
   PRINT STYLES
   ===================================================== */
@media print {
    .navbar,
    .sidebar,
    .footer,
    .btn,
    .mobile-menu-toggle {
        display: none !important;
    }
    
    body {
        background: white;
        color: black;
    }
    
    .main-content {
        margin: 0 !important;
        width: 100% !important;
    }
}
