/* assets/css/style.css */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --primary-color: #D84315;
    --primary-dark: #BF360C;
    --secondary-color: #2563EB;
    --secondary-dark: #1d4ed8;
    --dark-color: #0D1B2A;
    --light-color: #F3F4F6;
    --paper-color: #FFFFFF;
    --text-color: #111111;
    --text-muted: #6b7280;
    --border-color: #e5e7eb;
    
    --light-blue: #E8F0FF;
    --light-red: #FFF3E0;
    
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #DC2626;
    
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-pill: 50px;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
}

body {
    font-family: 'Inter', sans-serif;
    color: var(--text-main);
    background-color: var(--light-color);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--dark-color);
    font-weight: 700;
    line-height: 1.2;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-dark);
}

/* Utilities */
.text-muted { color: var(--text-muted) !important; }
.text-primary { color: var(--primary-color) !important; }
.text-secondary { color: var(--secondary-color) !important; }
.bg-primary { background-color: var(--primary-color) !important; }
.bg-light { background-color: var(--light-color) !important; }
.bg-white { background-color: var(--paper-color) !important; }
.border-custom { border-color: var(--border-color) !important; }

/* Custom Spacing */
.section-padding { padding: 80px 0; }
.section-title { margin-bottom: 40px; font-weight: 800; font-size: 2.25rem; }

/* Reels Block in Feed */
.reels-block {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    padding: 10px 16px 20px 16px;
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
}
.reels-block::-webkit-scrollbar { height: 6px; }
.reels-block::-webkit-scrollbar-thumb { background: #ccc; border-radius: 10px; }
.reel-card {
    flex: 0 0 auto;
    width: 140px;
    height: 240px;
    border-radius: 12px;
    background-size: cover;
    background-position: center;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: transform 0.2s;
    text-decoration: none !important;
}
.reel-card:hover { transform: translateY(-3px); }
.reel-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, transparent 60%);
    z-index: 1;
    pointer-events: none;
}
.reel-thumb-media {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
    pointer-events: none;
}
.reel-stats {
    z-index: 2;
}
.reel-play {
    z-index: 2;
    position: absolute;
    top: 10px;
    right: 10px;
    width: 25px;
    height: 25px;
    background: rgba(255,255,255,0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #D84315;
    font-size: 10px;
}
.reel-author {
    z-index: 2;
    position: absolute;
    bottom: 12px;
    left: 10px;
    right: 10px;
    color: white;
    font-size: 0.85rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

    
body {
    background-color: var(--light-color) !important;
    color: var(--text-color) !important;
}
.bg-light { background-color: var(--light-color) !important; }
.bg-dark { background-color: var(--dark-color) !important; }
.text-primary { color: var(--primary-color) !important; }
.bg-primary { background-color: var(--primary-color) !important; }
.btn-primary-custom { background-color: var(--primary-color); color: white; }
.btn-outline-custom { border-color: var(--secondary-color); color: var(--secondary-color); }
.btn-outline-custom:hover { background-color: var(--secondary-color); color: white; }
    

/* =========================================
   RESPONSIVE DESIGN & MOBILE OPTIMIZATIONS
   ========================================= */
.mobile-bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: #ffffff;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
    z-index: 1050;
    border-top: 1px solid var(--border-color);
    justify-content: space-around;
    padding-bottom: env(safe-area-inset-bottom);
}
.mobile-bottom-nav .nav-item {
    text-align: center;
    padding: 8px 2px 6px 2px;
    color: #64748b;
    text-decoration: none;
    font-size: 0.65rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    font-weight: 600;
    width: 20%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.2s ease;
}
.mobile-bottom-nav .nav-item i { font-size: 1.25rem; margin-bottom: 1px; }
.mobile-bottom-nav .nav-item.active { color: var(--primary-color); }
.mobile-bottom-nav .nav-item:hover { color: var(--secondary-color); }

/* Reel Card Enhancements */
.reel-stats {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(0,0,0,0.6);
    color: white;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}
.reel-actions-overlay {
    position: absolute;
    bottom: 8px;
    left: 8px;
    right: 8px;
    z-index: 10;
}
.reel-author {
    z-index: 2;
    bottom: 42px !important;
    font-size: 0.8rem !important;
}
.reel-play { display: none !important; }

@media (max-width: 991px) {
    .navbar-custom .navbar-collapse {
        background: #ffffff;
        padding: 16px 20px;
        border-radius: 16px;
        margin-top: 12px;
        box-shadow: 0 12px 30px rgba(0, 0, 0, 0.1);
        border: 1px solid var(--border-color);
    }
    .navbar-custom .nav-link {
        padding: 10px 14px;
        border-radius: 8px;
    }
    .navbar-custom .nav-link:hover, 
    .navbar-custom .nav-link.active {
        background: rgba(37, 99, 235, 0.08);
    }
}

@media (max-width: 768px) {
    .mobile-bottom-nav { display: flex !important; }
    body { padding-bottom: 85px !important; }
    
    /* Strict relative fluid layout for mobile so nothing cuts out */
    .feed-layout {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        padding: 12px 10px !important;
        margin: 0 !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important;
    }

    .center-feed {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
        margin: 0 !important;
    }

    .create-post-card {
        padding: 12px 10px !important;
        border-radius: 14px !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .create-post-input {
        min-width: 0 !important;
        flex: 1 1 auto !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        font-size: 0.82rem !important;
        padding: 8px 12px !important;
    }
    
    /* Ensure containers have neat gutters on mobile so text never touches screen edges */
    .container, .container-fluid {
        padding-left: 12px !important;
        padding-right: 12px !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    
    /* Preserve clean card aesthetics on mobile */
    .card-custom {
        border-radius: var(--radius-lg) !important;
        margin-bottom: 16px;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .card.p-4, .card.p-md-5 {
        padding: 18px 14px !important;
    }

    /* Headings fluid scaling */
    .display-4 { font-size: 1.85rem !important; line-height: 1.25 !important; }
    .display-5 { font-size: 1.6rem !important; line-height: 1.3 !important; }
    .display-6 { font-size: 1.35rem !important; line-height: 1.3 !important; }
    .section-padding { padding: 45px 0 !important; }
    .section-title { font-size: 1.55rem !important; margin-bottom: 24px !important; }
    
    /* Reels block smooth scrolling */
    .reels-block { 
        padding: 8px 10px 14px 10px !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        -webkit-overflow-scrolling: touch;
    }
}

/* Global Overflow Fix */
html { width: 100%; overflow-x: hidden; scrollbar-gutter: stable; }
body { width: 100%; overflow-x: hidden; }
body.modal-open { padding-right: 0 !important; overflow: hidden !important; }
body.modal-open .navbar, body.modal-open .fixed-top, body.modal-open .sticky-top { padding-right: 0 !important; }




/* =========================================
   FLEXBOX BLOWOUT FIX (Prevents Right-Side Cutoff)
   ========================================= */

/* 1. Prevent Header Flex Blowout */
.feed-header {
    /* Make sure the header never exceeds 100% width */
    max-width: 100%;
    min-width: 0; 
}

.feed-meta {
    /* CRITICAL: Allows this flex child to shrink below its content's intrinsic width */
    min-width: 0; 
    flex: 1;
}

.feed-meta .business-name {
    /* If the business name is incredibly long, it will truncate with '...' instead of breaking the screen */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block; /* Required for truncation to work */
}

/* 2. Prevent Reels Block Flex Blowout */
.feed-post {
    /* Double safety */
    max-width: 100%;
    box-sizing: border-box;
}

/* 3. Ensure Container behaves strictly */
.container, .container-fluid {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* 4. Ensure images never exceed their container */
img {
    max-width: 100%;
    height: auto;
}


/* =========================================
   RESPONSIVE HERO SEARCH & TOUCH POLISH
   ========================================= */
.search-pill-card {
    border-radius: 18px !important;
    padding: 12px !important;
    background: rgba(255, 255, 255, 0.16) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
.search-pill-card .input-group-text,
.search-pill-card .form-control {
    border-radius: 12px !important;
}

@media (min-width: 768px) {
    .search-pill-card {
        border-radius: 999px !important;
        padding: 8px !important;
    }
    .search-pill-card .input-group:first-child .input-group-text {
        border-radius: 999px 0 0 999px !important;
    }
    .search-pill-card .input-group:first-child .form-control {
        border-radius: 0 !important;
    }
    .search-pill-card .input-group:nth-child(2) .input-group-text,
    .search-pill-card .input-group:nth-child(2) .form-control {
        border-radius: 0 !important;
    }
    .search-pill-card button {
        border-radius: 999px !important;
    }
}

/* Touch momentum for horizontal scroll bars */
.reels-block, .feed-filter-pills, .nav-tabs-custom, .table-responsive {
    -webkit-overflow-scrolling: touch;
}

/* Prevent auto-zoom on mobile inputs */
@media (max-width: 767.98px) {
    .form-control, .form-select {
        font-size: 16px;
    }
}


/* =========================================
   BOOTSTRAP MODAL STABILITY & ANTI-FLICKER
   ========================================= */
.modal {
    z-index: 1060 !important;
}
.modal-backdrop {
    z-index: 1050 !important;
}
.modal-backdrop.show {
    opacity: 0.5 !important;
}
body.modal-open {
    padding-right: 0 !important;
    overflow: hidden !important;
}
