/*
 * PIRANOT DEV - Mobile Optimized v35
 * Responsive Design & Performance
 */

/* === MOBILE BREAKPOINT: 768px === */
@media (max-width: 768px) {
    /* Header Stack */
    .jeg_header {
        padding: 12px 0;
    }

    .jeg_midbar {
        padding: 12px 0 !important;
    }

    /* Logo Mobile */
    .jeg_logo img {
        height: 40px !important;
        width: auto !important;
    }

    /* Navigation Stack */
    .jeg_main_menu {
        flex-wrap: wrap;
    }

    .jeg_main_menu > li > a {
        font-size: 12px !important;
        padding: 0 12px !important;
        line-height: 45px !important;
    }

    /* Action Buttons - Stack Vertical */
    .pira-actions-wrapper {
        flex-direction: column;
        width: 100%;
        gap: 8px !important;
        margin-top: 12px;
    }

    .btn-pira-modern {
        width: 100%;
        justify-content: center;
        padding: 10px 14px !important;
        font-size: 10px !important;
    }

    /* Search Mobile */
    .jeg_nav_item.jeg_nav_search {
        width: 100%;
        margin-top: 12px;
    }

    .jeg_nav_item.jeg_nav_search .jeg_search_wrapper {
        width: 100%;
    }

    /* Cards Mobile */
    .jeg_post_item {
        border-radius: 8px;
        margin-bottom: 12px;
    }

    .jeg_post_content {
        padding: 12px;
    }

    .jeg_post_title {
        font-size: 16px;
        line-height: 1.3;
    }

    .jeg_post_meta {
        font-size: 11px;
        gap: 8px;
    }

    /* Grid Layout Mobile */
    .jeg_main_wrapper {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    .jeg_sidebar {
        display: none; /* Hide sidebar on mobile */
    }

    /* Pagination Mobile */
    .jeg_pagenav {
        flex-wrap: wrap;
    }

    /* Scroll to Top Mobile */
    .jscroll-to-top.mobile {
        display: flex !important;
        bottom: 20px;
        right: 20px;
        width: 40px;
        height: 40px;
    }

    .jscroll-to-top_link {
        font-size: 16px;
    }

    /* Footer Mobile */
    .footer-holder {
        padding: 24px 0 16px;
    }
}

/* === TABLET BREAKPOINT: 768px - 1024px === */
@media (min-width: 768px) and (max-width: 1024px) {
    .jeg_post_title {
        font-size: 17px;
    }

    .jeg_main_menu > li > a {
        font-size: 12px !important;
        padding: 0 10px !important;
    }

    .jeg_sidebar {
        width: 100%;
        margin-top: 20px;
    }

    .pira-actions-wrapper {
        flex-direction: column;
        gap: 10px !important;
    }

    .btn-pira-modern {
        width: auto;
    }
}

/* === SMALL PHONES: < 600px === */
@media (max-width: 600px) {
    .jeg_header {
        padding: 8px 0;
    }

    .jeg_logo img {
        height: 36px !important;
    }

    .jeg_main_menu > li {
        margin: 0 4px;
    }

    .jeg_main_menu > li > a {
        font-size: 11px !important;
        padding: 0 8px !important;
        line-height: 40px !important;
    }

    .jeg_main_menu > li > a::after {
        display: none;
    }

    /* Single Column Everything */
    .jeg_main_wrapper {
        grid-template-columns: 1fr !important;
    }

    /* Card compact */
    .jeg_post_item {
        border-radius: 6px;
    }

    .jeg_post_image {
        max-height: 180px;
        overflow: hidden;
    }

    .jeg_post_content {
        padding: 10px;
    }

    .jeg_post_title {
        font-size: 14px;
    }

    .jeg_post_meta {
        font-size: 10px;
        flex-wrap: wrap;
        gap: 6px;
    }

    /* Buttons Stack */
    .pira-actions-wrapper {
        flex-direction: column;
        width: 100%;
        gap: 6px !important;
    }

    .btn-pira-modern {
        width: 100%;
        padding: 8px 12px !important;
        font-size: 9px !important;
    }

    /* Search full width */
    .jeg_nav_item.jeg_nav_search {
        width: 100%;
    }

    /* Remove hover effects on mobile (reduce motion) */
    .jeg_post_item:hover {
        transform: none;
    }

    .jeg_post_item:hover .jeg_post_image img {
        transform: none;
    }

    .btn-pira-modern:hover {
        transform: none;
    }
}

/* === PERFORMANCE: Reduce animations on mobile === */
@media (max-width: 768px) {
    .jeg_post_image img {
        transition: none !important;
    }

    .jeg_post_item {
        transition: box-shadow 0.2s ease !important;
    }

    .btn-pira-modern {
        transition: none !important;
    }

    /* Active states only */
    .jeg_post_item:active {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    }
}

/* === LANDSCAPE MODE === */
@media (max-width: 768px) and (orientation: landscape) {
    .jeg_header {
        padding: 6px 0;
    }

    .jeg_logo img {
        height: 32px !important;
    }

    .jeg_topbar {
        display: none;
    }

    .jeg_main_menu > li > a {
        line-height: 36px !important;
        font-size: 11px !important;
    }

    .jeg_post_content {
        padding: 8px;
    }

    .jeg_post_title {
        font-size: 13px;
    }
}

/* === TOUCH FRIENDLY === */
@media (hover: none) and (pointer: coarse) {
    /* Increase touch targets */
    .jeg_main_menu > li > a {
        min-height: 44px;
        min-width: 44px;
    }

    .btn-pira-modern {
        min-height: 44px;
    }

    /* Disable hover effects */
    .jeg_post_item:hover {
        transform: none;
    }

    .jeg_post_image img {
        transform: none;
    }
}

/* === HIGH DPI SCREENS === */
@media (min-resolution: 2dppx) {
    .jeg_post_image img,
    .jeg_logo img {
        image-rendering: -webkit-optimize-contrast;
    }
}

/* === DARK MODE (Optional) === */
@media (prefers-color-scheme: dark) {
    :root {
        --color-text: #f3f4f6;
        --color-text-light: #d1d5db;
        --color-border: #374151;
        --color-bg: #1f2937;
    }

    .jeg_post_item,
    .jeg_sidebar {
        background: #111827;
        border-color: #374151;
    }

    .jeg_topbar {
        background: rgba(17, 24, 39, 0.95) !important;
    }

    .jeg_bottombar {
        background: #1f2937;
    }
}

/* === SAFE AREA INSETS (notched phones) === */
@supports (padding: max(0px)) {
    body {
        padding-left: max(12px, env(safe-area-inset-left));
        padding-right: max(12px, env(safe-area-inset-right));
    }

    .jeg_header {
        padding-left: max(0, env(safe-area-inset-left));
        padding-right: max(0, env(safe-area-inset-right));
    }
}

/* === PRINT STYLES === */
@media print {
    .jeg_header,
    .jeg_sidebar,
    .footer-holder,
    .jscroll-to-top,
    .pira-actions-wrapper {
        display: none !important;
    }

    .jeg_post_item {
        page-break-inside: avoid;
    }
}
