/* ============================================
   EDESON VIDEO DOWNLOADER APP - Responsive
   ============================================ */

/* --- Tablet (768px - 1024px) --- */
@media (max-width: 1024px) {
    :root {
        --header-height: 68px;
    }

    .container {
        padding: 0 var(--space-lg);
    }

    .hero h1 {
        font-size: 2.2rem;
    }

    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-xl);
    }

    .video-info-card {
        grid-template-columns: 240px 1fr;
    }

    .ad-banner {
        max-width: 728px;
        height: 90px;
    }

    .sites-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }

    .format-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }
}

/* --- Mobile Large (max-width: 768px) --- */
@media (max-width: 768px) {
    :root {
        --header-height: 64px;
    }

    .container {
        padding: 0 var(--space-md);
    }

    /* Header */
    .header-inner {
        padding: 0 var(--space-md);
    }

    .logo-text {
        font-size: 1rem;
    }

    .hamburger {
        display: flex;
    }

    .nav-menu {
        position: fixed;
        top: var(--header-height);
        left: 0;
        right: 0;
        bottom: 0;
        background: var(--bg-primary);
        flex-direction: column;
        align-items: stretch;
        padding: var(--space-lg);
        gap: var(--space-xs);
        transform: translateX(100%);
        transition: transform var(--transition-base);
        z-index: var(--z-header);
        overflow-y: auto;
    }

    .nav-menu.active {
        transform: translateX(0);
    }

    .nav-link {
        padding: 0.85rem 1rem;
        font-size: 1.05rem;
        border-radius: var(--radius-md);
    }

    /* Ad Banner */
    .ad-banner {
        height: 60px;
        font-size: 0.75rem;
    }

    /* Hero */
    .hero {
        padding: var(--space-xl) 0 var(--space-lg);
    }

    .hero h1 {
        font-size: 1.8rem;
    }

    .hero p {
        font-size: 1rem;
    }

    /* URL Input */
    .url-input-wrapper {
        flex-direction: column;
        padding: var(--space-sm);
    }

    .url-input-wrapper input {
        width: 100%;
        text-align: center;
        padding: 0.85rem;
    }

    .btn-download {
        width: 100%;
        justify-content: center;
        padding: 0.85rem;
    }

    /* Video Info */
    .video-info-card {
        grid-template-columns: 1fr;
        max-width: 100%;
    }

    .video-thumbnail {
        max-width: 100%;
    }

    /* Format Grid */
    .format-grid {
        grid-template-columns: 1fr 1fr;
    }

    /* Download Manager */
    .download-item {
        grid-template-columns: auto 1fr;
        gap: var(--space-sm);
    }

    .download-item-actions {
        grid-column: 1 / -1;
        justify-content: flex-end;
    }

    /* Sites Grid */
    .sites-grid {
        grid-template-columns: 1fr;
    }

    /* Footer */
    .footer-grid {
        grid-template-columns: 1fr;
        gap: var(--space-xl);
    }

    .footer-bottom {
        flex-direction: column;
        text-align: center;
    }

    /* Notifications */
    .notification-container {
        right: var(--space-md);
        left: var(--space-md);
    }

    .notification {
        min-width: unset;
        max-width: 100%;
    }

    /* Page Title */
    .page-title h1 {
        font-size: 1.6rem;
    }

    .page-title p {
        font-size: 0.95rem;
    }

    /* Section Title */
    .section-title {
        font-size: 1.25rem;
    }

    /* Search */
    .search-wrapper {
        max-width: 100%;
    }

    /* Guide Steps */
    .guide-step {
        gap: var(--space-md);
    }

    /* About */
    .about-contact-grid {
        grid-template-columns: 1fr;
    }

    /* History Table - Switch to card layout */
    .history-table,
    .history-table thead,
    .history-table tbody,
    .history-table th,
    .history-table td,
    .history-table tr {
        display: block;
    }

    .history-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
    }

    .history-table tbody tr {
        background: var(--bg-card);
        border: 1px solid var(--border);
        border-radius: var(--radius-md);
        padding: var(--space-md);
        margin-bottom: var(--space-sm);
    }

    .history-table tbody td {
        padding: var(--space-xs) 0;
        border-bottom: none;
        text-align: right;
    }

    .history-table tbody td::before {
        content: attr(data-label);
        float: left;
        font-weight: 600;
        color: var(--text-muted);
        font-size: 0.82rem;
        text-transform: uppercase;
    }

    .history-thumb {
        width: 100%;
        height: auto;
        aspect-ratio: 16/9;
        margin-bottom: var(--space-sm);
    }
}

/* --- Mobile Small (max-width: 480px) --- */
@media (max-width: 480px) {
    .hero h1 {
        font-size: 1.5rem;
    }

    .hero p {
        font-size: 0.9rem;
    }

    .hero-badge {
        font-size: 0.78rem;
    }

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

    .category-filters {
        gap: var(--space-xs);
    }

    .category-btn {
        padding: 0.35rem 0.75rem;
        font-size: 0.8rem;
    }

    .btn {
        padding: 0.55rem 1.1rem;
        font-size: 0.85rem;
    }

    .btn-lg {
        padding: 0.75rem 1.5rem;
        font-size: 0.95rem;
    }

    .card {
        padding: var(--space-lg);
    }

    .download-item {
        padding: var(--space-md);
    }

    .footer-col h4 {
        font-size: 0.95rem;
    }
}

/* --- Large Desktop (min-width: 1400px) --- */
@media (min-width: 1400px) {
    .container {
        max-width: 1320px;
    }

    .hero h1 {
        font-size: 3.2rem;
    }
}

/* --- Reduced Motion (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;
    }
}

/* --- High Contrast (Accessibility) --- */
@media (prefers-contrast: high) {
    :root {
        --border: #000000;
        --text-secondary: #333333;
        --text-muted: #555555;
    }

    body.dark-mode {
        --border: #ffffff;
        --text-secondary: #cccccc;
        --text-muted: #aaaaaa;
    }

    .btn:focus-visible,
    a:focus-visible,
    button:focus-visible {
        outline-width: 3px;
    }
}

/* --- Print --- */
@media print {
    .header,
    .footer,
    .ad-banner,
    .theme-toggle,
    .hamburger,
    .notification-container {
        display: none !important;
    }

    .main-content {
        padding-top: 0;
    }

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