/* 
   OdePin Mobile Responsiveness Overrides 
   This file contains all the media queries needed to fix layout issues on mobile devices.
*/

/* --- GLOBAL RESPONSIVE FIXES --- */
@media (max-width: 991px) {
    .container {
        max-width: 100%;
        padding-left: 15px;
        padding-right: 15px;
    }

    /* Client Sidebar Fix */
    .fp-client-menu-modern {
        margin-bottom: 20px !important;
    }
}

@media (max-width: 768px) {
    /* Base spacing */
    .fp-section-page {
        padding: 20px 0;
    }

    /* Auth Modal Fix - Convert grid to stack */
    .auth-modal-content {
        grid-template-columns: 1fr !important;
    }

    .auth-modal-container {
        max-width: 95% !important;
        width: 100% !important;
        margin: 10px;
        border-radius: 20px !important;
        overflow-y: auto !important;
        max-height: 90vh !important;
    }

    .auth-modal-right {
        display: none !important; /* Hide illustration on small screens to save space */
    }

    .auth-modal-left {
        padding: 30px 20px !important;
    }

    /* Cart Modal Fixes */
    .cart-modal-container {
        max-width: 95% !important;
        width: 100% !important;
    }

    .cart-modal-content {
        flex-direction: column !important;
    }

    .cart-modal-img {
        width: 100% !important;
        height: 200px !important;
        margin-bottom: 15px;
    }

    .cart-similar-grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* Profile Dropdown Fix */
    .fp-topnav-dropdown {
        width: 90% !important;
        right: 5% !important;
        left: 5% !important;
        min-width: unset !important;
    }

    /* Balance Page / Cüzdanım Fixes */
    .fp-cc-head .title {
        font-size: 18px !important;
    }

    /* Wallet Stats Cards */
    .fp-balance-card {
        padding: 15px !important;
        margin-bottom: 10px;
    }

    .balance-amount {
        font-size: 20px !important;
    }

    /* Wallet Tabs - Improve horizontal scrolling visibility */
    .fp-wallet-container .wallet-tabs {
        -webkit-overflow-scrolling: touch;
        padding-bottom: 5px;
        border-bottom: 2px solid #f0f0f0;
    }

    .fp-wallet-container .wallet-tab-item {
        padding: 12px 15px !important;
        font-size: 13px !important;
    }

    /* PAYMENT METHODS GRID FIX - Critical for conversion */
    .fp-wallet-container .payment-methods {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }

    .fp-wallet-container .payment-method-card {
        padding: 15px 10px !important;
        min-height: 100px;
    }

    .fp-wallet-container .payment-method-card img {
        height: 24px !important;
    }

    .fp-wallet-container .method-name {
        font-size: 13px !important;
    }

    /* INPUT ICON (EMOJI) FIX - Critical detail */
    .fp-wallet-container .input-with-icon .form-control {
        padding-left: 42px !important; /* Ensure enough space for icon */
        font-size: 14px !important;
    }

    .fp-wallet-container .input-icon-left {
        left: 12px !important;
        font-size: 18px !important;
    }

    /* Payment Summary */
    .fp-wallet-container .payment-summary {
        margin-top: 20px;
        padding: 15px !important;
    }

    /* Transfer Direction Selector */
    .transfer-direction-selector {
        flex-direction: column !important;
        gap: 15px !important;
    }

    .direction-arrow {
        transform: rotate(90deg) !important;
        margin: 10px 0 !important;
    }

    .direction-arrow.reverse {
        transform: rotate(-90deg) !important;
    }

    /* Balance Visualization */
    .transfer-visualization {
        flex-direction: column !important;
        gap: 15px !important;
    }

    .transfer-vis-arrow {
        transform: rotate(90deg) !important;
    }

    /* Bank Account Display */
    .bank-card {
        width: 100% !important;
        height: auto !important;
        min-height: 180px !important;
    }

    .iban-number {
        font-size: 16px !important;
    }

    /* Table Responsiveness */
    .transaction-history-table {
        overflow-x: auto;
    }

    .custom-table {
        font-size: 13px !important;
    }

    .custom-table th, .custom-table td {
        padding: 10px !important;
        white-space: nowrap;
    }

    /* Footer Mobile Fix */
    .fp-footer {
        padding: 40px 0 20px !important;
        text-align: center;
    }

    .fp-footer .row > div {
        margin-bottom: 30px;
    }

    .footer-links {
        justify-content: center;
    }

    /* WhatsApp Button Mobile Optimization */
    #custom-whatsapp-button {
        width: 50px !important;
        height: 50px !important;
        border-radius: 50% !important;
        bottom: 80px !important; /* Move up to avoid bottom tab bar */
        right: 20px !important;
        padding: 0 !important;
        justify-content: center !important;
        box-shadow: 0 4px 15px rgba(37, 211, 102, 0.4) !important;
    }

    #custom-whatsapp-button span {
        display: none !important;
    }

    #custom-whatsapp-button img {
        width: 30px !important;
        height: 30px !important;
        margin: 0 !important;
    }
    /* MOBILE BOTTOM BAR ENHANCEMENT */
    .fp-mobile-bar {
        background: rgba(255, 255, 255, 0.95) !important;
        backdrop-filter: blur(20px) !important;
        border-top: 1px solid rgba(0, 0, 0, 0.05) !important;
        box-shadow: 0 -5px 25px rgba(0, 0, 0, 0.05) !important;
        height: 75px !important; /* Restored height */
        padding-bottom: env(safe-area-inset-bottom);
    }

    [data-theme="dark"] .fp-mobile-bar {
        background: rgba(18, 18, 18, 0.9) !important;
        border-top-color: rgba(255, 255, 255, 0.05) !important;
    }

    .fp-mobile-bar .link {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 4px !important;
        opacity: 0.7 !important;
        padding: 8px 4px !important;
    }

    .fp-mobile-bar .link .icon {
        margin: 0 0 4px 0 !important;
        height: 24px !important;
    }

    .fp-mobile-bar .link .icon i {
        font-size: 22px !important;
    }

    .fp-mobile-bar .link .text {
        display: block !important;
        font-size: 10.5px !important;
        font-weight: 700 !important;
        line-height: 1.2 !important;
    }

    .fp-mobile-bar .link.active, .fp-mobile-bar .link:hover {
        color: #0d6efd !important;
    }

    /* DASHBOARD & PANEL REFINEMENTS */
    .dashboard-welcome h2 {
        font-size: 20px !important;
    }

    .dashboard-welcome p {
        font-size: 13px !important;
    }

    /* Stats Grid Optimization */
    .stats-grid {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }

    .stat-card {
        padding: 15px 10px !important;
        margin: 0 !important;
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
        border-radius: 16px !important;
    }

    .stat-card:last-child {
        grid-column: span 2 !important;
        flex-direction: row !important;
        text-align: left !important;
        padding: 15px 20px !important;
    }

    .stat-icon {
        margin: 0 0 10px 0 !important;
        width: 40px !important;
        height: 40px !important;
        font-size: 18px !important;
    }

    .stat-card:last-child .stat-icon {
        margin: 0 15px 0 0 !important;
    }

    .stat-label {
        font-size: 11px !important;
    }

    .stat-value {
        font-size: 16px !important;
    }

    /* Action Grid Optimization */
    .action-grid {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 12px !important;
    }

    .action-card {
        padding: 15px !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        text-align: left !important;
        gap: 15px !important;
        border-radius: 16px !important;
    }

    .action-card .icon-circle {
        margin: 0 !important;
        width: 45px !important;
        height: 45px !important;
        font-size: 20px !important;
        flex-shrink: 0;
    }

    .action-card h3 {
        font-size: 14px !important;
        margin-bottom: 2px !important;
    }

    .action-card p {
        font-size: 11px !important;
        margin-bottom: 0 !important;
        display: block !important;
    }

    /* Balance Page Card Compactness */
    .fp-balance-card {
        flex-direction: column !important;
        text-align: center !important;
        gap: 10px !important;
    }

    .balance-info {
        width: 100% !important;
    }

    .balance-actions {
        justify-content: center !important;
        margin-top: 15px !important;
    }

    /* CLIENT PANEL COLLAPSIBLE MENU - Corporate & Premium */
    .fp-client-menu-modern {
        padding: 0 !important;
        background: #fff !important;
        border: 1px solid #f1f5f9 !important;
        border-radius: 16px !important;
        box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05) !important;
        overflow: hidden !important;
        margin-bottom: 25px !important;
    }

    [data-theme="dark"] .fp-client-menu-modern {
        background: #1a1a1a !important;
        border-color: #262626 !important;
    }

    .fp-client-menu-modern .user-info {
        padding: 15px !important;
        border-bottom: 1px solid #f1f5f9 !important;
        display: flex !important;
        background: #f8fafc !important;
    }

    [data-theme="dark"] .fp-client-menu-modern .user-info {
        background: #222 !important;
        border-color: #262626 !important;
    }

    .fp-client-mobile-menu-header {
        padding: 15px 20px !important;
        cursor: pointer;
        background: #fff !important;
        transition: background 0.3s ease;
    }

    [data-theme="dark"] .fp-client-mobile-menu-header {
        background: #1a1a1a !important;
    }

    .fp-client-mobile-menu-header.active {
        background: #f8fafc !important;
        border-bottom: 1px solid #f1f5f9 !important;
    }

    [data-theme="dark"] .fp-client-mobile-menu-header.active {
        background: #222 !important;
        border-color: #262626 !important;
    }

    .fp-client-mobile-menu-header .current-page {
        font-weight: 800;
        font-size: 14px;
        color: #1e293b;
    }

    [data-theme="dark"] .fp-client-mobile-menu-header .current-page {
        color: #f1f5f9;
    }

    .fp-client-mobile-menu-header .menu-arrow {
        font-size: 20px;
        transition: transform 0.3s ease;
        color: #64748b;
    }

    .fp-client-mobile-menu-header.active .menu-arrow {
        transform: rotate(180deg);
    }

    .fp-client-menu-modern .content-menu {
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        background: #fff;
    }

    [data-theme="dark"] .fp-client-menu-modern .content-menu {
        background: #1a1a1a;
    }

    .fp-client-menu-modern .content-menu.active {
        max-height: 1000px; /* Large enough for the menu */
    }

    .fp-client-menu-modern .list-menu {
        padding: 10px !important;
        display: block !important;
    }

    .fp-client-menu-modern .list-menu li {
        margin-bottom: 5px !important;
    }

    .fp-client-menu-modern .list-menu li .link {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        padding: 12px 15px !important;
        border-radius: 12px !important;
        background: transparent !important;
        border: none !important;
        color: #64748b !important;
        box-shadow: none !important;
    }

    [data-theme="dark"] .fp-client-menu-modern .list-menu li .link {
        color: #94a3b8 !important;
    }

    .fp-client-menu-modern .list-menu li .link.active {
        background: #0d6efd !important;
        color: #fff !important;
    }

    .fp-client-menu-modern .list-menu li .link .icon {
        margin: 0 12px 0 0 !important;
        font-size: 20px !important;
    }

    .fp-client-menu-modern .list-menu li .link .text {
        font-size: 13px !important;
        font-weight: 600 !important;
    }

    .fp-client-menu-modern .menu-divider {
        height: 1px;
        background: #f1f5f9;
        margin: 10px 0 !important;
        display: block !important;
    }

    [data-theme="dark"] .fp-client-menu-modern .menu-divider {
        background: #262626;
    }

    /* STICKY HEADER & STORIES OPTIMIZATION */
    .fp-header {
        position: relative !important; /* Header scrolls away now */
        top: 0 !important;
        z-index: 1001 !important;
        background: #fff !important;
        padding: 6px 0 !important;
    }

    [data-theme="dark"] .fp-header {
        background: #121212 !important;
    }

    .fp-header .grid {
        gap: 8px !important;
        align-items: center !important;
    }

    .logo img {
        max-height: 24px !important;
    }

    .search-box input {
        padding: 8px 45px 8px 15px !important;
        height: 38px !important;
        font-size: 13px !important;
    }

    .mobile-auth-btn {
        height: 34px !important;
        font-size: 11px !important;
    }

    .top-brands-section {
        position: sticky !important;
        top: 0 !important; /* Sticks to the very top of the screen */
        z-index: 1000 !important;
        background: rgba(255, 255, 255, 0.95) !important;
        backdrop-filter: blur(10px) !important;
        padding: 0 !important; /* Minimized padding */
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05) !important;
        margin-bottom: -41px !important; /* Exact value as requested */
    }
    [data-theme="dark"] .top-brands-section {
        background: rgba(18, 18, 18, 0.95) !important;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2) !important;
    }

    .top-brands-slider-wrap {
        padding: 0 !important;
        overflow: hidden !important; 
    }

    .top-brands-slider {
        padding: 12px 0 !important; /* Internal padding allows shadows and rings to show without being clipped by overflow:hidden */
        margin-top: -8px !important;
        margin-bottom: -41px !important;
    }

    .fp-slider-area {
        margin-top: -25px !important; /* Aggressively pulling up to close the gap */
    }

    .fp-swiper-home {
        height: 230px !important;
        border-radius: 15px !important;
        margin: 5px 0 !important;
    }

    .modern-footer {
        padding-bottom: 90px !important;
    }
}

@media (max-width: 576px) {
    /* Small mobile adjustments */
    .payment-methods {
        grid-template-columns: 1fr !important;
    }

    .auth-form-grid {
        grid-template-columns: 1fr !important;
    }

    .balance-actions {
        flex-wrap: wrap;
    }

    .balance-action-btn {
        flex: 1 1 calc(50% - 10px);
        justify-content: center;
    }
}
