/* ============================================================
   UCHIHA Labs - Mobile Responsive Styles
   - Breakpoints: 1024px (tablet), 768px (large phone), 480px (phone)
   - All mobile-first overrides, never breaks desktop
   ============================================================ */

/* ---------- Custom Download Manager Modal ---------- */
.uchiha-download-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    animation: uchiha-fadein 0.2s ease;
}
@keyframes uchiha-fadein {
    from { opacity: 0; }
    to { opacity: 1; }
}
.uchiha-download-panel {
    background: linear-gradient(180deg, rgba(20, 5, 5, 0.95) 0%, rgba(10, 0, 0, 0.98) 100%);
    border: 1px solid rgba(214, 0, 0, 0.4);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 30px rgba(214, 0, 0, 0.15);
    width: 100%;
    max-width: 480px;
    color: #fff;
    overflow: hidden;
    animation: uchiha-slidein 0.25s ease;
}
@keyframes uchiha-slidein {
    from { transform: translateY(20px) scale(0.95); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}
.uchiha-download-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    background: linear-gradient(90deg, rgba(214, 0, 0, 0.15) 0%, transparent 100%);
    border-bottom: 1px solid rgba(214, 0, 0, 0.2);
}
.uchiha-download-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, #d60000 0%, #8a0000 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 4px 12px rgba(214, 0, 0, 0.4);
    flex-shrink: 0;
}
.uchiha-download-title {
    flex: 1;
    min-width: 0;
}
.uchiha-download-title h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
}
.uchiha-download-title p {
    margin: 2px 0 0;
    font-size: 12px;
    color: #cc8080;
}
.uchiha-download-close {
    background: transparent;
    border: none;
    color: #ff8080;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    padding: 0 8px;
    border-radius: 6px;
    transition: background 0.15s;
}
.uchiha-download-close:hover {
    background: rgba(214, 0, 0, 0.15);
}
.uchiha-download-body {
    padding: 20px;
}
.uchiha-progress {
    height: 8px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    overflow: hidden;
    position: relative;
}
.uchiha-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #d60000 0%, #ff4d4d 50%, #d60000 100%);
    background-size: 200% 100%;
    border-radius: 999px;
    transition: width 0.2s ease;
    animation: uchiha-progress-shine 1.5s linear infinite;
    box-shadow: 0 0 8px rgba(214, 0, 0, 0.6);
}
@keyframes uchiha-progress-shine {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.uchiha-progress-info {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 12px;
    color: #ffb1b1;
    font-variant-numeric: tabular-nums;
}
.uchiha-download-actions {
    display: flex;
    gap: 10px;
    margin-top: 18px;
    justify-content: flex-end;
}
.uchiha-btn {
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
    font-family: inherit;
}
.uchiha-btn-primary {
    background: linear-gradient(135deg, #d60000 0%, #a80000 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(214, 0, 0, 0.3);
}
.uchiha-btn-primary:hover {
    background: linear-gradient(135deg, #ff1a1a 0%, #c00 100%);
    transform: translateY(-1px);
}
.uchiha-btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    color: #ffb1b1;
    border: 1px solid rgba(214, 0, 0, 0.3);
}
.uchiha-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}
.uchiha-download-error {
    margin-top: 14px;
    padding: 10px 14px;
    background: rgba(214, 0, 0, 0.15);
    border: 1px solid rgba(214, 0, 0, 0.3);
    border-radius: 8px;
    color: #ff8080;
    font-size: 13px;
}
@media (max-width: 480px) {
    .uchiha-download-panel {
        max-width: 100%;
    }
    .uchiha-download-header {
        padding: 14px 16px;
    }
    .uchiha-download-body {
        padding: 16px;
    }
}

/* ---------- Tablet landscape & smaller ---------- */
@media (max-width: 1024px) {
    .sidebar {
        position: fixed !important;
        left: 0;
        top: 0;
        height: 100vh;
        width: 280px !important;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    .sidebar.open {
        transform: translateX(0) !important;
    }
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.6);
        z-index: 999;
        backdrop-filter: blur(2px);
    }
    .sidebar-overlay.open {
        display: block;
    }
    .sidebar-close-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        position: absolute;
        top: 12px;
        right: 12px;
        background: transparent;
        border: 1px solid rgba(255, 75, 75, 0.4);
        color: #ff8080;
        width: 36px;
        height: 36px;
        border-radius: 8px;
        cursor: pointer;
        z-index: 10;
    }
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }
    .mobile-menu-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        background: transparent;
        border: 1px solid rgba(214, 0, 0, 0.5);
        color: #ff8080;
        border-radius: 8px;
        cursor: pointer;
        flex-shrink: 0;
    }
    .mobile-menu-btn:hover {
        background: rgba(214, 0, 0, 0.15);
    }
    /* Profile sidebar becomes a bottom sheet */
    .profile-sidebar {
        position: fixed !important;
        top: auto !important;
        bottom: 0 !important;
        right: 0 !important;
        left: 0 !important;
        width: 100% !important;
        max-height: 85vh;
        border-radius: 20px 20px 0 0 !important;
        transform: translateY(100%);
        transition: transform 0.3s ease;
        z-index: 1100;
    }
    .profile-sidebar.active,
    .profile-sidebar.open {
        transform: translateY(0) !important;
    }
    .profile-sidebar-close {
        display: block !important;
        position: absolute;
        top: 12px;
        right: 12px;
        background: transparent;
        border: none;
        color: #ff8080;
        font-size: 24px;
        cursor: pointer;
    }
}

/* ---------- Phone (large) ---------- */
@media (max-width: 768px) {
    body {
        font-size: 14px;
    }
    .header {
        padding: 8px 12px !important;
        gap: 6px !important;
        flex-wrap: wrap;
    }
    .header-logo {
        height: 32px !important;
        width: 32px !important;
    }
    .header-title {
        font-size: 15px !important;
    }
    .icon-action-btn span:not(.badge) {
        display: none;
    }
    .icon-action-btn {
        padding: 8px 10px !important;
    }
    .icon-action-btn .badge {
        position: absolute;
        top: 2px;
        right: 2px;
        font-size: 9px;
        padding: 1px 4px;
    }
    .auth-btn {
        padding: 6px 12px !important;
        font-size: 13px !important;
    }
    .user-profile-btn {
        padding: 4px 8px !important;
    }
    .user-profile-btn .profile-info span:first-child {
        max-width: 80px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 13px;
    }
    .nameplate-lc {
        font-size: 11px !important;
    }
    /* Content cards stack */
    .product-grid,
    .products-grid,
    [class*="grid"] {
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }
    .glass-card,
    .content-card {
        padding: 14px !important;
        border-radius: 12px !important;
    }
    /* Tabs scroll horizontal */
    .tab-bar,
    .category-tabs-bar {
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        flex-wrap: nowrap !important;
    }
    .tab-bar::-webkit-scrollbar {
        height: 4px;
    }
    .tab-bar::-webkit-scrollbar-thumb {
        background: rgba(214, 0, 0, 0.5);
        border-radius: 2px;
    }
    /* Filter / sort rows stack */
    .sorting-bar,
    .filter-bar,
    .toolbar {
        flex-wrap: wrap;
        gap: 8px;
    }
    .sorting-bar > * {
        flex: 1 1 45%;
        min-width: 0;
    }
    /* Modal centered, smaller */
    .modal-content,
    .modal,
    [class*="-modal"] {
        width: 92vw !important;
        max-width: 92vw !important;
        max-height: 88vh !important;
        margin: 5vh auto !important;
        border-radius: 14px !important;
    }
    /* Banner pin top */
    .banner {
        left: 8px !important;
        right: 8px !important;
        top: 8px !important;
        font-size: 13px !important;
        padding: 10px 14px !important;
    }
    /* Footer / maintenance panel bottom */
    .maintenance-panel,
    #adminMaintenancePanel {
        left: 8px !important;
        right: 8px !important;
        bottom: 8px !important;
        max-width: none !important;
    }
    /* Profile picture wrappers */
    .profile-img-wrap,
    .profile-img-wrap-large {
        width: 80px !important;
        height: 80px !important;
    }
    .profile-img-wrap-large {
        width: 110px !important;
        height: 110px !important;
    }
    /* News / forum posts */
    .forum-post,
    .news-card,
    .review-card {
        padding: 12px !important;
    }
    .forum-post-content,
    .review-body,
    .news-content {
        font-size: 14px !important;
    }
    /* Input fields full width */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    textarea,
    select {
        font-size: 16px !important; /* avoid iOS zoom on focus */
    }
}

/* ---------- Phone (small) ---------- */
@media (max-width: 480px) {
    .header {
        padding: 6px 8px !important;
    }
    .header-title {
        display: none !important;
    }
    .icon-action-btn {
        padding: 6px 8px !important;
    }
    .auth-btn {
        padding: 5px 10px !important;
        font-size: 12px !important;
    }
    .profile-img-wrap,
    .profile-img-wrap-large {
        width: 64px !important;
        height: 64px !important;
    }
    .glass-card,
    .content-card {
        padding: 10px !important;
    }
    h1 { font-size: 22px !important; }
    h2 { font-size: 18px !important; }
    h3 { font-size: 16px !important; }
    .btn, button {
        min-height: 36px;
    }
    /* Hide secondary actions on small screens */
    .hide-on-mobile {
        display: none !important;
    }
}

/* ---------- Touch & tap highlight ---------- */
@media (hover: none) {
    button:active,
    .icon-action-btn:active,
    .category-tab:active {
        transform: scale(0.97);
        transition: transform 0.1s;
    }
    .product-card:active,
    .glass-card:active {
        transform: scale(0.99);
    }
}

/* ---------- Mobile menu button (hidden by default on desktop) ---------- */
.mobile-menu-btn {
    display: none;
}

/* ---------- Landscape phones ---------- */
@media (max-height: 500px) and (orientation: landscape) {
    .sidebar {
        overflow-y: auto;
    }
    .main-content {
        padding-bottom: 8px !important;
    }
}

/* ---------- Reduce motion for accessibility ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ---------- Auth public-site notice ---------- */
.auth-public-notice {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: linear-gradient(135deg, rgba(214, 0, 0, 0.12) 0%, rgba(140, 0, 0, 0.06) 100%);
    border: 1px solid rgba(214, 0, 0, 0.35);
    border-left: 3px solid #d60000;
    border-radius: 10px;
    padding: 14px 16px;
    margin-bottom: 20px;
    color: #ffb1b1;
    font-size: 13px;
    line-height: 1.5;
    position: relative;
}
.auth-public-notice svg {
    color: #d60000;
    flex-shrink: 0;
    margin-top: 2px;
}
.auth-public-notice strong {
    color: #fff;
    display: block;
    margin-bottom: 2px;
}
.auth-public-notice a {
    color: #ff4d4d;
    text-decoration: underline;
    text-underline-offset: 2px;
}
.auth-public-notice a:hover {
    color: #ff8080;
}
.auth-public-notice-close {
    background: transparent;
    border: none;
    color: #ff8080;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    padding: 0 4px;
    margin-left: auto;
    flex-shrink: 0;
    border-radius: 4px;
    transition: background 0.15s;
}
.auth-public-notice-close:hover {
    background: rgba(214, 0, 0, 0.15);
}
