/* =========================================
   Mobile Application Styles (Responsive)
   ========================================= */

/* Bottom Navigation (Mobile Only) */
.bottom-nav {
    display: none;
    /* Hidden on desktop */
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-top: none;
    padding: 10px 4px;
    justify-content: space-around;
    z-index: 9999;
    box-shadow: 0 -4px 20px rgba(102, 126, 234, 0.35);
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
    /* Safe area for iPhone X+ */
}

.nav-item-mobile {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.7rem;
    font-weight: 500;
    gap: 2px;
    padding: 6px 10px;
    border-radius: 10px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.nav-item-mobile.active {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.2);
}

.nav-item-mobile i,
.nav-item-mobile .nav-icon {
    font-size: 20px;
    margin-bottom: 2px;
    font-style: normal;
}

/* Responsive Rules */
@media (max-width: 768px) {

    /* Prevent horizontal overflow */
    html,
    body {
        overflow-x: hidden !important;
        max-width: 100vw !important;
    }

    .container {
        display: block;
        /* Remove flex layout */
        height: auto;
        max-width: 100vw;
        overflow-x: hidden;
    }

    .sidebar {
        display: none !important;
        /* Force hide sidebar */
    }

    .main-content {
        margin-left: 0;
        width: 100%;
        max-width: 100vw;
        padding: 16px;
        padding-bottom: 100px !important;
        /* Space for bottom nav */
        overflow-x: hidden;
        box-sizing: border-box;
    }

    .bottom-nav {
        display: flex !important;
        width: 100%;
        left: 0;
        right: 0;
    }

    /* Settings page fixes */
    .settings-section {
        max-width: 100%;
        overflow-x: hidden;
    }

    .settings-item {
        flex-wrap: wrap;
        gap: 12px;
    }

    .form-input,
    .form-select {
        max-width: 100% !important;
        width: 100% !important;
        box-sizing: border-box;
    }

    /* Button group wrap */
    .settings-section>div[style*="flex"] {
        flex-wrap: wrap !important;
    }

    .btn {
        flex-shrink: 0;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        /* Stack cards vertically */
        gap: 16px;
    }

    /* Header adjustments */
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .page-header .btn {
        width: 100%;
    }

    /* Card adjustments */
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .subscription-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .sub-info {
        width: 100%;
    }

    .sub-actions {
        width: 100%;
        justify-content: flex-end;
    }

    /* Modal Mobile */
    .modal {
        width: 90%;
        max-height: 90vh;
        overflow-y: auto;
    }

    .form-group {
        margin-bottom: 12px;
    }

    /* Typography */
    .page-title {
        font-size: 1.5rem;
    }

    .stat-value {
        font-size: 1.8rem;
    }

    /* Tabs Logic for Mobile (if tabs used) */
    .tab-group {
        overflow-x: auto;
        padding-bottom: 4px;
    }
}