/* ==================== Tablet (768px and down) ==================== */
@media (max-width: 768px) {
    .header {
        padding: 15px;
    }

    .header h1 {
        font-size: 24px;
    }

    .main-content {
        padding: 15px;
    }

    .projects-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 15px;
    }

    .detail-info {
        grid-template-columns: 1fr;
    }

    .modal-content {
        max-height: 85vh;
    }
}

/* ==================== Mobile (480px and down) ==================== */
@media (max-width: 480px) {
    html, body {
        font-size: 14px;
    }

    .header h1 {
        font-size: 20px;
    }

    .subtitle {
        font-size: 12px;
    }

    .main-content {
        padding: 12px;
    }

    .projects-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .featured-carousel {
        grid-template-columns: 1fr;
    }

    .project-card-image {
        height: 150px;
    }

    .project-card-title {
        font-size: 14px;
    }

    .filters-dropdown {
        max-height: 400px;
    }

    .filter-options {
        gap: 6px;
    }

    .filter-option {
        padding: 6px 10px;
        font-size: 12px;
    }

    .pagination {
        flex-wrap: wrap;
        gap: 10px;
    }

    .btn-primary, .btn-secondary {
        padding: 10px 20px;
        font-size: 13px;
        width: 100%;
    }

    .pagination button {
        flex: 1;
        min-width: 100px;
    }

    .modal-content {
        border-radius: 16px 16px 0 0;
        padding: 15px;
        max-height: 80vh;
    }

    .modal-close {
        top: 12px;
        right: 12px;
        font-size: 20px;
    }

    .notification {
        left: 10px;
        right: 10px;
        bottom: 10px;
        padding: 12px 15px;
        font-size: 13px;
    }

    .form-group input,
    .form-group select {
        padding: 10px;
        font-size: 16px;
    }

    .price-inputs {
        gap: 8px;
    }

    .unit-item {
        padding: 10px;
    }
}

/* ==================== Very small devices (320px and down) ==================== */
@media (max-width: 320px) {
    .header h1 {
        font-size: 18px;
    }

    .projects-grid {
        grid-template-columns: 1fr;
    }

    .filter-option {
        padding: 5px 8px;
        font-size: 11px;
    }

    .btn-primary, .btn-secondary {
        padding: 8px 16px;
        font-size: 12px;
    }

    .pagination {
        gap: 5px;
    }

    .pagination button {
        min-width: 80px;
        padding: 8px 12px;
    }

    .page-info {
        font-size: 12px;
    }
}

/* ==================== Landscape Mode ==================== */
@media (max-height: 500px) and (orientation: landscape) {
    .header {
        padding: 10px;
    }

    .header h1 {
        font-size: 18px;
        margin-bottom: 2px;
    }

    .subtitle {
        font-size: 11px;
    }

    .main-content {
        padding: 10px;
    }

    .featured-section {
        margin-bottom: 15px;
    }

    .featured-section h2,
    .projects-section h2 {
        font-size: 16px;
        margin-bottom: 8px;
    }

    .projects-grid {
        gap: 10px;
        margin-bottom: 15px;
    }

    .project-card-image {
        height: 120px;
    }

    .modal-content {
        max-height: 90vh;
    }
}

/* ==================== High DPI (Retina) ==================== */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .project-card {
        border-width: 1px;
    }
}

/* ==================== Print Styles ==================== */
@media print {
    .header,
    .filters-panel,
    .pagination,
    .modal,
    .notification,
    .modal-close,
    .filters-toggle {
        display: none !important;
    }

    body {
        background-color: white;
        color: black;
    }

    .projects-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .project-card {
        border: 1px solid #ccc;
        page-break-inside: avoid;
    }
}
