/**
 * Responsive Design - PatitasAlMar
 * Optimizado para todos los dispositivos
 */

/* ============================================
   BREAKPOINTS RESPONSIVE
   ============================================ */
:root {
    --mobile: 320px;
    --mobile-lg: 480px;
    --tablet: 768px;
    --desktop: 1024px;
    --desktop-lg: 1280px;
    --desktop-xl: 1536px;
}

/* ============================================
   UTILIDADES RESPONSIVE
   ============================================ */

/* Contenedores responsive */
.container {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 0 1rem;
}

@media (min-width: 640px) {
    .container {
        max-width: 640px;
        padding: 0 1.5rem;
    }
}

@media (min-width: 768px) {
    .container {
        max-width: 768px;
        padding: 0 2rem;
    }
}

@media (min-width: 1024px) {
    .container {
        max-width: 1024px;
    }
}

@media (min-width: 1280px) {
    .container {
        max-width: 1280px;
    }
}

/* ============================================
   HEADER RESPONSIVE
   ============================================ */

.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: white;
    border-bottom: 1px solid var(--gray-200);
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    min-height: 4rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: inherit;
    flex-shrink: 0;
}

.logo-icon {
    font-size: 2rem;
    line-height: 1;
}

.logo-text h1 {
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1.2;
    margin: 0;
}

.logo-text p {
    font-size: 0.75rem;
    margin: 0;
    opacity: 0.8;
}

.nav {
    display: none;
    align-items: center;
    gap: 1.5rem;
}

.nav-link {
    text-decoration: none;
    color: var(--gray-600);
    font-weight: 500;
    transition: color 0.2s ease;
    padding: 0.5rem 0;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary);
}

/* Mobile menu button */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--gray-600);
    cursor: pointer;
    padding: 0.5rem;
    flex-direction: column;
    gap: 3px;
    width: 40px;
    height: 40px;
    justify-content: center;
    align-items: center;
}

.mobile-menu-btn span {
    width: 20px;
    height: 2px;
    background: var(--gray-600);
    transition: all 0.3s ease;
    border-radius: 1px;
}

.mobile-menu-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-btn.active span:nth-child(2) {
    opacity: 0;
}

.mobile-menu-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* Mobile navigation */
.mobile-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid var(--gray-200);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    z-index: 50;
    transform: translateY(-100%);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.mobile-nav.show {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}

.mobile-nav-content {
    padding: 1rem;
}

.mobile-nav-link {
    display: block;
    padding: 0.75rem 0;
    color: var(--gray-700);
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px solid var(--gray-100);
    transition: color 0.2s ease;
}

.mobile-nav-link:hover,
.mobile-nav-link.active {
    color: var(--primary);
}

.mobile-nav-link:last-child {
    border-bottom: none;
}

/* ============================================
   FORMULARIOS RESPONSIVE
   ============================================ */

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--gray-200);
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: all 0.2s ease;
    background: white;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* ============================================
   BOTONES RESPONSIVE
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    line-height: 1.25;
    min-height: 2.75rem;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.btn-secondary {
    background: white;
    color: var(--gray-700);
    border: 2px solid var(--gray-200);
}

.btn-secondary:hover {
    background: var(--gray-50);
    border-color: var(--gray-300);
}

.btn-ghost {
    background: transparent;
    color: var(--gray-600);
    border: 2px solid transparent;
}

.btn-ghost:hover {
    background: var(--gray-50);
    color: var(--gray-800);
}

/* ============================================
   CARDS RESPONSIVE
   ============================================ */

.card {
    background: white;
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--gray-200);
}

/* ============================================
   GRID RESPONSIVE
   ============================================ */

.grid {
    display: grid;
    gap: 1.5rem;
}

.grid-cols-1 {
    grid-template-columns: 1fr;
}

.grid-cols-2 {
    grid-template-columns: 1fr;
}

.grid-cols-3 {
    grid-template-columns: 1fr;
}

/* ============================================
   FLEX RESPONSIVE
   ============================================ */

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-center {
    justify-content: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-3 {
    gap: 0.75rem;
}

.gap-4 {
    gap: 1rem;
}

.gap-6 {
    gap: 1.5rem;
}

/* ============================================
   TIPOGRAFÍA RESPONSIVE
   ============================================ */

.text-xs {
    font-size: 0.75rem;
    line-height: 1rem;
}

.text-sm {
    font-size: 0.875rem;
    line-height: 1.25rem;
}

.text-base {
    font-size: 1rem;
    line-height: 1.5rem;
}

.text-lg {
    font-size: 1.125rem;
    line-height: 1.75rem;
}

.text-xl {
    font-size: 1.25rem;
    line-height: 1.75rem;
}

.text-2xl {
    font-size: 1.5rem;
    line-height: 2rem;
}

.text-3xl {
    font-size: 1.875rem;
    line-height: 2.25rem;
}

.text-4xl {
    font-size: 2.25rem;
    line-height: 2.5rem;
}

.text-5xl {
    font-size: 3rem;
    line-height: 1;
}

/* ============================================
   ESPACIADO RESPONSIVE
   ============================================ */

.p-2 {
    padding: 0.5rem;
}

.p-3 {
    padding: 0.75rem;
}

.p-4 {
    padding: 1rem;
}

.p-6 {
    padding: 1.5rem;
}

.p-8 {
    padding: 2rem;
}

.py-4 {
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.py-6 {
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
}

.py-8 {
    padding-top: 2rem;
    padding-bottom: 2rem;
}

.py-16 {
    padding-top: 4rem;
    padding-bottom: 4rem;
}

.mb-2 {
    margin-bottom: 0.5rem;
}

.mb-3 {
    margin-bottom: 0.75rem;
}

.mb-4 {
    margin-bottom: 1rem;
}

.mb-6 {
    margin-bottom: 1.5rem;
}

.mb-8 {
    margin-bottom: 2rem;
}

.mt-4 {
    margin-top: 1rem;
}

.mt-6 {
    margin-top: 1.5rem;
}

.mt-8 {
    margin-top: 2rem;
}

/* ============================================
   RESPONSIVE BREAKPOINTS
   ============================================ */

/* Mobile Small (320px - 479px) */
@media (max-width: 479px) {
    .container {
        padding: 0 0.75rem;
    }
    
    .card {
        padding: 1rem;
        border-radius: 0.75rem;
    }
    
    .btn {
        padding: 0.625rem 1.25rem;
        font-size: 0.8125rem;
        min-height: 2.5rem;
    }
    
    .text-5xl {
        font-size: 2rem;
    }
    
    .text-4xl {
        font-size: 1.75rem;
    }
    
    .text-3xl {
        font-size: 1.5rem;
    }
    
    .logo-text h1 {
        font-size: 1.25rem;
    }
    
    .logo-icon {
        font-size: 1.75rem;
    }
}

/* Mobile Large (480px - 767px) */
@media (min-width: 480px) and (max-width: 767px) {
    .container {
        padding: 0 1rem;
    }
    
    .text-5xl {
        font-size: 2.5rem;
    }
    
    .text-4xl {
        font-size: 2rem;
    }
}

/* Tablet (768px - 1023px) */
@media (min-width: 768px) {
    .nav {
        display: flex;
    }
    
    .mobile-menu-btn {
        display: none !important;
    }
    
    .mobile-nav {
        display: none !important;
    }
    
    .grid-cols-2 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .grid-cols-3 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .flex {
        flex-direction: row;
    }
    
    .gap-2 > * {
        margin-bottom: 0;
    }
    
    .text-5xl {
        font-size: 3rem;
    }
    
    .text-4xl {
        font-size: 2.25rem;
    }
    
    .text-3xl {
        font-size: 1.875rem;
    }
}

/* Corrección específica para resoluciones 769px-1024px */
@media (min-width: 769px) and (max-width: 1024px) {
    .header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1000;
        width: 100%;
    }
    
    .header-content {
        height: 3.5rem;
        padding: 0 1rem;
    }
    
    .logo {
        gap: 0.5rem;
    }
    
    .logo-icon {
        width: 35px;
        height: 35px;
        font-size: 1.4rem;
    }
    
    .logo-title {
        font-size: 1.1rem;
    }
    
    .logo-subtitle {
        font-size: 0.8rem;
    }
    
    .nav {
        gap: 1rem;
    }
    
    .nav a {
        font-size: 0.9rem;
        padding: 0.5rem 0.75rem;
    }
    
    .user-info {
        font-size: 0.85rem;
    }
    
    .btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }
    
    /* Ajustar el contenido principal para compensar el header fijo */
    .main-content {
        margin-top: 3.5rem;
    }
}

/* Mobile (hasta 767px) */
@media (max-width: 767px) {
    .nav {
        display: none;
    }
    
    .mobile-menu-btn {
        display: flex !important;
    }
    
    .header-content {
        gap: 1rem;
    }
    
    .user-menu {
        display: none;
    }
}

/* Desktop (1024px - 1279px) */
@media (min-width: 1024px) {
    .grid-cols-3 {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .text-5xl {
        font-size: 3.5rem;
    }
}

/* Desktop Large (1280px+) */
@media (min-width: 1280px) {
    .text-5xl {
        font-size: 4rem;
    }
}

/* ============================================
   CONTENIDO PRINCIPAL CON HEADER FIJO
   ============================================ */

.main-content {
    padding-top: 4rem; /* Espacio para header fijo */
}

/* Ajustes para páginas de autenticación */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    padding-top: 6rem; /* Extra padding para header fijo */
}

.auth-form {
    width: 100%;
    max-width: 450px;
    margin: 0 auto;
}

@media (min-width: 480px) {
    .auth-form {
        max-width: 500px;
    }
}

/* Ajustes para páginas con contenido */
.paw-pattern {
    padding-top: 5rem; /* Espacio para header fijo */
}

/* Ajustes específicos para hero section */
.hero {
    padding-top: 2rem; /* Menos padding para hero */
}

/* ============================================
   COMPONENTES ESPECÍFICOS RESPONSIVE
   ============================================ */

/* Formularios de autenticación - ya definido arriba */

/* Escáner RFID */
.scanner-container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
}

.scanner-input-group {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

@media (max-width: 767px) {
    .scanner-input-group {
        flex-direction: column;
        gap: 1rem;
    }
}

.scanner-input {
    flex: 1;
    padding: 1rem;
    font-size: 1.25rem;
    text-align: center;
    letter-spacing: 1px;
}

.scanner-btn {
    padding: 1rem 2rem;
    font-size: 1.25rem;
    white-space: nowrap;
}

@media (max-width: 767px) {
    .scanner-input {
        font-size: 1.1rem;
        padding: 0.875rem;
    }
    
    .scanner-btn {
        font-size: 1.1rem;
        padding: 0.875rem 1.5rem;
    }
}

/* Dashboard */
.dashboard-grid {
    display: grid;
    gap: 1.5rem;
    grid-template-columns: 1fr;
}

@media (min-width: 768px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ============================================
   UTILIDADES DE VISIBILIDAD
   ============================================ */

.hidden {
    display: none !important;
}

@media (max-width: 767px) {
    .hidden-mobile {
        display: none !important;
    }
}

@media (min-width: 768px) {
    .hidden-desktop {
        display: none !important;
    }
}

/* ============================================
   ANIMACIONES RESPONSIVE
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   MEJORAS DE ACCESIBILIDAD
   ============================================ */

@media (max-width: 767px) {
    /* Botones más grandes para touch */
    .btn {
        min-height: 3rem;
        padding: 0.875rem 1.5rem;
    }
    
    /* Inputs más grandes para touch */
    .form-input,
    .form-select,
    .form-textarea {
        min-height: 3rem;
        padding: 0.875rem 1rem;
    }
    
    /* Enlaces más grandes para touch */
    a {
        min-height: 2.75rem;
        display: inline-flex;
        align-items: center;
    }
}

/* ============================================
   ORIENTACIÓN LANDSCAPE
   ============================================ */

@media (max-height: 500px) and (orientation: landscape) {
    .auth-container {
        padding: 0.5rem;
    }
    
    .card {
        padding: 1rem;
    }
    
    .py-16 {
        padding-top: 2rem;
        padding-bottom: 2rem;
    }
}