/* Custom Styles for BuildConnect PHP */

/* Rupee symbol consistency fix */
.rupee, [data-currency] {
    font-family: 'Noto Sans', 'Segoe UI', Arial, sans-serif;
    font-weight: inherit; /* Match the surrounding element's weight */
}

* {
    scroll-behavior: smooth;
}

body {
    font-family: 'Poppins', sans-serif;
    color: #1f2937;
}

html {
    scroll-behavior: smooth;
}

/* Animation Classes */
[data-animate] {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

[data-animate].animate-in {
    opacity: 1;
    transform: translateY(0);
}

/* Staggered animation delays */
[data-animate][data-delay="1"] {
    transition-delay: 0.1s;
}

[data-animate][data-delay="2"] {
    transition-delay: 0.2s;
}

[data-animate][data-delay="3"] {
    transition-delay: 0.3s;
}

[data-animate][data-delay="4"] {
    transition-delay: 0.4s;
}

[data-animate][data-delay="5"] {
    transition-delay: 0.5s;
}

/* Fade in animation for tab content */
.fade-in {
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Hide scrollbar for carousel */
.scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.scrollbar-hide::-webkit-scrollbar {
    display: none;
}

/* Smooth transitions for interactive elements */
button, a {
    transition: all 0.2s ease-out;
}

/* Hover scale effect */
.hover-scale:hover {
    transform: scale(1.04);
}

/* Hover lift effect */
.hover-lift:hover {
    transform: translateY(-6px);
}

/* Active nav link styling */
.nav-link.active {
    color: #F97316;
    font-weight: 600;
}

/* Mobile menu transition */
.mobile-menu {
    transition: max-height 0.3s ease-out, opacity 0.3s ease-out;
}

/* Line clamp utilities (for older browsers) */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Backdrop blur fallback */
@supports not (backdrop-filter: blur(10px)) {
    .backdrop-blur-sm {
        background-color: rgba(255, 255, 255, 0.95);
    }
}

/* Focus styles for accessibility */
button:focus-visible,
a:focus-visible {
    outline: 2px solid #F97316;
    outline-offset: 2px;
}

/* Screen reader only class */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.sr-only:focus {
    position: static;
    width: auto;
    height: auto;
    padding: 0.5rem 1rem;
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* ── Rupee symbol — always renders thin (weight 300) sitewide ──────────
   Uses unicode-range @font-face to intercept only U+20B9 (₹) and serve
   it at weight 300 from the already-loaded Poppins font, regardless of
   what font-weight the parent element has.
   ──────────────────────────────────────────────────────────────────── */
@font-face {
    font-family: 'PoppinsRupeeThin';
    src: url('https://fonts.gstatic.com/s/poppins/v21/pxiByp8kv8JHgFVrLDz8Z1xlFd2JQEk.woff2') format('woff2');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
    unicode-range: U+20B9; /* ₹ Rupee Sign only */
}

body,
h1, h2, h3, h4, h5, h6,
p, span, div, td, th, label, button, a, li {
    font-family: 'PoppinsRupeeThin', 'Poppins', sans-serif;
}

/* Fix for existing bottom sheets (kyc, leads, mappings, etc.) */
@media (max-width: 768px) {
    /* Hide desktop tables */
    .hidden.md\:block,
    .desktop-table-wrapper {
        display: none !important;
    }
    
    /* Show mobile cards */
    .block.md\:hidden,
    .mobile-table-wrapper {
        display: block !important;
    }
    
    /* Ensure all bottom sheets work */
    #req-panel, #kyc-panel, #lead-panel, #mapping-panel, #quote-panel, #payment-sheet, #provider-panel {
        z-index: 210 !important;
    }
    
    #req-panel-overlay, #kyc-panel-overlay, #lead-panel-overlay, #mapping-panel-overlay, #quote-panel-overlay, #payment-overlay, #provider-overlay {
        z-index: 209 !important;
    }
}

/* Mobile card styles */
.mobile-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.mobile-card:hover {
    background: #f9fafb;
}

.mobile-card:active {
    background: #f3f4f6;
}

.mobile-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mobile-card-content {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mobile-card-item {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.mobile-card-label {
    font-size: 11px;
    font-weight: 700;
    color: #9ca3af;
    text-transform: uppercase;
}

.mobile-card-value {
    font-size: 12px;
    color: #1f2937;
    font-weight: 600;
    text-align: right;
}

/* ================ RESPONSIVE STYLES ================ */

/* Prevent horizontal scroll on mobile */
html, body {
    overflow-x: hidden;
}

/* Mobile Card View for Tables */
.mobile-table-wrapper {
    display: none;
}

@media (max-width: 768px) {
    /* Hide desktop tables on mobile */
    .desktop-table-wrapper {
        display: none !important;
    }
    
    /* Show mobile card view */
    .mobile-table-wrapper {
        display: block !important;
    }
    
    /* Mobile bottom sheet/modal styles */
    .mobile-bottom-sheet {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 1000;
        background: #fff;
        border-radius: 20px 20px 0 0;
        max-height: 88vh;
        overflow-y: auto;
        box-shadow: 0 -8px 32px rgba(0,0,0,0.18);
        transform: translateY(100%);
        transition: transform 0.3s ease;
    }
    
    .mobile-bottom-sheet.open {
        transform: translateY(0);
    }
    
    .mobile-overlay {
        display: none;
        position: fixed;
        inset: 0;
        z-index: 999;
        background: rgba(0,0,0,0.5);
    }
    
    .mobile-overlay.open {
        display: block;
    }
}

/* Responsive Modals */
@media (max-width: 768px) {
    /* Make all modals full width on mobile with max height */
    [id*="modal"]:not(.hidden) .bg-white,
    [id*="Modal"]:not(.hidden) .bg-white {
        width: 95% !important;
        max-width: 95% !important;
        max-height: 90vh !important;
        overflow-y: auto !important;
        border-radius: 16px !important;
    }
    
    /* Ensure modal content is scrollable */
    [id*="modal"] .overflow-y-auto,
    [id*="Modal"] .overflow-y-auto {
        max-height: calc(80vh - 100px) !important;
    }
    
    /* Stack buttons vertically in modals */
    [id*="modal"] .flex.justify-end.gap-3,
    [id*="Modal"] .flex.justify-end.gap-3 {
        flex-direction: column !important;
        width: 100% !important;
    }
    
    [id*="modal"] .flex.justify-end.gap-3 button,
    [id*="Modal"] .flex.justify-end.gap-3 button {
        width: 100% !important;
    }
}

/* Filter bars - stack vertically on mobile */
@media (max-width: 768px) {
    .filter-bar {
        flex-direction: column !important;
        align-items: stretch !important;
    }
    
    .filter-bar > * {
        width: 100% !important;
    }
}

/* Mobile Card Styles */
.mobile-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.mobile-card:hover {
    background-color: #f9fafb;
}

.mobile-card .mobile-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.mobile-card .mobile-card-content {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

.mobile-card .mobile-card-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mobile-card .mobile-card-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: #9ca3af;
}

.mobile-card .mobile-card-value {
    font-size: 13px;
    color: #374151;
    font-weight: 500;
}

.mobile-card .mobile-card-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.mobile-card .mobile-card-actions button,
.mobile-card .mobile-card-actions a {
    flex: 1;
    min-width: 0;
}

/* Styles for existing bottom sheets (kyc, leads, mappings, etc.) */
@media (max-width: 768px) {
    /* Ensure all existing bottom sheets animate and are styled correctly */
    #req-panel,
    #kyc-panel,
    #lead-panel,
    #mapping-panel,
    #quote-panel,
    #payment-sheet,
    #provider-panel {
        transform: translateY(100%) !important;
    }
    
    /* Show sheet when it has display: block */
    #req-panel[style*="display: block"],
    #kyc-panel[style*="display: block"],
    #lead-panel[style*="display: block"],
    #mapping-panel[style*="display: block"],
    #quote-panel[style*="display: block"],
    #payment-sheet[style*="display: block"],
    #provider-panel[style*="display: block"] {
        transform: translateY(0) !important;
    }
}

