/* ============================================================
   MOBILE / TOUCH RESPONSIVE FIXES — ramifans.com
   ============================================================ */

/* ── Global touch optimizations ── */
button, .btn, a.btn, [role="button"], input, select, textarea {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}
html {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
}

/* ── Navbar mobile (nav links now live in the bottom-sheet "More" menu) ── */
@media (max-width: 640px) {
    .navbar { padding: 0.55rem 0.9rem; }
    .logo { font-size: 1.2rem; }
}

/* ── Bottom nav touch friendly ── */
.bottom-nav .bn-item {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    min-height: 44px;
    justify-content: center;
}
@media (max-width: 640px) {
    body { padding-bottom: 72px; }
    .container { padding-bottom: 0.5rem; }
}

/* ── Feed cards — touch-friendly buttons ── */
.feed-unlock-btn {
    width: 100%;
    text-align: center;
    margin-top: 0.45rem;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: normal;
    font-size: 0.8rem;
    padding: 0.5rem 0.6rem;
    border-radius: 8px;
    word-break: break-word;
}
.feed-lock-overlay {
    position: absolute;
    inset: 0;
    z-index: 6;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    cursor: pointer;
    border-radius: 12px;
}
.feed-lock-icon {
    font-size: 2.2rem;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.5));
}
.feed-lock-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: #fff;
    text-shadow: 0 1px 4px rgba(0,0,0,0.6);
    text-align: center;
    padding: 0 0.5rem;
    line-height: 1.2;
}
.feed-info-locked {
    padding: 0.6rem 0.7rem 0.65rem;
}

/* Feed grid — single column on narrow phones */
@media (max-width: 420px) {
    .feed-grid {
        grid-template-columns: 1fr !important;
        gap: 0.8rem;
    }
    .feed-card { border-radius: 12px; }
    .feed-media-wrap { aspect-ratio: 4/3; }
}
@media (max-width: 640px) {
    .feed-unlock-btn {
        font-size: 0.75rem;
        padding: 0.45rem 0.5rem;
        min-height: 38px;
    }
    .feed-lock-label { font-size: 0.75rem; }
    .feed-lock-icon { font-size: 1.8rem; }
}

/* ── Feed hero mobile ── */
.feed-hero {
    display: flex; justify-content: space-between; align-items: center;
    gap: 1rem; margin-bottom: 1.5rem; padding: 1.2rem 0;
}
.feed-hero-btns { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.feed-hero-btns .btn { white-space: nowrap; }
@media (max-width: 640px) {
    .feed-hero {
        flex-direction: column; align-items: flex-start;
        padding: 0.8rem 0 0.5rem; gap: 0.6rem; margin-bottom: 1rem;
    }
    .feed-hero-text h1 { font-size: 1.2rem; }
    .feed-hero-text p { font-size: 0.8rem; }
    .feed-hero-btns { width: 100%; }
    .feed-hero-btns .btn { flex: 1; text-align: center; justify-content: center; min-width: 0; }
}

/* ── Feed modal (locked prompt) — mobile bottomsheet ── */
.feed-modal {
    display: none;
    position: fixed; inset: 0; z-index: 300;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    align-items: center; justify-content: center;
    padding: 1rem;
}
.feed-modal-box {
    background: var(--card, #1a1a28);
    border: 1px solid var(--border, #2a2a3a);
    border-radius: 16px;
    padding: 1.5rem 1.2rem;
    max-width: 400px; width: 100%;
    text-align: center; position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.feed-modal-box h2 { margin: 0 0 0.5rem; font-size: 1.2rem; }
.feed-modal-box p { color: var(--text-muted, #888); font-size: 0.9rem; margin-bottom: 1.2rem; }
.feed-modal-close {
    position: absolute; top: 0.5rem; right: 0.8rem;
    font-size: 1.5rem; cursor: pointer; color: var(--text-muted, #888);
    -webkit-tap-highlight-color: transparent;
    min-width: 40px; min-height: 40px;
    display: flex; align-items: center; justify-content: center;
}
.feed-modal-close:hover { color: var(--text, #fff); }
.feed-modal-btns { display: flex; flex-direction: column; gap: 0.5rem; }
.feed-modal-btns .btn {
    width: 100%; text-align: center; justify-content: center;
    min-height: 44px; font-size: 0.9rem; white-space: normal;
}
@media (max-width: 640px) {
    .feed-modal { padding: 0.8rem; align-items: flex-end; }
    .feed-modal-box {
        border-radius: 16px 16px 0 0;
        padding: 1.3rem 1rem 1.5rem;
        max-width: 100%;
    }
    .feed-modal-box h2 { font-size: 1.1rem; }
}

/* ── Register page ── */
.register-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem; align-items: start;
    max-width: 1000px; margin: 0 auto;
}
.register-side { padding-top: 1rem; }
.register-perks {
    list-style: none; display: flex; flex-direction: column;
    gap: 0.7rem; margin: 1.5rem 0;
}
.register-perks li {
    display: flex; align-items: center; gap: 0.6rem;
    font-size: 0.9rem; color: var(--text, #eee);
}
.register-premium-teaser {
    background: rgba(247,147,26,0.08);
    border: 1px solid rgba(247,147,26,0.2);
    border-radius: 12px; padding: 1rem 1.2rem; margin-top: 1.5rem;
}
.register-form-card {
    background: var(--card, #1a1a28);
    border: 1px solid var(--border, #2a2a3a);
    border-radius: 16px; padding: 2rem 1.8rem;
}
.register-btn {
    width: 100%; text-align: center; justify-content: center;
    min-height: 48px; margin-top: 0.5rem; white-space: normal;
}
.form-group {
    display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 1rem;
}
.form-group label { font-size: 0.85rem; font-weight: 600; color: var(--text, #eee); }
.form-group input {
    width: 100%; padding: 0.65rem 0.8rem;
    border: 1px solid var(--border, #2a2a3a);
    border-radius: 8px; background: var(--bg, #0b0b14);
    color: var(--text, #fff); font-size: 0.95rem; font-family: inherit;
}
.form-group input:focus {
    outline: none; border-color: var(--accent, #f7931a);
    box-shadow: 0 0 0 3px rgba(247,147,26,0.15);
}
.form-hint { font-size: 0.72rem; color: var(--text-muted, #888); }
.input-with-icon { position: relative; display: flex; align-items: center; }
.input-with-icon .input-icon { position: absolute; left: 0.7rem; font-size: 1rem; pointer-events: none; }
.input-with-icon input { padding-left: 2.3rem; }

@media (max-width: 640px) {
    .register-layout { grid-template-columns: 1fr; gap: 1rem; }
    .register-side { text-align: center; padding-top: 0.3rem; }
    .register-perks { text-align: left; }
    .register-form-card { padding: 1.4rem 1rem; border-radius: 14px; }
    .register-side h2 { font-size: 1.3rem; }
    .register-brand h1 { font-size: 1.1rem; }
}

/* ── Login page ── */
.auth-page {
    display: flex; align-items: center; justify-content: center;
    min-height: 70vh; padding: 1rem;
}
.auth-card {
    background: var(--card, #1a1a28);
    border: 1px solid var(--border, #2a2a3a);
    border-radius: 16px; padding: 2rem;
    width: 100%; max-width: 410px; text-align: center;
}
.auth-form { display: flex; flex-direction: column; gap: 1rem; text-align: left; }
.auth-form input {
    width: 100%; padding: 0.65rem 0.8rem;
    border: 1px solid var(--border, #2a2a3a);
    border-radius: 8px; background: var(--bg, #0b0b14);
    color: var(--text, #fff); font-size: 0.95rem; font-family: inherit;
}
.auth-form input:focus {
    outline: none; border-color: var(--accent, #f7931a);
    box-shadow: 0 0 0 3px rgba(247,147,26,0.15);
}
.auth-form .btn {
    width: 100%; min-height: 44px; justify-content: center; white-space: normal;
}
.auth-subtitle { color: var(--text2); margin-bottom: 1.6rem; font-size: 0.92rem; }
.auth-footer { margin-top: 1.3rem; font-size: 0.85rem; color: var(--text2); }
.auth-error {
    background: rgba(255,80,80,0.1);
    border: 1px solid rgba(255,80,80,0.3);
    border-radius: 8px; padding: 0.6rem 0.9rem;
    color: #ff7a7a; font-size: 0.85rem; text-align: left;
}
@media (max-width: 640px) {
    .auth-page { min-height: 60vh; padding: 0.5rem; }
    .auth-card { padding: 1.4rem 1rem; }
}

/* ── Landing hero buttons mobile ── */
.hero-cta {
    display: flex; gap: 0.8rem; flex-wrap: wrap; margin-bottom: 2.2rem;
}
.hero-cta .btn { white-space: normal; text-align: center; justify-content: center; }
@media (max-width: 640px) {
    .hero { padding: 1.8rem 0 1.5rem; }
    .hero-content h1 { font-size: 1.6rem; }
    .hero-sub { font-size: 0.9rem; }
    .hero-cta { flex-direction: column; gap: 0.5rem; }
    .hero-cta .btn { width: 100%; min-height: 46px; font-size: 0.95rem; justify-content: center; }
    .hero-stats { gap: 1rem; justify-content: center; }
    .hero-stat .num { font-size: 1rem; }
    .hero-stat .label { font-size: 0.7rem; }
}

/* ── Dashboard mobile ── */
.welcome-banner {
    display: flex; justify-content: space-between; align-items: center;
    gap: 1rem; background: var(--card, #1a1a28);
    border: 1px solid var(--border, #2a2a3a);
    border-radius: 14px; padding: 1.2rem 1.3rem;
    margin-bottom: 1.5rem; flex-wrap: wrap;
}
.welcome-text h1 { font-size: 1.2rem; margin-bottom: 0.3rem; }
.welcome-sub { font-size: 0.85rem; color: var(--text-muted, #888); }
@media (max-width: 640px) {
    .welcome-banner { flex-direction: column; align-items: flex-start; padding: 1rem; gap: 0.8rem; }
    .welcome-text h1 { font-size: 1.05rem; }
    .dash-stats { gap: 0.5rem; }
    .dash-num { font-size: 1.4rem; }
    .dash-stat { padding: 0.8rem 0.5rem; }
}

/* ── Gallery tab scroll mobile ── */
.gallery-tab {
    padding: 0.5rem 1rem; font-size: 0.85rem; border-radius: 20px;
    cursor: pointer; color: var(--text-muted, #888);
    white-space: nowrap; border: none; background: transparent;
}
.gallery-tab.active { background: var(--accent, #f7931a); color: #14140f; font-weight: 600; }
@media (max-width: 640px) {
    .gallery-tabs {
        overflow-x: auto; -webkit-overflow-scrolling: touch;
        scroll-snap-type: x proximity; border-radius: 16px; gap: 0.2rem;
    }
    .gallery-tabs::-webkit-scrollbar { display: none; }
    .gallery-tab { padding: 0.45rem 0.8rem; font-size: 0.78rem; scroll-snap-align: start; }
    .gallery-header { flex-direction: column; align-items: stretch; gap: 0.7rem; }
    .gallery-controls { flex-direction: column; align-items: stretch; gap: 0.6rem; }
    .search-form { width: 100%; display: flex; gap: 0.4rem; }
    .search-input { flex: 1; min-width: 0; }
}

/* ── Media grid single-col on 420px and below ── */
@media (max-width: 420px) {
    .media-grid { grid-template-columns: 1fr !important; gap: 6px; }
}

/* ── Subscribe page mobile ── */
.subscribe-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.3rem; margin: 2rem 0;
}
.subscribe-card {
    background: var(--card, #1a1a28);
    border: 1px solid var(--border, #2a2a3a);
    border-radius: 16px; padding: 1.8rem 1.5rem; text-align: center;
}
@media (max-width: 640px) {
    .subscribe-cards { grid-template-columns: 1fr; gap: 1rem; }
    .subscribe-card { padding: 1.4rem 1rem; }
    .subscribe-page { padding: 1.5rem 0.8rem; }
}

/* ── Profile page mobile ── */
.profile-form input { width: 100%; padding: 0.65rem 0.8rem; }
.profile-form .btn { min-height: 44px; white-space: normal; }
@media (max-width: 640px) {
    .profile-page { padding: 0 0.3rem; }
    .profile-form { max-width: 100%; }
}

/* ── Feed bottom CTA mobile ── */
@media (max-width: 640px) {
    .feed-bottom { padding: 1.8rem 1rem; margin-top: 1.5rem; }
    .feed-bottom h2 { font-size: 1.2rem; }
    .feed-bottom p { font-size: 0.85rem; }
    .feed-bottom-btns { flex-direction: column; }
    .feed-bottom-btns .btn {
        width: 100%; min-height: 46px; justify-content: center; white-space: normal;
    }
}

/* ── Guest wall / error pages ── */
@media (max-width: 640px) {
    .guest-wall { padding: 2rem 0.8rem; }
    .guest-wall h1 { font-size: 1.4rem; }
}

/* ── Lightbox mobile ── */
@media (max-width: 640px) {
    .lightbox-media { padding: 0 4px; }
    .lightbox-nav { width: 36px; height: 36px; font-size: 1.3rem; }
    .lightbox-prev { left: 0.2rem; }
    .lightbox-next { right: 0.2rem; }
    .lightbox-video, .lightbox-img { max-height: 65vh; border-radius: 8px; }
}

/* ── Pagination mobile ── */
@media (max-width: 640px) {
    .pagination { gap: 0.6rem; margin: 1.2rem 0; }
    .page-btn { padding: 0.4rem 0.8rem; font-size: 0.8rem; }
    .page-info { font-size: 0.8rem; }
}

/* ── Analytics tabs scrollable mobile ── */
@media (max-width: 640px) {
    .analytics-tabs {
        overflow-x: auto; -webkit-overflow-scrolling: touch;
        gap: 0.3rem; flex-wrap: nowrap;
    }
    .analytics-tab { white-space: nowrap; padding: 0.6rem 0.9rem; font-size: 0.82rem; }
    .user-table { font-size: 0.78rem; }
    .user-table th, .user-table td { padding: 0.45rem 0.5rem; }
}

/* ── Payment tabs mobile ── */
@media (max-width: 640px) {
    .payment-tabs { gap: 0.4rem; margin: 1rem 0 1.2rem; }
    .payment-tab { padding: 0.55rem 1rem; font-size: 0.82rem; flex: 1; justify-content: center; }
    .plans-grid { grid-template-columns: 1fr; gap: 0.9rem; }
    .plan-card { padding: 1.3rem 1rem; }
    .plan-price { font-size: 1.8rem; }
    .telegram-plan-card { padding: 1.3rem 1rem; }
    .telegram-btn { min-height: 46px; }
    .sub-footer { padding: 1rem 0; }
}

/* ── Feed video lightbox (full-screen playback) ── */
.feed-video-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 400;
    background: rgba(0,0,0,0.92);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 1rem;
}
.feed-video-lightbox-video {
    max-width: 100%;
    max-height: 82vh;
    width: auto;
    height: auto;
    border-radius: 12px;
    outline: none;
    box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}
.feed-video-lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    font-size: 2rem;
    cursor: pointer;
    color: rgba(255,255,255,0.85);
    z-index: 5;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}
.feed-video-lightbox-close:hover { color: #fff; }
.feed-video-lightbox-caption {
    color: rgba(255,255,255,0.8);
    font-size: 0.9rem;
    margin-top: 0.8rem;
    text-align: center;
    padding: 0 1rem;
}
@media (max-width: 640px) {
    .feed-video-lightbox { padding: 0.5rem; }
    .feed-video-lightbox-video { max-height: 70vh; border-radius: 8px; }
    .feed-video-lightbox-close { top: 0.5rem; right: 0.5rem; font-size: 1.6rem; }
}

/* ── Feed card free (viewable) — cursor pointer indicates clickable ── */
.feed-media-clickable { cursor: pointer; }
.feed-media-clickable .feed-play-btn {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.35);
    transition: background 0.2s;
}
.feed-media-clickable:hover .feed-play-btn {
    background: rgba(0,0,0,0.5);
}
.feed-media-clickable .feed-play-btn span {
    font-size: 2rem;
    color: #fff;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.6));
}

/* ── Admin page UX fixes ── */
.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}
.admin-header h1 { margin: 0; }

/* ── Landing page feed preview section ── */
.feed-preview-section {
    margin: 2.5rem auto;
    padding: 1.5rem;
    max-width: 1200px;
}
.feed-preview-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}
.feed-preview-head h2 {
    font-size: 1.5rem;
    margin: 0;
}
.feed-preview-sub {
    color: var(--text-muted, #888);
    margin: 0.3rem 0 0;
    font-size: 0.9rem;
}
.feed-preview-grid {
    grid-template-columns: repeat(4, 1fr);
}
.feed-preview-cta {
    text-align: center;
    margin-top: 1.5rem;
}
@media (max-width: 900px) {
    .feed-preview-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 640px) {
    .feed-preview-section { padding: 1rem; }
    .feed-preview-grid { grid-template-columns: repeat(2, 1fr); gap: 0.6rem; }
    .feed-preview-head { flex-direction: column; align-items: flex-start; }
}

/* ── Checkout page mobile ── */
.checkout-page {
    display: flex;
    justify-content: center;
    padding: 2rem 1rem;
}
.checkout-card {
    background: var(--card, #1a1a28);
    border: 1px solid var(--border, #2a2a3a);
    border-radius: 16px;
    padding: 2rem 1.8rem;
    max-width: 460px;
    width: 100%;
}
.checkout-card h1 { font-size: 1.8rem; margin: 0.3rem 0; }
.checkout-back { font-size: 0.85rem; color: var(--text-muted, #888); }
.checkout-form .btn { width: 100%; min-height: 48px; white-space: normal; }
.checkout-info { margin-top: 1rem; font-size: 0.85rem; color: var(--text-muted, #888); }
.checkout-alt { margin-top: 1.2rem; text-align: center; }
.checkout-alt .btn { white-space: normal; width: 100%; text-align: center; justify-content: center; }
@media (max-width: 640px) {
    .checkout-page { padding: 1rem 0.5rem; }
    .checkout-card { padding: 1.4rem 1rem; border-radius: 14px; }
    .checkout-card h1 { font-size: 1.5rem; }
}

/* ── Admin page mobile (extra safety) ── */
@media (max-width: 640px) {
    .admin-stats { gap: 0.4rem; }
    .stat-card { padding: 0.8rem; }
    .stat-number { font-size: 1.3rem; }
    .mm-title-form { min-width: 100%; flex-wrap: wrap; }
    .mm-title-input { flex: 1; min-width: 0; }
}

/* ── Fix whitespace-nowrap on buttons globally ── */
.btn { white-space: normal; }
/* Keep compact nav buttons nowrap, but feed unlock buttons must wrap */
.btn-sm:not(.feed-unlock-btn) { white-space: nowrap; }

/* ============================================================
   APP-LIKE POLISH — native tap feedback, motion, touch sizing
   ============================================================ */
/* Springy press feedback on interactive elements (feels native) */
.btn, .promo-btn, .feed-card, .plan-card, .bn-item, .gallery-tab,
.metric-card, .feed-unlock-btn, .payment-tab, .theme-option {
    transition: transform .13s ease, box-shadow .18s ease,
                background .18s ease, border-color .18s ease, filter .13s ease;
}
.btn:active, .promo-btn:active, .bn-item:active, .gallery-tab:active,
.payment-tab:active, .feed-unlock-btn:active { transform: scale(.95); }
.feed-card-free:active, .plan-card:active, .metric-card:active { transform: scale(.985); }
@media (hover: hover) {
    .feed-card-free:hover, .plan-card:hover { transform: translateY(-3px); }
}
/* Current bottom-nav tab highlighted (set by JS) */
.bottom-nav .bn-item.active { color: var(--accent); }
.bottom-nav .bn-item.active .bn-icon { transform: translateY(-1px) scale(1.06); }
.bottom-nav .bn-item { transition: color .15s ease; }
/* Horizontal tab strips scroll smoothly, no visible bar */
.gallery-tabs, .media-manage-tabs, .payment-tabs, .analytics-tabs {
    -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.gallery-tabs::-webkit-scrollbar, .media-manage-tabs::-webkit-scrollbar,
.analytics-tabs::-webkit-scrollbar { display: none; }
/* Smoother media reveal */
.feed-img, .feed-video, .feed-thumb-blur, .mm-thumb, .media-thumb {
    transition: opacity .3s ease, transform .3s ease;
}

@media (max-width: 640px) {
    /* Comfortable, thumb-friendly targets */
    .btn, a.btn { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
    .pagination .page-btn { min-height: 44px; min-width: 46px; }
    .nav-link, .feed-title, .feed-meta { }
    .container { padding-left: 0.9rem; padding-right: 0.9rem; }
    .feed-grid { gap: 8px; }
    h1 { line-height: 1.2; }
    /* iOS: inputs must be >=16px or Safari zooms the page on focus */
    input, select, textarea { font-size: 16px !important; }
    /* Tighter, cleaner card meta */
    .feed-info { padding: 0.55rem 0.7rem 0.65rem; }
    .feed-title { font-size: 0.85rem; }
}
@media (prefers-reduced-motion: reduce) {
    .btn, .promo-btn, .feed-card, .plan-card, .bn-item, .gallery-tab, .metric-card { transition: none; }
    .btn:active, .promo-btn:active, .feed-card-free:active, .plan-card:active { transform: none; }
}