/* =====================================
   MAKERHUB - GLOBAL MOBILE CSS
   Applies to all pages
===================================== */

/* ===== BASE MOBILE FIXES ===== */
@media (max-width: 768px) {
    /* Prevent horizontal overflow */
    html, body {
        overflow-x: hidden !important;
        max-width: 100vw !important;
    }
    
    /* Container padding */
    .container,
    .content,
    main,
    section {
        padding-left: 15px !important;
        padding-right: 15px !important;
        max-width: 100vw !important;
        box-sizing: border-box !important;
    }
    
    /* Tables responsive */
    table {
        display: block !important;
        overflow-x: auto !important;
        white-space: nowrap !important;
        -webkit-overflow-scrolling: touch !important;
        max-width: 100% !important;
    }
    
    /* Forms */
    input, select, textarea, button {
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    select,
    textarea {
        width: 100% !important;
        font-size: 16px !important; /* Prevents zoom on iOS */
    }
    
    /* Buttons */
    .btn, button {
        min-height: 44px !important; /* Touch friendly */
    }
    
    /* Images */
    img:not(.logo):not(.icon):not(.avatar) {
        max-width: 100% !important;
        height: auto !important;
    }
    
    /* Flex containers */
    .flex-row,
    [style*="display: flex"][style*="gap"] {
        flex-wrap: wrap !important;
    }
    
    /* Grid containers */
    .grid,
    [class*="grid"] {
        grid-template-columns: 1fr !important;
    }
    
    /* Hide on mobile */
    .hide-mobile,
    .desktop-only {
        display: none !important;
    }
    
    /* Show on mobile */
    .show-mobile,
    .mobile-only {
        display: block !important;
    }
}

/* ===== HEADER MOBILE ===== */
@media (max-width: 768px) {
    .header,
    header {
        padding: 10px 15px !important;
    }
    
    .header-container {
        padding: 0 !important;
    }
    
    .nav-menu:not(.mobile-open) {
        display: none !important;
    }
    
    .mobile-menu-toggle {
        display: flex !important;
    }
    
    .header-buttons:not(.mobile-auth-buttons) {
        display: none !important;
    }
}

/* ===== SIDEBAR MOBILE ===== */
@media (max-width: 768px) {
    
    
    
    
    .main-content,
    .content-area {
        margin-left: 0 !important;
        width: 100% !important;
    }
}

/* ===== FOOTER MOBILE ===== */
@media (max-width: 768px) {
    .footer,
    footer {
        padding: 30px 15px !important;
    }
    
    .footer-row,
    .footer-grid,
    .footer-content {
        flex-direction: column !important;
        gap: 25px !important;
        text-align: center !important;
    }
    
    .footer-col,
    .footer-section {
        width: 100% !important;
        text-align: center !important;
    }
}

/* ===== CARDS MOBILE ===== */
@media (max-width: 768px) {
    .card,
    .panel,
    .box {
        padding: 15px !important;
        margin: 10px 0 !important;
    }
    
    .cards-grid,
    .card-container {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }
}

/* ===== MODALS MOBILE ===== */
@media (max-width: 768px) {
    .modal,
    .modal-content,
    .popup {
        width: 95% !important;
        max-width: 95vw !important;
        margin: 10px auto !important;
        max-height: 90vh !important;
        overflow-y: auto !important;
    }
}

/* ===== TYPOGRAPHY MOBILE ===== */
@media (max-width: 768px) {
    h1 {
        font-size: 1.8rem !important;
    }
    
    h2 {
        font-size: 1.5rem !important;
    }
    
    h3 {
        font-size: 1.25rem !important;
    }
    
    p, li {
        font-size: 0.95rem !important;
        line-height: 1.6 !important;
    }
}

/* ===== DASHBOARD PAGES ===== */
@media (max-width: 768px) {
    .dashboard-container,
    .dashboard-content {
        padding: 15px !important;
    }
    
    .stats-grid,
    .stats-container {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }
    
    .stat-card {
        padding: 15px !important;
    }
    
    .stat-value {
        font-size: 1.5rem !important;
    }
}

/* ===== FORMS PAGES ===== */
@media (max-width: 768px) {
    .form-container,
    .form-wrapper {
        padding: 20px 15px !important;
    }
    
    .form-row {
        flex-direction: column !important;
        gap: 15px !important;
    }
    
    .form-group {
        width: 100% !important;
    }
    
    label {
        font-size: 0.9rem !important;
    }
}

/* ===== PRICING CARDS ===== */
@media (max-width: 768px) {
    .pricing-grid {
        grid-template-columns: 1fr !important;
        gap: 20px !important;
    }
    
    .pricing-card {
        max-width: 100% !important;
        margin: 0 auto !important;
    }
}

/* ===== LANDING PAGES ===== */
@media (max-width: 768px) {
    .hero-section {
        padding: 40px 15px !important;
        text-align: center !important;
    }
    
    .hero-content {
        max-width: 100% !important;
    }
    
    .hero-image {
        margin-top: 30px !important;
    }
    
    .hero-image img {
        max-width: 100% !important;
    }
    
    .cta-buttons {
        flex-direction: column !important;
        gap: 10px !important;
    }
    
    .cta-buttons .btn {
        width: 100% !important;
    }
}

/* ===== SPECIFIC PAGE FIXES ===== */

/* Plans page */
@media (max-width: 768px) {
    .plan-features {
        text-align: left !important;
    }
}

/* Trackrecord page */
@media (max-width: 768px) {
    .trades-table {
        font-size: 12px !important;
    }
    
    .trades-table th,
    .trades-table td {
        padding: 8px 5px !important;
        min-width: 60px !important;
    }
}

/* Emails page */
@media (max-width: 768px) {
    .email-editor {
        min-height: 200px !important;
    }
    
    .email-preview {
        margin-top: 20px !important;
    }
}

/* Payments page */
@media (max-width: 768px) {
    .payment-history {
        overflow-x: auto !important;
    }
}

/* CreateLanding page */
@media (max-width: 768px) {
    .landing-preview {
        display: none !important;
    }
    
    .landing-form {
        width: 100% !important;
    }
    
    .color-picker-row {
        flex-wrap: wrap !important;
    }
}

/* Ajoutcanal page */
@media (max-width: 768px) {
    .channel-form {
        padding: 20px 15px !important;
    }
    
    .channel-preview {
        margin-top: 20px !important;
    }
}

/* Telegram subscription page */
@media (max-width: 768px) {
    .subscription-options {
        flex-direction: column !important;
    }
    
    .subscription-card {
        width: 100% !important;
    }
}

/* Statistics page */
@media (max-width: 768px) {
    .chart-container {
        height: 250px !important;
        overflow-x: auto !important;
    }
}

/* Avis page */
@media (max-width: 768px) {
    .review-card {
        padding: 15px !important;
    }
    
    .reviews-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ===== HAMBURGER MENU FIX ===== */
@media (max-width: 768px) {
    .menu-toggle,
    #menuToggle {
        display: flex !important;
        position: fixed !important;
        top: 16px !important;
        left: 16px !important;
        right: auto !important;
        z-index: 1001 !important;
        width: 44px !important;
        height: 44px !important;
        border-radius: 10px !important;
        background: #1a2f45 !important;
        border: none !important;
        color: #fff !important;
        font-size: 20px !important;
        cursor: pointer !important;
        align-items: center !important;
        justify-content: center !important;
        box-shadow: 0 2px 10px rgba(0,0,0,.3) !important;
    }
    
    .sidebar.active,
    #sidebar.active {
        transform: translateX(0) !important;
        left: 0 !important;
    }
}

/* ===== SIDEBAR MOBILE COLORS FIX ===== */
@media (max-width: 768px) {
    #sidebar,
    
    
    #sidebar 
    
    #sidebar .nav-menu,
    
    
    #sidebar .nav-link,
    
    
    #sidebar .nav-link:hover,
    
    
    #sidebar .nav-link.active,
    
    
    #sidebar .nav-link span,
    
    
    #sidebar .nav-link i,
    
    
    #sidebar .logo-text,
    
    
    #sidebar .logo-text .hub,
    
}

/* ===== SIDEBAR NAV LINKS VISIBILITY FIX ===== */
@media (max-width: 768px) {
    #sidebar .nav-menu,
    
    
    #sidebar .nav-link,
    .sidebar .nav-link,
    #sidebar .nav-menu a,
    
    
    #sidebar .nav-link.active,
    .sidebar .nav-link.active,
    #sidebar .nav-menu a.active,
    
    
    #sidebar .nav-link span,
    .sidebar .nav-link span,
    #sidebar .nav-menu a span {
        display: inline !important;
        visibility: visible !important;
        opacity: 1 !important;
        color: inherit !important;
    }
    
    #sidebar .nav-link i,
    .sidebar .nav-link i,
    #sidebar .nav-menu a i {
        display: inline-block !important;
        visibility: visible !important;
        opacity: 1 !important;
        color: inherit !important;
        width: 20px !important;
        font-size: 18px !important;
    }
}

/* ===== PAGES SPÉCIFIQUES MOBILE FIX ===== */

/* Translation page (telegrammultilanguage) */
@media (max-width: 768px) {
    .translation-container,
    .language-settings,
    .translation-settings {
        padding: 10px !important;
        width: 100% !important;
        max-width: 100vw !important;
        box-sizing: border-box !important;
    }
    
    .language-card,
    .translation-card {
        width: 100% !important;
        margin: 10px 0 !important;
    }
    
    .language-select,
    .translation-select {
        width: 100% !important;
    }
}

/* Emails page */
@media (max-width: 768px) {
    .emails-container,
    .email-list,
    .email-content {
        padding: 10px !important;
        width: 100% !important;
        max-width: 100vw !important;
        overflow-x: hidden !important;
    }
    
    .email-item {
        flex-direction: column !important;
        padding: 10px !important;
    }
    
    .email-actions {
        margin-top: 10px !important;
        width: 100% !important;
        justify-content: flex-end !important;
    }
}

/* Analytics/Statistics page */
@media (max-width: 768px) {
    .stats-container,
    .analytics-container,
    .chart-wrapper {
        padding: 10px !important;
        width: 100% !important;
        max-width: 100vw !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    .stats-table,
    .analytics-table {
        display: block !important;
        overflow-x: auto !important;
        white-space: nowrap !important;
        -webkit-overflow-scrolling: touch !important;
        max-width: 100% !important;
        font-size: 12px !important;
    }
    
    .stats-table th,
    .stats-table td,
    .analytics-table th,
    .analytics-table td {
        padding: 8px 5px !important;
        min-width: 60px !important;
    }
    
    .chart-container canvas {
        max-width: 100% !important;
        height: auto !important;
    }
}

/* Payments page */
@media (max-width: 768px) {
    .payments-container,
    .payment-list,
    .payment-history {
        padding: 10px !important;
        width: 100% !important;
        max-width: 100vw !important;
        overflow-x: hidden !important;
    }
    
    .payment-table,
    .transactions-table {
        display: block !important;
        overflow-x: auto !important;
        white-space: nowrap !important;
        -webkit-overflow-scrolling: touch !important;
        max-width: 100% !important;
        font-size: 12px !important;
    }
    
    .payment-table th,
    .payment-table td,
    .transactions-table th,
    .transactions-table td {
        padding: 8px 5px !important;
        min-width: 70px !important;
    }
    
    .payment-card,
    .transaction-item {
        flex-direction: column !important;
        padding: 10px !important;
        gap: 8px !important;
    }
    
    .payment-amount,
    .transaction-amount {
        font-size: 16px !important;
    }
}

/* Global table scroll indicator */
@media (max-width: 768px) {
    .table-container,
    .table-wrapper,
    [class*="table"] {
        position: relative !important;
    }
    
    .table-container::after,
    .table-wrapper::after {
        content: '← Scroll →' !important;
        display: block !important;
        text-align: center !important;
        font-size: 11px !important;
        color: #888 !important;
        padding: 5px !important;
        background: rgba(0,0,0,0.05) !important;
        border-radius: 4px !important;
        margin-top: 5px !important;
    }
}

/* Main content area mobile fix */
@media (max-width: 768px) {
    .main-content,
    .content-wrapper,
    .page-content,
    main {
        margin-left: 0 !important;
        padding: 15px !important;
        width: 100% !important;
        max-width: 100vw !important;
        box-sizing: border-box !important;
    }
    
    .page-header,
    .content-header {
        padding: 10px 15px !important;
        flex-direction: column !important;
        gap: 10px !important;
    }
    
    .page-title,
    h1, h2 {
        font-size: 1.5rem !important;
    }
}

/* ===== PAYMENTS PAGE MOBILE FIX ===== */
@media (max-width: 768px) {
    .dashboard-container {
        display: block !important;
        width: 100% !important;
        max-width: 100vw !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100vw !important;
        padding: 60px 15px 15px 15px !important;
        box-sizing: border-box !important;
    }
    
    .content {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    .header {
        padding: 10px 15px !important;
    }
    
    .header-content {
        flex-direction: column !important;
        gap: 10px !important;
        align-items: flex-start !important;
    }
    
    .header-title {
        width: 100% !important;
    }
    
    .header-actions {
        width: 100% !important;
        justify-content: flex-end !important;
    }
    
    .card,
    .card-highlight,
    .stripe-config-section {
        width: 100% !important;
        max-width: 100% !important;
        margin: 10px 0 !important;
        padding: 15px !important;
        box-sizing: border-box !important;
    }
    
    .card-content {
        width: 100% !important;
    }
    
    .config-steps {
        width: 100% !important;
    }
    
    .step-item {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 10px !important;
    }
    
    .step-content {
        width: 100% !important;
    }
    
    .config-button-container {
        width: 100% !important;
    }
    
    .config-button-container a,
    .config-button-container button {
        width: 100% !important;
        text-align: center !important;
    }
}

/* ===== TRANSLATION PAGE MOBILE FIX ===== */
@media (max-width: 768px) {
    .translation-section,
    .active-translations-section {
        max-width: 100% !important;
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    #active-translations-container {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
    }
    
    #active-translations-container > div,
    .translation-item,
    .channel-card,
    .active-translation-card {
        width: 100% !important;
        max-width: 100% !important;
        margin: 10px 0 !important;
        padding: 12px !important;
        box-sizing: border-box !important;
        overflow-wrap: break-word !important;
        word-break: break-all !important;
    }
    
    .content-wrapper {
        width: 100% !important;
        max-width: 100% !important;
        padding: 10px !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important;
    }
    
    .page-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 10px !important;
        padding: 10px !important;
    }
    
    .form-group {
        width: 100% !important;
    }
    
    .form-input,
    .form-select {
        width: 100% !important;
        box-sizing: border-box !important;
    }
    
    /* Fix long URLs */
    .channel-card a,
    .channel-card span,
    #active-translations-container a,
    #active-translations-container span {
        word-break: break-all !important;
        overflow-wrap: break-word !important;
        max-width: 100% !important;
        display: inline-block !important;
    }
}

/* ===== TRACK RECORD PAGE MOBILE FIX ===== */
@media (max-width: 768px) {
    .registered-channels,
    .channels-list,
    .channel-item,
    .channel-card {
        width: 100% !important;
        max-width: 100% !important;
        margin: 8px 0 !important;
        padding: 10px !important;
        box-sizing: border-box !important;
    }
    
    .channel-item,
    .channel-card {
        flex-direction: row !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
    }
    
    .channel-item > *,
    .channel-card > * {
        flex-shrink: 1 !important;
        min-width: 0 !important;
    }
    
    .channel-name,
    .channel-url,
    .channel-link {
        word-break: break-all !important;
        overflow-wrap: break-word !important;
        max-width: 100% !important;
        font-size: 13px !important;
    }
    
    .channel-status {
        flex-shrink: 0 !important;
    }
    
    .channel-actions,
    .channel-delete {
        flex-shrink: 0 !important;
        margin-left: auto !important;
    }
    
    /* Fix container overflow */
    .trackrecord-container,
    .track-record-content,
    [class*="trackrecord"],
    [class*="track-record"] {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: hidden !important;
        padding: 10px !important;
        box-sizing: border-box !important;
    }
}
