/* ===================================================
   TRANSFOLOOP - Premium Transformer Industry Platform
   Updated & Enhanced - May 2026
   =================================================== */

/* --- CSS Custom Properties --- */
:root {
    --tf-navbar-h: 74px;   /* ← single source of truth for navbar height */
    --tf-primary: #f59e0b;
    --tf-primary-dark: #d97706;
    --tf-secondary: #0f172a;
    --tf-accent: #3b82f6;
    --tf-success: #10b981;
    --tf-danger: #ef4444;
    --tf-warning: #f59e0b;
    --tf-dark: #111827;
    --tf-gray-50: #f8fafc;
    --tf-gray-100: #f1f5f9;
    --tf-gray-200: #e2e8f0;
    --tf-gray-300: #cbd5e1;
    --tf-gray-500: #64748b;
    --tf-gray-600: #475569;
    --tf-gray-700: #334155;
    --tf-gray-800: #1e2937;
    --tf-gray-900: #0f172a;
    --tf-radius: 12px;
    --tf-radius-lg: 16px;
    --tf-radius-xl: 20px;
    --tf-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --tf-shadow-md: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --tf-shadow-lg: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --tf-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==================== BASE STYLES ==================== */
* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 15px;
}

body {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--tf-gray-800);
    background: var(--tf-gray-50);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
    padding-top: var(--tf-navbar-h);
}

/* ==================== NAVBAR ==================== */
.tf-navbar {
    background: rgba(7, 11, 22, 0.96) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 0.85rem 0;           /* fixed vertical padding so height is predictable */
    min-height: var(--tf-navbar-h);
    width: 100% !important;
    border-bottom: 1px solid rgba(245, 158, 11, 0.18);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.4);
    transition: background 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}
.tf-navbar.scrolled {
    background: rgba(4, 7, 14, 0.99) !important;
    border-bottom-color: rgba(245, 158, 11, 0.3);
    box-shadow: 0 4px 36px rgba(0, 0, 0, 0.55);
}

/* ── Logo icon box ── */
.tf-logo-icon {
    width: 32px; height: 32px;
    background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
    border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 10px rgba(245, 158, 11, 0.45);
    flex-shrink: 0; color: #fff;
}
.tf-logo-text {
    font-size: 1.08rem; font-weight: 800;
    letter-spacing: -0.4px; color: #fff; line-height: 1.1;
}
.tf-logo-sub {
    font-size: 0.56rem; font-weight: 600;
    color: rgba(245, 158, 11, 0.72);
    letter-spacing: 0.6px; text-transform: uppercase; line-height: 1;
}

/* ── Nav links ── */
.tf-navbar .navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.65) !important;
    font-weight: 500;
    font-size: 0.86rem;
    padding: 0.4rem 0.65rem !important;
    border-radius: 8px;
    display: flex; align-items: center; gap: 5px;
    transition: color 0.15s ease, background 0.15s ease;
    white-space: nowrap;
}
.tf-navbar .navbar-nav .nav-link:hover {
    color: #fff !important;
    background: rgba(255, 255, 255, 0.08);
}
.tf-navbar .navbar-nav .nav-link.tf-active {
    color: #fbbf24 !important;
    background: rgba(245, 158, 11, 0.1);
    font-weight: 600;
}
.tf-navbar .tf-nav-icon {
    font-size: 0.72rem;
    opacity: 0.65;
    flex-shrink: 0;
    margin-right: 5px;
}

/* ── Post Enquiry button ── */
.tf-post-btn {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 0.83rem !important; font-weight: 700 !important;
    padding: 7px 16px !important; border-radius: 50px !important;
    background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%) !important;
    border: none !important; color: #0a0a0a !important;
    box-shadow: 0 2px 12px rgba(245, 158, 11, 0.38);
    transition: box-shadow 0.2s, transform 0.18s;
    text-decoration: none !important; white-space: nowrap;
    cursor: pointer;
}
.tf-post-btn:hover {
    box-shadow: 0 4px 22px rgba(245, 158, 11, 0.55);
    transform: translateY(-1px);
    color: #000 !important;
}

/* ── Icon buttons (bell, chat, theme) ── */
.tf-iBtn {
    width: 36px; height: 36px;
    border-radius: 9px;
    display: inline-flex; align-items: center; justify-content: center;
    color: rgba(255, 255, 255, 0.7);
    background: transparent; border: none;
    transition: background 0.15s, color 0.15s;
    text-decoration: none !important;
    font-size: 1rem; position: relative; cursor: pointer; flex-shrink: 0;
}
.tf-iBtn:hover, .tf-iBtn:focus { background: rgba(255, 255, 255, 0.1); color: #fff; }

/* ── Avatar chip ── */
.tf-avatar-chip {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 4px 10px 4px 4px; border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    transition: border-color 0.15s, background 0.15s;
    cursor: pointer; text-decoration: none !important;
    color: rgba(255, 255, 255, 0.82) !important;
}
.tf-avatar-chip:hover {
    border-color: rgba(255, 255, 255, 0.3);
    background: rgba(255, 255, 255, 0.07);
    color: #fff !important;
}
.tf-avatar-chip img {
    width: 28px; height: 28px; border-radius: 50%;
    object-fit: cover; flex-shrink: 0;
    border: 1.5px solid rgba(255,255,255,0.2);
}
.tf-avatar-chip .tf-uname {
    font-size: 0.82rem; font-weight: 600;
    max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tf-avatar-chip::after { /* Bootstrap caret */
    border-top-color: rgba(255,255,255,0.5);
    margin-left: 2px;
}

/* ── Thin vertical separator ── */
.tf-nav-sep {
    width: 1px; height: 20px;
    background: rgba(255, 255, 255, 0.12);
    flex-shrink: 0; align-self: center; margin: 0 0.3rem;
}

/* ── Desktop xl+ ── */
@media (min-width: 1200px) {
    .tf-post-label { display: inline !important; }
    .tf-nav-right { gap: 0.1rem; align-items: center; }
    .tf-navbar .tf-nav-icon { display: inline !important; }
}

/* ── Mobile hamburger (< 1200px) ── */
@media (max-width: 1199.98px) {
    .navbar-collapse {
        position: absolute;
        top: var(--tf-navbar-h); left: 0; right: 0;
        z-index: 1049;
        padding: 1rem 1.25rem 1.25rem;
        background: rgba(5, 8, 16, 0.99);
        border-top: 1px solid rgba(255, 255, 255, 0.05);
        border-radius: 0 0 18px 18px;
        box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
    }
    .tf-nav-icon { display: inline !important; opacity: 0.8; font-size: 0.82rem !important; }
    .tf-post-label { display: inline !important; }
    .tf-nav-right {
        width: 100%; flex-direction: column !important;
        align-items: stretch !important; gap: 0.15rem !important;
        margin-top: 0.75rem; padding-top: 0.75rem;
        border-top: 1px solid rgba(255, 255, 255, 0.07);
    }
    .tf-nav-right .nav-item { width: 100%; }
    .tf-post-btn {
        width: 100%; justify-content: center;
        padding: 10px 16px !important; border-radius: 10px !important;
        margin-bottom: 0.2rem;
    }
    .tf-iBtn {
        width: 100%; height: auto; border-radius: 10px !important;
        justify-content: flex-start;
        padding: 0.6rem 0.8rem; gap: 10px; font-size: 0.9rem;
    }
    .tf-avatar-chip {
        border-radius: 10px; padding: 0.6rem 0.8rem;
        width: 100%;
    }
    .tf-avatar-chip img { width: 32px; height: 32px; }
    .tf-avatar-chip .tf-uname { font-size: 0.92rem; max-width: none; }
    .tf-nav-sep { display: none !important; }
    .tf-navbar .navbar-nav .nav-link {
        padding: 0.62rem 0.8rem !important; border-radius: 10px !important;
        font-size: 0.9rem; color: rgba(255,255,255,0.75) !important;
    }
    .tf-navbar .navbar-nav .nav-link:hover { background: rgba(255,255,255,0.07); }
    .tf-navbar .navbar-nav .nav-link.tf-active { color: #fbbf24 !important; }
}

/* ==================== HERO SECTION ==================== */
.tf-hero {
    background: linear-gradient(135deg, #0f172a 0%, #1e40af 50%, #312e81 100%);
    position: relative;
    overflow: hidden;
    margin-top: calc(-1 * var(--tf-navbar-h));
    padding-top: 160px;
    padding-bottom: 120px;
}

.tf-hero::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/svg%3E");
    pointer-events: none;
}

/* ==================== CARDS & HOVER ==================== */
.card, .tf-card {
    border: none;
    border-radius: var(--tf-radius-lg);
    box-shadow: var(--tf-shadow);
    transition: var(--tf-transition);
    overflow: hidden;
}

.tf-card-hover:hover {
    transform: translateY(-8px);
    box-shadow: var(--tf-shadow-lg);
}

/* ==================== BUTTONS ==================== */
.btn {
    font-weight: 600;
    border-radius: 50px;
    padding: 10px 28px;
    transition: var(--tf-transition);
}

.btn-warning {
    background: var(--tf-primary);
    border-color: var(--tf-primary);
    color: #000;
    font-weight: 700;
}

.btn-warning:hover {
    background: #f97316;
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgb(245 158 11 / 0.4);
}

/* ==================== STATS & SECTIONS ==================== */
.tf-stat-number {
    font-size: 2.8rem;
    font-weight: 800;
    background: linear-gradient(90deg, #f59e0b, #fbbf24);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.tf-section {
    padding: 5.5rem 0;
}

.tf-section-title {
    font-size: 2.35rem;
    font-weight: 800;
}

/* Feature Cards */
.tf-feature-card {
    border-radius: var(--tf-radius-xl);
    transition: var(--tf-transition);
}

.tf-feature-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--tf-shadow-lg);
}

/* Testimonials */
.tf-testimonial {
    border-radius: var(--tf-radius-xl);
    background: white;
    box-shadow: var(--tf-shadow);
}

/* ==================== FOOTER ==================== */
.tf-footer {
    background: linear-gradient(180deg, #0f172a 0%, #020617 100%);
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .tf-hero {
        padding-top: 130px !important;
        padding-bottom: 80px;
    }
    
    h1.display-3 {
        font-size: 2.4rem;
    }
    
    .tf-section {
        padding: 3.5rem 0;
    }
}

/* ==================== DARK MODE ==================== */
html.dark {
    --tf-gray-50: #0f172a;
    --tf-gray-900: #f1f5f9;
}

html.dark .card,
html.dark .tf-card,
html.dark .bg-white {
    background: #1e2937 !important;
    border-color: #334155 !important;
    color: #e2e8f0;
}

/* ==================== UTILITIES ==================== */
.text-gradient {
    background: linear-gradient(90deg, #f59e0b, #f97316);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.shadow-soft {
    box-shadow: 0 2px 15px -3px rgb(0 0 0 / 0.07);
}

.cursor-pointer { cursor: pointer; }
.hover-shadow { transition: var(--tf-transition); }
.hover-shadow:hover { box-shadow: var(--tf-shadow-md) !important; transform: translateY(-3px); }

/* ==================== ADMIN PANEL LAYOUT ==================== */
:root {
    --tf-admin-sidebar-width: 260px;
    --tf-primary-light: #fef3c7;
}

.tf-admin-sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--tf-admin-sidebar-width);
    background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
    color: #cbd5e1;
    overflow-y: auto;
    z-index: 1040;
    box-shadow: 4px 0 20px rgba(0,0,0,.06);
    transition: transform 0.3s ease;
}

.tf-admin-sidebar-header {
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.tf-admin-nav-category {
    padding: 0.9rem 1.25rem 0.4rem;
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 1.4px;
    color: #64748b;
    font-weight: 700;
}

.tf-admin-nav-link {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.65rem 1.25rem;
    color: #cbd5e1;
    text-decoration: none;
    font-size: 0.93rem;
    border-left: 3px solid transparent;
    transition: var(--tf-transition);
    position: relative;
}
.tf-admin-nav-link i { width: 18px; text-align: center; opacity: 0.8; }
.tf-admin-nav-link:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
    border-left-color: var(--tf-primary, #f59e0b);
}
.tf-admin-nav-link.active {
    background: linear-gradient(90deg, rgba(245,158,11,0.18), transparent);
    color: #fff;
    border-left-color: var(--tf-primary, #f59e0b);
    font-weight: 600;
}

.tf-badge-count {
    margin-left: auto;
    background: var(--tf-danger, #ef4444);
    color: #fff;
    font-size: 0.65rem;
    padding: 1px 7px;
    border-radius: 999px;
    font-weight: 700;
}

.tf-admin-content {
    margin-left: var(--tf-admin-sidebar-width);
    padding: 1.5rem 2rem;
    min-height: 100vh;
}

.tf-admin-topbar {
    background: #fff;
    border-radius: var(--tf-radius-lg);
    box-shadow: var(--tf-shadow);
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}
html.dark .tf-admin-topbar { background: #1e2937; color: #e2e8f0; }

.tf-admin-toggle {
    display: none;
    position: fixed;
    top: 12px; left: 12px;
    z-index: 1060;
    background: #0f172a;
    color: #fff;
    border: none;
    width: 42px;
    height: 42px;
    border-radius: 10px;
    box-shadow: var(--tf-shadow-md);
    align-items: center;
    justify-content: center;
}

.tf-admin-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1035;
}
.tf-admin-overlay.show { display: block; }

.tf-dark-toggle {
    border: none;
    background: var(--tf-gray-100);
    color: var(--tf-gray-700);
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.tf-dark-toggle .fa-sun { display: none; }
html.dark .tf-dark-toggle .fa-moon { display: none; }
html.dark .tf-dark-toggle .fa-sun { display: inline; }

/* Admin Mobile */
@media (max-width: 991.98px) {
    .tf-admin-sidebar { transform: translateX(-100%); }
    .tf-admin-sidebar.show { transform: translateX(0); }
    .tf-admin-content { margin-left: 0; padding: 4rem 1rem 1.5rem; }
    .tf-admin-toggle { display: inline-flex; }
}

/* Tables on small screens */
@media (max-width: 767.98px) {
    .table-responsive table { font-size: 0.86rem; }
    .tf-admin-topbar { padding: 0.85rem 1rem; flex-wrap: wrap; gap: 0.5rem; }
    .tf-admin-topbar h4 { font-size: 1.1rem; }
}

/* ==================== GLOBAL MOBILE TWEAKS ==================== */
@media (max-width: 575.98px) {
    h1.display-3, h1.display-4 { font-size: 2rem; }
    h2 { font-size: 1.5rem; }
    .lead { font-size: 1rem; }
    .btn-lg { padding: 0.6rem 1.5rem; font-size: 0.95rem; }
    main { padding-top: var(--tf-navbar-h); } /* consistent with navbar min-height */
    .tf-card { border-radius: 12px; }

    /* Reduce huge avatar sizes on tiny screens */
    img.rounded-circle[style*="160px"] { width: 120px !important; height: 120px !important; }

    /* Tighter container padding */
    .container, .container-fluid { padding-left: 1rem; padding-right: 1rem; }
}

/* Navbar mobile collapse: hamburger dropdown styles */
/* (old mobile collapse rule replaced by the navbar-expand-xl rule above) */

/* Form helpers */
.form-control:focus, .form-select:focus {
    border-color: var(--tf-primary, #f59e0b);
    box-shadow: 0 0 0 0.2rem rgba(245, 158, 11, 0.18);
}

/* Dark mode form fixes */
html.dark .form-control, html.dark .form-select {
    background-color: #0f172a;
    color: #e2e8f0;
    border-color: #334155;
}
html.dark .form-control::placeholder { color: #64748b; }
html.dark .list-group-item { background: transparent; color: inherit; border-color: #334155; }
/* ==================== MOBILE RESPONSIVE FIXES ==================== */

/* Navbar - mobile friendly */
@media (max-width: 575.98px) {
    .tf-navbar .btn { padding: 6px 14px; font-size: 0.82rem; }
    .navbar-brand span { font-size: 1rem; }
}

/* Hero sections - mobile */
@media (max-width: 767.98px) {
    .tf-hero h1, .tf-hero .display-3, .tf-hero .display-4 {
        font-size: 1.75rem !important;
        line-height: 1.2 !important;
    }
    .tf-hero .lead { font-size: 0.95rem !important; }
    .tf-hero { padding-left: 1rem; padding-right: 1rem; }
}

/* Cards - full width on mobile */
@media (max-width: 575.98px) {
    .tf-card, .card { border-radius: 12px !important; }
    .btn-lg { padding: 10px 20px; font-size: 0.95rem; }
    .display-5 { font-size: 1.8rem !important; }
}

/* Feed - mobile spacing */
@media (max-width: 767.98px) {
    .container { padding-left: 12px; padding-right: 12px; }
    .p-4.p-md-5 { padding: 1.25rem !important; }
}

/* Stats row - 3 per row on small mobile */
@media (max-width: 400px) {
    .col-6.col-md-2 { width: 50% !important; }
}

/* Marketplace cards */
@media (max-width: 575.98px) {
    .col-lg-4.col-md-6.col-sm-12 { padding: 8px; }
}

/* Job cards - readable on mobile */
@media (max-width: 767.98px) {
    .d-flex.flex-wrap { flex-direction: column; }
    .btn-group { flex-wrap: wrap; gap: 4px; }
}

/* Tables - horizontal scroll on mobile */
@media (max-width: 767.98px) {
    .table-responsive-force { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    table.table { min-width: 600px; }
}

/* PWA safe area for notch phones */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    #pwaInstallBanner {
        padding-bottom: calc(14px + env(safe-area-inset-bottom));
    }
    main { padding-bottom: env(safe-area-inset-bottom); }
}

/* Input and select - prevent zoom on iOS */
@media (max-width: 767.98px) {
    input, select, textarea {
        font-size: 16px !important;
    }
}
