/**
 * Apple Dark Theme - Responsive Styles
 *
 * @package Apple_Dark
 * @since 1.0.0
 * 
 * Mobile and tablet responsive design
 */

/* ========================================
   Tablet (max-width: 768px)
   ======================================== */

@media (max-width: 768px) {
    :root {
        --spacing-lg: 1.5rem;
        --spacing-xl: 2rem;
    }

    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.625rem;
    }

    h3 {
        font-size: 1.25rem;
    }

    .container {
        grid-template-columns: 1fr;
        gap: var(--spacing-lg);
        padding: var(--spacing-lg) var(--spacing-md);
    }

    .sidebar {
        position: static;
        top: auto;
    }

    .header-container {
        flex-wrap: wrap;
        padding: var(--spacing-md);
        gap: var(--spacing-md);
    }

    .site-branding {
        flex: 1;
        min-width: 200px;
    }

    .site-title {
        font-size: 1.5rem;
    }

    .site-description {
        font-size: 0.7rem;
    }

    .primary-menu-wrapper {
        display: none !important;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        width: 100%;
        max-height: calc(100vh - 70px);
        overflow-y: auto;
        background: linear-gradient(180deg, #ffffff 0%, #f8fff8 100%);
        padding: 0.5rem 0;
        box-shadow: 0 8px 24px rgba(46, 211, 151, 0.2), 0 2px 8px rgba(0, 0, 0, 0.1);
        z-index: 999;
        border-top: 3px solid #2ed397;
        border-bottom: 1px solid rgba(46, 211, 151, 0.2);
    }

    .primary-menu-wrapper.active {
        display: block !important;
        animation: slideDown 0.3s ease;
    }

    @keyframes slideDown {
        from {
            opacity: 0;
            transform: translateY(-20px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .primary-menu {
        flex-direction: column;
        gap: 0;
        width: 100%;
    }

    .primary-menu>li {
        border-bottom: 1px solid rgba(46, 211, 151, 0.1);
    }

    .primary-menu>li:last-child {
        border-bottom: none;
    }

    .primary-menu>li>a {
        width: 100%;
        display: block;
        text-align: left;
        padding: 1rem 1.5rem;
        color: #333333 !important;
        font-size: 1rem;
        font-weight: 500;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        position: relative;
    }

    .primary-menu>li>a:hover,
    .primary-menu>li>a:focus {
        background: linear-gradient(90deg, rgba(46, 211, 151, 0.08) 0%, transparent 100%);
        color: #1a5f2a !important;
        padding-left: 1.75rem;
        border-left: 4px solid #2ed397;
    }

    .primary-menu>li>a::after {
        display: none;
    }

    .primary-menu>li.current-menu-item>a,
    .primary-menu>li.current_page_item>a {
        background: linear-gradient(90deg, rgba(46, 211, 151, 0.12) 0%, transparent 100%);
        color: #1a5f2a !important;
        font-weight: 600;
        border-left: 4px solid #2ed397;
    }

    .primary-menu .sub-menu {
        position: static;
        display: none;
        min-width: auto;
        margin: 0;
        padding: 0.25rem 0;
        border: none;
        background: rgba(46, 211, 151, 0.05);
        border-left: 3px solid rgba(46, 211, 151, 0.3);
    }

    .primary-menu .sub-menu li {
        border-bottom: 1px solid rgba(46, 211, 151, 0.08);
    }

    .primary-menu .sub-menu li a {
        padding: 0.875rem 1.5rem 0.875rem 2.75rem;
        font-size: 0.95rem;
        color: #555555 !important;
    }

    .primary-menu .sub-menu li a:hover,
    .primary-menu .sub-menu li a:focus {
        background: linear-gradient(90deg, rgba(46, 211, 151, 0.15) 0%, transparent 100%);
        color: #1a5f2a !important;
        padding-left: 3rem;
    }

    .primary-menu>li:hover .sub-menu {
        display: none;
    }

    .primary-menu>li.active .sub-menu {
        display: block;
        animation: slideDown 0.2s ease;
    }

    .primary-menu .menu-item-has-children>a::before {
        content: '▼';
        float: right;
        font-size: 0.75rem;
        transition: transform 0.3s ease;
        color: #2ed397;
        opacity: 0.8;
        margin-left: 0.5rem;
    }

    .primary-menu .menu-item-has-children.active>a::before {
        transform: rotate(180deg);
        color: #1a5f2a;
        opacity: 1;
    }

    .menu-toggle {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        order: 2;
        width: 48px;
        height: 48px;
        padding: 10px;
        background: linear-gradient(135deg, rgba(46, 211, 151, 0.1) 0%, rgba(26, 95, 42, 0.1) 100%);
        border: 2px solid rgba(46, 211, 151, 0.2);
        border-radius: 10px;
        transition: all 0.3s ease;
        position: relative;
        z-index: 1000;
    }

    .menu-toggle:hover,
    .menu-toggle:focus {
        background: linear-gradient(135deg, rgba(46, 211, 151, 0.2) 0%, rgba(26, 95, 42, 0.15) 100%);
        border-color: rgba(46, 211, 151, 0.4);
        transform: scale(1.05);
    }

    .menu-toggle:focus {
        outline: 2px solid #2ed397;
        outline-offset: 3px;
    }

    .menu-toggle .line {
        width: 24px;
        height: 3px;
        background: linear-gradient(90deg, #2ed397 0%, #1a5f2a 100%);
        border-radius: 2px;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 0 1px 2px rgba(46, 211, 151, 0.3);
    }

    /* Hero Slider Mobile */
    .hero-slider {
        height: 300px;
    }

    .hero-content h1 {
        font-size: 2.5rem;
    }

    .hero-content .hero-subtitle {
        font-size: 1.1rem;
    }

    .hero-content .btn-hero {
        padding: 1.2rem 3rem;
        font-size: 1.1rem;
    }

    .slider-dots {
        bottom: 20px;
        right: 20px;
    }

    /* Sections Mobile */
    .section-row {
        grid-template-columns: 1fr;
        gap: 2rem;
        padding: 2rem 1rem;
    }

    .about-two-column {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .offer-item {
        flex-direction: column;
        gap: 1rem;
    }

    .menu-toggle.active {
        background: linear-gradient(135deg, rgba(46, 211, 151, 0.3) 0%, rgba(26, 95, 42, 0.2) 100%);
        border-color: #2ed397;
    }

    .menu-toggle.active .line {
        background: linear-gradient(90deg, #1a5f2a 0%, #2ed397 100%);
    }

    .menu-toggle.active .line-1 {
        transform: translateY(9px) rotate(45deg);
    }

    .menu-toggle.active .line-2 {
        opacity: 0;
        transform: scaleX(0);
    }

    .menu-toggle.active .line-3 {
        transform: translateY(-9px) rotate(-45deg);
    }

    .footer-bottom {
        flex-direction: column;
        align-items: flex-start;
    }

    .footer-widgets {
        grid-template-columns: 1fr 1fr;
        gap: var(--spacing-lg);
    }

    .entry-image {
        max-height: 300px;
    }

    .featured-image {
        max-height: 400px;
    }

    .site-title {
        font-size: 1.25rem;
    }

    .error-404 h1 {
        font-size: 2.5rem;
    }

    .entry-meta {
        font-size: 0.8rem;
        gap: var(--spacing-sm);
    }
}

/* ========================================
   Mobile (max-width: 480px)
   ======================================== */

@media (max-width: 480px) {
    :root {
        --font-size-base: 14px;
        --spacing-md: 1rem;
        --spacing-lg: 1.5rem;
        --spacing-xl: 2rem;
    }

    h1 {
        font-size: 1.75rem;
        letter-spacing: 0;
    }

    h2 {
        font-size: 1.375rem;
    }

    h3 {
        font-size: 1.125rem;
    }

    h4 {
        font-size: 1rem;
    }

    body {
        line-height: 1.5;
    }

    .container {
        grid-template-columns: 1fr;
        padding: var(--spacing-lg) var(--spacing-sm);
    }

    .header-container {
        gap: var(--spacing-sm);
        padding: var(--spacing-md) var(--spacing-sm);
    }

    .site-branding {
        gap: var(--spacing-sm);
    }

    .site-title {
        font-size: 1.125rem;
    }

    .site-description {
        display: none;
    }

    .primary-menu-wrapper {
        margin-top: var(--spacing-sm);
    }

    .primary-menu {
        gap: var(--spacing-sm);
    }

    .menu-toggle {
        padding: var(--spacing-xs) / 2;
    }

    .menu-toggle .line {
        width: 20px;
        height: 2px;
        margin: 4px 0;
    }

    .entry-header {
        margin-bottom: var(--spacing-sm);
    }

    .entry-meta {
        flex-direction: column;
        gap: var(--spacing-sm);
        font-size: 0.75rem;
    }

    .entry-image {
        max-height: 200px;
        margin: var(--spacing-md) -var(--spacing-sm);
        border-radius: 0;
    }

    .featured-image {
        max-height: 250px;
    }

    .error-404 h1 {
        font-size: 2rem;
    }

    .error-404 p {
        font-size: 0.95rem;
    }

    .pagination {
        gap: var(--spacing-xs);
    }

    .pagination a,
    .pagination span,
    .page-numbers {
        min-width: 36px;
        height: 36px;
        font-size: 0.875rem;
    }

    .footer-widgets {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }

    .footer-bottom {
        gap: var(--spacing-md);
    }

    .footer-menu {
        flex-wrap: wrap;
        gap: var(--spacing-sm);
    }

    .btn {
        width: 100%;
        padding: var(--spacing-sm);
    }

    input[type="text"],
    input[type="email"],
    input[type="url"],
    input[type="number"],
    textarea,
    select {
        padding: var(--spacing-xs);
        font-size: 16px;
    }

    button,
    input[type="button"],
    input[type="submit"] {
        width: 100%;
        padding: var(--spacing-sm);
        font-size: 1rem;
    }

    .comment {
        padding: var(--spacing-md);
        margin-bottom: var(--spacing-sm);
    }

    .children {
        margin: var(--spacing-md) 0 0 var(--spacing-md);
    }

    .search-form {
        flex-direction: column;
    }

    .search-form button {
        width: 100%;
    }

    .widget {
        padding: var(--spacing-md);
        margin-bottom: var(--spacing-md);
    }

    .widget-title {
        font-size: 1rem;
    }

    .archive-header,
    .search-header {
        margin-bottom: var(--spacing-md);
        padding-bottom: var(--spacing-md);
    }

    .entry-title {
        font-size: 1.25rem;
    }

    .archive-title,
    .search-header h1 {
        font-size: 1.5rem;
    }

    .archive-description {
        font-size: 1rem;
    }

    table {
        font-size: 0.875rem;
    }

    .wp-block-image,
    .wp-block-gallery,
    .wp-block-video {
        margin: var(--spacing-md) 0;
    }

    blockquote {
        margin: var(--spacing-md) 0;
        padding-left: var(--spacing-sm);
        border-left-width: 3px;
    }

    pre {
        padding: var(--spacing-sm);
        margin: var(--spacing-md) 0;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    code {
        font-size: 0.8rem;
    }
}

/* ========================================
   Small Mobile (max-width: 360px)
   ======================================== */

@media (max-width: 360px) {
    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.25rem;
    }

    h3 {
        font-size: 1rem;
    }

    .site-title {
        font-size: 1rem;
    }

    .container {
        padding: var(--spacing-md) var(--spacing-xs);
    }

    .header-container {
        padding: var(--spacing-sm) var(--spacing-xs);
    }

    .menu-toggle .line {
        width: 18px;
    }

    .footer-credits {
        font-size: 0.75rem;
    }

    .footer-menu a {
        font-size: 0.75rem;
    }

    .pagination a,
    .pagination span,
    .page-numbers {
        min-width: 32px;
        height: 32px;
        font-size: 0.75rem;
    }

    .btn {
        font-size: 0.95rem;
    }

    .entry-footer {
        margin-top: var(--spacing-md);
        padding-top: var(--spacing-md);
    }

    .entry-tags {
        gap: var(--spacing-xs);
    }

    .tag {
        padding: var(--spacing-xs) var(--spacing-xs);
        font-size: 0.75rem;
    }

    .comment {
        padding: var(--spacing-sm);
        border-left-width: 2px;
    }

    table {
        font-size: 0.75rem;
    }

    .wp-caption {
        padding: var(--spacing-xs);
    }
}

/* ========================================
   Extra Small Devices (max-width: 375px)
   ======================================== */

@media (max-width: 375px) {
    h1 {
        font-size: 1.75rem;
    }

    h2 {
        font-size: 1.375rem;
    }

    .container {
        padding: 1rem 0.75rem;
    }

    .header-container {
        padding: 0.75rem;
    }

    .site-logo-image {
        max-height: 40px;
    }

    .menu-toggle {
        width: 40px;
        height: 40px;
        padding: 8px;
    }

    .menu-toggle .line {
        width: 20px;
    }

    .primary-menu-wrapper {
        top: 60px;
        max-height: calc(100vh - 60px);
    }

    .primary-menu>li>a {
        padding: 0.875rem 1rem;
        font-size: 0.95rem;
    }

    .hero-slider {
        height: 250px;
    }

    .hero-content h1 {
        font-size: 1.75rem;
    }

    .hero-content .hero-subtitle {
        font-size: 0.95rem;
    }

    .btn-hero {
        padding: 0.7rem 1.5rem;
        font-size: 0.85rem;
    }
}

/* ========================================
   Large Desktop (min-width: 1440px)
   ======================================== */

@media (min-width: 1440px) {
    .container {
        max-width: 1400px;
    }

    .header-container {
        max-width: 1400px;
        margin: 0 auto;
    }

    .hero-slider {
        height: 650px;
    }

    .hero-content h1 {
        font-size: 4.5rem;
    }

    .hero-content .hero-subtitle {
        font-size: 1.5rem;
    }
}

/* ========================================
   Touch Device Optimizations
   ======================================== */

@media (hover: none) and (pointer: coarse) {
    /* Increase touch targets */
    a,
    button,
    input[type="button"],
    input[type="submit"],
    .menu-toggle {
        min-height: 44px;
        min-width: 44px;
    }

    /* Better spacing for touch */
    .primary-menu>li>a {
        padding: 1rem 1.25rem;
    }

    /* Disable hover effects on touch devices */
    .primary-menu>li>a:hover {
        background-color: transparent;
    }

    /* Active states instead */
    .primary-menu>li>a:active {
        background-color: rgba(46, 211, 151, 0.2);
    }
}

/* ========================================
   Landscape Orientation Mobile
   ======================================== */

@media (max-width: 768px) and (orientation: landscape) {
    .hero-slider {
        height: 350px;
    }

    .primary-menu-wrapper {
        max-height: calc(100vh - 60px);
    }

    .hero-content h1 {
        font-size: 2rem;
    }

    .hero-content .hero-subtitle {
        font-size: 1rem;
    }
}

/* ========================================
   High DPI Displays
   ======================================== */

@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {

    .menu-toggle .line {
        height: 1px;
    }

    button,
    input[type="button"],
    input[type="submit"] {
        border: 1px solid transparent;
    }
}

/* ========================================
   Print Styles
   ======================================== */

@media print {
    * {
        background-color: white !important;
        color: black !important;
        box-shadow: none !important;
        text-shadow: none !important;
    }

    a {
        text-decoration: underline;
        color: black !important;
    }

    .site-header,
    .site-footer,
    .sidebar,
    .pagination,
    .comments-area,
    .menu-toggle {
        display: none !important;
    }

    body {
        background-color: white;
        color: black;
        font-size: 12pt;
        line-height: 1.5;
    }

    h1,
    h2,
    h3,
    h4,
    h5,
    h6 {
        page-break-after: avoid;
    }

    img {
        page-break-inside: avoid;
        max-width: 100%;
    }

    .container {
        max-width: 100%;
        padding: 0;
        grid-template-columns: 1fr;
    }

    .content-area {
        margin: 0;
        padding: 0;
    }
}

/* ========================================
   Landscape Orientation
   ======================================== */

@media (max-height: 500px) and (orientation: landscape) {
    .site-header {
        padding: var(--spacing-sm) var(--spacing-lg);
    }

    .container {
        padding: var(--spacing-md) var(--spacing-lg);
    }

    .entry-image,
    .featured-image {
        max-height: 250px;
    }
}

/* ========================================
   Accessibility - Reduced Motion
   ======================================== */

@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;
    }
}

/* ========================================
   Dark Color Scheme Support
   ======================================== */

@media (prefers-color-scheme: dark) {
    /* Theme already uses dark mode by default */
}

/* ========================================
   Light Color Scheme Support
   ======================================== */

@media (prefers-color-scheme: light) {
    /* Optional: Can be implemented if needed */
    /* For now, stick with dark theme */
}