/* Responsive Design for Conjunto Residencial Girasol */

/* Mobile First Approach */

/* Scroll to Top Button Responsive */
@media (max-width: 768px) {
    #scroll-to-top {
        bottom: 80px;
        right: 20px;
        width: 48px;
        height: 48px;
        padding: 12px;
    }
    
    #scroll-to-top svg {
        width: 20px;
        height: 20px;
    }
}

/* Extra Small devices (phones, 576px and down) */
@media (max-width: 575.98px) {
    /* Typography */
    .text-responsive-xl {
        font-size: 1.5rem;
        line-height: 1.3;
    }
    
    .text-responsive-lg {
        font-size: 1.25rem;
        line-height: 1.4;
    }
    
    .text-responsive-md {
        font-size: 1rem;
        line-height: 1.5;
    }

    /* Header */
    #header .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    #header .flex {
        flex-direction: column;
        align-items: flex-start;
    }
    
    #header .hidden {
        display: block;
    }

    /* Hero Section */
    .hero-content h1 {
        font-size: 2.5rem;
        line-height: 1.2;
    }
    
    .hero-content p {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }

    /* Cards */
    .card-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .card {
        padding: 1rem;
    }

    /* Forms */
    .form-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .form-input {
        font-size: 16px; /* Prevent zoom on iOS */
    }

    /* Modals */
    .modal-content {
        margin: 1rem;
        max-height: calc(100vh - 2rem);
    }

    /* Navigation */
    .nav-links {
        flex-direction: column;
        width: 100%;
        margin-top: 1rem;
    }
    
    .nav-links a {
        padding: 0.75rem 0;
        border-bottom: 1px solid #e5e7eb;
    }

    /* Footer */
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }
}

/* Small devices (landscape phones, 576px and up) */
@media (min-width: 576px) and (max-width: 767.98px) {
    .card-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }
    
    .hero-content h1 {
        font-size: 3rem;
    }
    
    .form-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) and (max-width: 991.98px) {
    .card-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }
    
    .hero-content h1 {
        font-size: 4rem;
    }
    
    .form-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .news-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .documents-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Large devices (desktops, 992px and up) */
@media (min-width: 992px) and (max-width: 1199.98px) {
    .card-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 2rem;
    }
    
    .news-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .documents-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Extra large devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
    .container {
        max-width: 1200px;
    }
    
    .card-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 2.5rem;
    }
    
    .news-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .documents-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Landscape orientation adjustments */
@media (orientation: landscape) and (max-height: 500px) {
    .hero-section {
        min-height: 100vh;
    }
    
    .hero-content {
        padding: 2rem 0;
    }
    
    .hero-content h1 {
        font-size: 2rem;
        margin-bottom: 1rem;
    }
    
    .hero-content p {
        font-size: 0.9rem;
        margin-bottom: 1rem;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .logo img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    .print-only {
        display: block !important;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.4;
        color: #000;
        background: #fff;
    }
    
    .container {
        max-width: none;
        margin: 0;
        padding: 0;
    }
    
    .card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    a {
        text-decoration: underline;
    }
    
    .hero-section {
        min-height: auto;
        padding: 2rem 0;
    }
}

/* Accessibility - Reduced motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .carousel-slide {
        transition: none !important;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .dark-mode {
        background-color: #1a1a1a;
        color: #ffffff;
    }
    
    .dark-mode .card {
        background-color: #2d2d2d;
        border-color: #404040;
    }
    
    .dark-mode .form-input {
        background-color: #2d2d2d;
        border-color: #404040;
        color: #ffffff;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .hover-effect:hover {
        transform: none;
    }
    
    .button {
        min-height: 44px;
        min-width: 44px;
    }
    
    .nav-link {
        padding: 1rem;
    }
    
    .card {
        padding: 1.5rem;
    }
}

/* Specific component responsive adjustments */

/* Carousel responsive */
@media (max-width: 768px) {
    .carousel-controls {
        display: none;
    }
    
    .carousel-indicators {
        bottom: 1rem;
    }
    
    .carousel-indicator {
        width: 8px;
        height: 8px;
    }
}

/* News cards responsive */
@media (max-width: 640px) {
    .news-card img {
        height: 200px;
    }
    
    .news-card .p-6 {
        padding: 1rem;
    }
}

/* Document cards responsive */
@media (max-width: 640px) {
    .document-card {
        padding: 1rem;
    }
    
    .document-card .flex {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .document-card .text-4xl {
        font-size: 2rem;
        margin-bottom: 1rem;
    }
}

/* Form responsive */
@media (max-width: 640px) {
    .form-row {
        flex-direction: column;
    }
    
    .form-row .form-group {
        width: 100%;
        margin-bottom: 1rem;
    }
}

/* Modal responsive */
@media (max-width: 640px) {
    .modal {
        margin: 0.5rem;
        max-height: calc(100vh - 1rem);
    }
    
    .modal-content {
        padding: 1rem;
    }
}

/* Navigation responsive */
@media (max-width: 768px) {
    /* Hide desktop navigation on mobile */
    .desktop-nav {
        display: none !important;
    }
    
    /* Hide desktop text on mobile */
    .header-text {
        display: none !important;
    }
    
    /* Position mobile menu button in top right corner */
    #mobile-menu-btn {
        display: block !important;
        position: absolute;
        top: 50%;
        right: 1rem;
        transform: translateY(-50%);
        margin: 0;
        padding: 0.5rem;
        z-index: 60;
    }
    
    /* Ensure header container has relative positioning and proper height */
    nav .flex.items-center.justify-between {
        position: relative;
        align-items: center;
        min-height: 60px;
        background: white;
        padding: 0.75rem 1rem;
    }
    
    /* Position logo in top left corner */
    nav .flex.items-center.justify-between > div:first-child {
        position: absolute;
        top: 50%;
        left: 1rem;
        transform: translateY(-50%);
        align-self: center;
        padding: 0;
        z-index: 60;
    }
    
    #mobile-menu {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: white;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        border-top: 1px solid #e5e7eb;
        z-index: 50;
    }
    
    #mobile-menu.hidden {
        display: none !important;
    }
    
    #mobile-menu a {
        display: block;
        padding: 1rem;
        border-bottom: 1px solid #e5e7eb;
        transition: background-color 0.2s ease;
    }
    
    #mobile-menu a:hover {
        background-color: #f9fafb;
    }
    
    #mobile-menu a:last-child {
        border-bottom: none;
    }
    
    /* Adjust main content padding for mobile */
    main {
        padding-top: 4rem !important;
    }
}

/* Footer responsive */
@media (max-width: 640px) {
    .footer {
        padding: 2rem 0;
    }
    
    .footer .grid {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }
    
    .footer .social-links {
        justify-content: center;
    }
}

/* Utility classes for responsive design */
.hidden-mobile {
    display: block;
}

.hidden-tablet {
    display: block;
}

.hidden-desktop {
    display: none;
}

@media (max-width: 767.98px) {
    .hidden-mobile {
        display: none !important;
    }
    
    .show-mobile {
        display: block !important;
    }
}

@media (min-width: 768px) and (max-width: 991.98px) {
    .hidden-tablet {
        display: none !important;
    }
    
    .show-tablet {
        display: block !important;
    }
}

@media (min-width: 992px) {
    .hidden-desktop {
        display: none !important;
    }
    
    .show-desktop {
        display: block !important;
    }
}

/* Container responsive */
.container-responsive {
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1rem;
    padding-right: 1rem;
}

@media (min-width: 576px) {
    .container-responsive {
        max-width: 540px;
    }
}

@media (min-width: 768px) {
    .container-responsive {
        max-width: 720px;
    }
}

@media (min-width: 992px) {
    .container-responsive {
        max-width: 960px;
    }
}

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

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

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

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

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