/**
 * SaraGo Website - Responsive CSS
 * Estilos responsive y media queries
 * Version: 1.0.0
 * Author: EDESSIS, S.R.L.
 */

/* ===== BREAKPOINT REFERENCE ===== */
/* 
 * xs: < 475px    - Extra small devices (portrait phones)
 * sm: < 640px    - Small devices (landscape phones)
 * md: < 768px    - Medium devices (tablets)
 * lg: < 1024px   - Large devices (small laptops)
 * xl: < 1280px   - Extra large devices (desktops)
 * 2xl: < 1536px  - 2X large devices (large desktops)
 */

/* ===== 2X LARGE DEVICES (max-width: 1536px) ===== */
@media (max-width: 1536px) {
    .container {
        max-width: 1280px;
    }
}

/* ===== EXTRA LARGE DEVICES (max-width: 1280px) ===== */
@media (max-width: 1280px) {
    .container {
        max-width: 1024px;
    }
    
    .hero-title {
        font-size: 3.5rem;
    }
    
    .section-title {
        font-size: 2.5rem;
    }
}

/* ===== LARGE DEVICES (max-width: 1024px) ===== */
@media (max-width: 1024px) {
    .container {
        max-width: 768px;
        padding: 0 1.5rem;
    }
    
    /* Grid adjustments */
    .grid-6 {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .grid-5 {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Navigation adjustments */
    .navbar-nav {
        gap: 1.5rem;
    }
    
    /* Hero adjustments */
    .hero {
        padding: 5rem 0;
    }
    
    .hero-title {
        font-size: 3rem;
    }
    
    /* Feature grid adjustments */
    .feature-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Footer adjustments */
    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Dashboard layouts */
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    /* Newsletter form */
    .newsletter-content {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }
}

/* ===== MEDIUM DEVICES / TABLETS (max-width: 768px) ===== */
@media (max-width: 768px) {
    /* Base adjustments */
    :root {
        --container-padding: 1rem;
        --section-padding: 3rem 0;
    }
    
    body {
        font-size: 0.9375rem;
    }
    
    .container {
        padding: 0 var(--container-padding);
    }
    
    /* Typography */
    h1 {
        font-size: 2.5rem;
    }
    
    h2 {
        font-size: 2rem;
    }
    
    h3 {
        font-size: 1.75rem;
    }
    
    h4 {
        font-size: 1.5rem;
    }
    
    h5 {
        font-size: 1.25rem;
    }
    
    h6 {
        font-size: 1.125rem;
    }
    
    /* Mobile Navigation */
    .mobile-menu-toggle {
        display: flex;
    }
    
    .navbar-menu {
        position: fixed;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--white);
        border-top: 1px solid var(--gray-200);
        padding: 2rem;
        transform: translateY(-100%);
        opacity: 0;
        visibility: hidden;
        transition: all var(--transition-base);
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        max-height: calc(100vh - 4.5rem);
        overflow-y: auto;
    }
    
    .mobile-menu-open .navbar-menu {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
    }
    
    .navbar-nav {
        flex-direction: column;
        gap: 0;
        width: 100%;
        margin-bottom: 2rem;
    }
    
    .nav-item {
        width: 100%;
    }
    
    .nav-link {
        padding: 1rem 0;
        border-bottom: 1px solid var(--gray-100);
    }
    
    .nav-link::after {
        display: none;
    }
    
    .dropdown-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        border: none;
        border-radius: 0;
        padding: 0 1rem;
        margin: 0;
        background: var(--gray-50);
    }
    
    .navbar-cta {
        width: 100%;
        justify-content: center;
        flex-direction: column;
        gap: 1rem;
    }
    
    .navbar-cta .btn {
        width: 100%;
    }
    
    /* Hero Section */
    .hero {
        padding: 4rem 0;
    }
    
    .hero-title {
        font-size: 2.5rem;
        line-height: 1.2;
    }
    
    .hero-subtitle {
        font-size: 1.125rem;
    }
    
    .hero-cta {
        flex-direction: column;
        align-items: stretch;
    }
    
    .hero-cta .btn {
        width: 100%;
    }
    
    /* Section adjustments */
    .section {
        padding: 3rem 0;
    }
    
    .section-header {
        margin-bottom: 3rem;
    }
    
    .section-title {
        font-size: 2rem;
    }
    
    .section-subtitle {
        font-size: 1rem;
    }
    
    /* Grid adjustments */
    .grid-2,
    .grid-3,
    .grid-4,
    .grid-5,
    .grid-6 {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .feature-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .pricing-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    /* Cards */
    .feature-card {
        padding: 1.5rem;
    }
    
    .pricing-card {
        padding: 1.5rem;
    }
    
    .pricing-card.featured {
        transform: none;
    }
    
    /* Forms */
    .contact-form {
        padding: 1.5rem;
    }
    
    .form-group {
        margin-bottom: 1.5rem;
    }
    
    /* Buttons */
    .btn-group {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-group .btn {
        width: 100%;
        border-radius: 0.5rem;
    }
    
    /* Tables */
    table {
        font-size: 0.875rem;
    }
    
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Footer */
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .footer-bottom-content {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    
    .footer-legal {
        justify-content: center;
    }
    
    .newsletter-input-group {
        flex-direction: column;
    }
    
    .newsletter-btn {
        justify-content: center;
        width: 100%;
    }
    
    /* Feature Pills */
    .feature-pills {
        gap: 0.5rem;
    }
    
    .pill {
        font-size: 0.75rem;
        padding: 0.375rem 0.75rem;
    }
    
    /* Back to top */
    .back-to-top {
        bottom: 1rem;
        right: 1rem;
        width: 2.5rem;
        height: 2.5rem;
    }
    
    /* Modals */
    .modal-dialog {
        margin: 1rem;
        max-width: calc(100% - 2rem);
    }
    
    /* Stats */
    .stat-card {
        padding: 1rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    /* Timeline */
    .timeline::before {
        left: 1rem;
    }
    
    .timeline-item {
        padding-left: 3rem;
    }
    
    .timeline-marker {
        left: 0.5rem;
    }
    
    /* Tabs */
    .tabs-list {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }
    
    .tab-button {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }
    
    /* Currency toggle */
    .currency-toggle {
        padding: 0.5rem 1rem;
        font-size: 0.75rem;
    }
    
    /* Comparison table */
    .comparison-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
    
    /* Dashboard components */
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .chart-bars {
        height: 200px;
    }
    
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    /* Mobile specific utilities */
    .hide-mobile {
        display: none;
    }
    
    .show-mobile {
        display: block;
    }
}

/* ===== SMALL DEVICES / LANDSCAPE PHONES (max-width: 640px) ===== */
@media (max-width: 640px) {
    /* Grid adjustments */
    .kpi-grid {
        grid-template-columns: 1fr;
    }
    
    /* Pricing */
    .pricing-price {
        font-size: 2.5rem;
    }
    
    /* Forms */
    .contact-form > div[style*="grid"] {
        grid-template-columns: 1fr !important;
    }
    
    /* Buttons */
    .btn-lg {
        padding: 0.875rem 1.5rem;
        font-size: 1rem;
    }
    
    /* Footer */
    .social-links {
        justify-content: center;
    }
    
    /* Feature comparison */
    .feature-comparison {
        font-size: 0.75rem;
    }
}

/* ===== EXTRA SMALL DEVICES / PORTRAIT PHONES (max-width: 475px) ===== */
@media (max-width: 475px) {
    /* Typography */
    .hero-title {
        font-size: 2rem;
    }
    
    .section-title {
        font-size: 1.75rem;
    }
    
    /* Spacing */
    .section {
        padding: 2.5rem 0;
    }
    
    /* Hero */
    .hero {
        padding: 3rem 0;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    /* Cards */
    .card {
        border-radius: 0.5rem;
    }
    
    .feature-card {
        padding: 1.25rem;
        text-align: left;
    }
    
    .feature-icon {
        margin: 0 0 1rem 0;
    }
    
    /* Pricing */
    .pricing-card {
        padding: 1.25rem;
    }
    
    .pricing-price {
        font-size: 2rem;
    }
    
    .pricing-features {
        font-size: 0.875rem;
    }
    
    /* Forms */
    .form-input,
    .form-textarea,
    .form-select {
        font-size: 16px; /* Prevent zoom on iOS */
    }
    
    /* Buttons */
    .btn {
        padding: 0.625rem 1.25rem;
        font-size: 0.875rem;
    }
    
    .btn-sm {
        padding: 0.5rem 0.875rem;
        font-size: 0.8125rem;
    }
    
    /* Footer */
    .footer-legal {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    /* Back to top */
    .back-to-top {
        bottom: 0.75rem;
        right: 0.75rem;
    }
    
    /* Stats */
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    /* Breadcrumb */
    .breadcrumb {
        font-size: 0.8125rem;
    }
    
    /* Pagination */
    .page-link {
        padding: 0.375rem 0.5rem;
        font-size: 0.875rem;
    }
    
    /* Testimonials */
    .testimonial-card {
        padding: 1.25rem;
    }
    
    .testimonial-text {
        font-size: 0.875rem;
    }
    
    /* Feature Pills */
    .feature-pills {
        gap: 0.375rem;
    }
    
    .pill {
        font-size: 0.6875rem;
        padding: 0.25rem 0.5rem;
    }
    
    /* Mobile mockup */
    .phone-mockup {
        transform: scale(0.8);
    }
}

/* ===== LANDSCAPE ORIENTATION ===== */
@media (orientation: landscape) and (max-height: 600px) {
    .hero {
        padding: 2rem 0;
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
        margin-bottom: 1rem;
    }
    
    .navbar {
        padding: 0.5rem 0;
    }
    
    .mobile-menu-open .navbar-menu {
        max-height: calc(100vh - 3rem);
    }
}

/* ===== HIGH DPI SCREENS ===== */
@media (-webkit-min-device-pixel-ratio: 2),
       (min-resolution: 192dpi) {
    /* Use higher resolution images */
    .hero::before {
        background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 200">...</svg>');
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    /* Hide navigation and interactive elements */
    .navbar,
    .footer,
    .back-to-top,
    .mobile-menu-toggle,
    .btn,
    .newsletter-form,
    .social-links,
    .breadcrumb-nav {
        display: none !important;
    }
    
    /* Reset colors for print */
    body {
        color: #000;
        background: #fff;
        font-size: 12pt;
        line-height: 1.5;
    }
    
    /* Page breaks */
    .section {
        page-break-inside: avoid;
    }
    
    h1, h2, h3, h4, h5, h6 {
        page-break-after: avoid;
    }
    
    /* Links */
    a {
        color: #000;
        text-decoration: underline;
    }
    
    a[href^="http"]:after {
        content: " (" attr(href) ")";
        font-size: 10pt;
    }
    
    /* Images */
    img {
        max-width: 100% !important;
    }
}

/* ===== ACCESSIBILITY ===== */
@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;
    }
}

@media (prefers-color-scheme: dark) {
    /* Add dark mode styles here if needed */
}

/* ===== UTILITIES FOR RESPONSIVE ===== */
/* Hide on mobile */
@media (max-width: 768px) {
    .hide-mobile { display: none !important; }
    .show-mobile { display: block !important; }
}

/* Hide on tablet */
@media (max-width: 1024px) and (min-width: 769px) {
    .hide-tablet { display: none !important; }
    .show-tablet { display: block !important; }
}

/* Hide on desktop */
@media (min-width: 1025px) {
    .hide-desktop { display: none !important; }
    .show-desktop { display: block !important; }
}