/* ==========================================================================
   CBM Calculator - High-Contrast SaaS Styling for UAE & GCC Trade Portal
   ========================================================================== */

:root {
    --cbm-primary: #0284c7;
    --cbm-primary-hover: #0369a1;
    --cbm-primary-light: #e0f2fe;
    --cbm-accent: #0f172a;
    --cbm-text-dark: #0f172a;
    --cbm-text-body: #334155;
    --cbm-text-muted: #64748b;
    --cbm-card-bg: #ffffff;
    --cbm-border: #cbd5e1;
    --cbm-border-subtle: #e2e8f0;
    --cbm-success: #10b981;
    --cbm-warning: #f59e0b;
    --cbm-purple: #8b5cf6;
}

/* Hero Section */
.cbm-hero {
    background: linear-gradient(135deg, #090e17 0%, #0f172a 45%, #0369a1 100%);
    color: #ffffff;
    padding: 2rem 0 1.5rem;
    position: relative;
    overflow: hidden;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.cbm-hero::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(56, 189, 248, 0.2) 0%, rgba(0,0,0,0) 70%);
    border-radius: 50%;
    pointer-events: none;
}

.cbm-hero h1 {
    font-size: 2.15rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.2;
    margin-bottom: 0.5rem;
    color: #ffffff;
}

.cbm-hero p {
    font-size: 1.02rem;
    color: #e2e8f0;
    max-width: 680px;
    line-height: 1.55;
    margin-bottom: 0;
}

/* 100% White High Contrast Guide CTA Button */
.cbm-hero .cbm-btn-guide,
a.cbm-btn-guide,
a.cbm-btn-guide:link,
a.cbm-btn-guide:visited {
    color: #ffffff !important;
    background: rgba(255, 255, 255, 0.15) !important;
    border: 1.5px solid rgba(255, 255, 255, 0.6) !important;
    font-weight: 700 !important;
    font-size: 0.88rem !important;
    padding: 8px 20px !important;
    border-radius: 30px !important;
    transition: all 0.2s ease !important;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none !important;
    white-space: nowrap;
}

.cbm-hero .cbm-btn-guide span,
a.cbm-btn-guide span {
    color: #ffffff !important;
}

.cbm-hero .cbm-btn-guide:hover,
a.cbm-btn-guide:hover,
a.cbm-btn-guide:focus,
a.cbm-btn-guide:active {
    background: #ffffff !important;
    color: #0f172a !important;
    border-color: #ffffff !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.cbm-hero .cbm-btn-guide:hover span,
a.cbm-btn-guide:hover span {
    color: #0f172a !important;
}

.cbm-btn-guide i {
    color: #ffffff !important;
    font-size: 1rem;
}

.cbm-btn-guide:hover i {
    color: #0284c7 !important;
}

/* Main Container */
.cbm-main-wrapper {
    background: #f8fafc;
    padding: 1.25rem 0 3.5rem;
    color: var(--cbm-text-dark);
}

.cbm-main-wrapper .container,
.cbm-hero .container {
    max-width: 1720px !important;
    width: 100% !important;
}

/* Preset Chips */
.cbm-preset-btn {
    background: #ffffff;
    border: 1.5px solid var(--cbm-border);
    color: #0f172a;
    font-size: 0.84rem;
    font-weight: 700;
    padding: 7px 15px;
    border-radius: 20px;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.cbm-preset-btn:hover {
    background: var(--cbm-primary-light);
    border-color: var(--cbm-primary);
    color: var(--cbm-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(2, 132, 199, 0.15);
}

/* Cargo Builder Card */
.cbm-card {
    background: var(--cbm-card-bg);
    border: 1.5px solid var(--cbm-border);
    border-radius: 16px;
    box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.06);
    overflow: hidden;
    margin-bottom: 1.75rem;
}

.cbm-card-header {
    background: #ffffff;
    border-bottom: 1.5px solid var(--cbm-border-subtle);
    padding: 1.25rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.cbm-card-header h2,
.cbm-card-header h3 {
    color: #0f172a;
    font-weight: 800;
}

.cbm-card-body {
    padding: 1.5rem;
}

/* Item Row Card in Builder */
.cbm-item-row {
    background: #ffffff;
    border: 1.5px solid var(--cbm-border);
    border-radius: 12px;
    padding: 1.25rem;
    margin-bottom: 1.25rem;
    transition: all 0.2s ease;
    position: relative;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.03);
}

.cbm-item-row:hover {
    border-color: var(--cbm-primary);
    box-shadow: 0 6px 16px rgba(2, 132, 199, 0.08);
}

.cbm-item-row-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.65rem;
    border-bottom: 1.5px dashed var(--cbm-border);
}

.cbm-item-badge {
    font-size: 0.8rem;
    font-weight: 800;
    text-transform: uppercase;
    background: #0f172a;
    color: #ffffff;
    padding: 4px 10px;
    border-radius: 6px;
    letter-spacing: 0.5px;
}

/* Description input inside row */
.cbm-item-row .item-desc {
    background: #ffffff !important;
    border: 1.5px solid #cbd5e1 !important;
    border-radius: 8px !important;
    padding: 5px 12px !important;
    color: #0f172a !important;
    font-weight: 700 !important;
    font-size: 0.95rem !important;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.cbm-item-row .item-desc:focus {
    border-color: var(--cbm-primary) !important;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15) !important;
    outline: none !important;
}

.cbm-item-row .item-desc::placeholder {
    color: #64748b !important;
    font-weight: 500;
}

/* Form Labels & Inputs */
.cbm-item-row label,
.cbm-form-label {
    color: #1e293b !important;
    font-weight: 700 !important;
    font-size: 0.82rem !important;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 5px;
    display: block;
}

.cbm-form-control, 
.cbm-form-select {
    background-color: #ffffff !important;
    color: #0f172a !important;
    border: 1.5px solid #94a3b8 !important;
    border-radius: 8px !important;
    font-size: 0.95rem !important;
    font-weight: 700 !important;
    padding: 0.55rem 0.75rem !important;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.cbm-form-control:focus, 
.cbm-form-select:focus {
    border-color: var(--cbm-primary) !important;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.2) !important;
    color: #0f172a !important;
    outline: none;
}

.cbm-form-control::placeholder {
    color: #94a3b8 !important;
    font-weight: 500;
}

/* Weight / Package Input Group Enhancement */
.cbm-wt-input-group {
    display: flex !important;
    flex-wrap: nowrap !important;
    width: 100% !important;
}

.cbm-wt-input-group .item-wt {
    flex: 1 1 auto !important;
    min-width: 80px !important;
    border-top-right-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
    border-right: none !important;
}

.cbm-wt-input-group .item-wt-unit {
    flex: 0 0 62px !important;
    max-width: 68px !important;
    min-width: 58px !important;
    background-color: #f1f5f9 !important;
    border-top-left-radius: 0 !important;
    border-bottom-left-radius: 0 !important;
    font-size: 0.84rem !important;
    font-weight: 700 !important;
    padding: 0.55rem 0.35rem !important;
    text-align: center !important;
    cursor: pointer !important;
}

.cbm-wt-input-group .item-wt-unit:focus {
    z-index: 3;
}

/* Metric Display Output in Row */
.cbm-row-output {
    background: #f1f5f9;
    border-radius: 8px;
    padding: 0.75rem 1.15rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.88rem;
    border: 1.5px solid #cbd5e1;
    color: #334155;
    font-weight: 600;
}

.cbm-row-cbm-val {
    font-weight: 800;
    color: var(--cbm-primary);
    font-size: 1.05rem;
}

/* Sticky Summary Dashboard (Desktop) */
.cbm-sticky-sidebar {
    position: sticky;
    top: 24px;
    z-index: 10;
}

.cbm-summary-card {
    background: linear-gradient(145deg, #090e17 0%, #0f172a 50%, #1e293b 100%) !important;
    color: #ffffff !important;
    border-radius: 18px;
    padding: 1.75rem;
    box-shadow: 0 12px 36px -4px rgba(15, 23, 42, 0.35);
    border: 1.5px solid rgba(255, 255, 255, 0.15) !important;
}

.cbm-summary-card .text-white-50 {
    color: #cbd5e1 !important;
    opacity: 1 !important;
}

.cbm-main-display {
    text-align: center;
    padding: 1.35rem 1rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1.5px solid rgba(255, 255, 255, 0.18);
    border-radius: 14px;
    margin-bottom: 1.5rem;
}

.cbm-main-number {
    font-size: 2.85rem;
    font-weight: 900;
    line-height: 1;
    color: #38bdf8;
    text-shadow: 0 2px 10px rgba(56, 189, 248, 0.25);
    font-feature-settings: "tnum";
}

.cbm-main-unit {
    font-size: 0.95rem;
    font-weight: 800;
    color: #f1f5f9;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-top: 6px;
}

.cbm-cft-subtext {
    font-size: 0.92rem;
    color: #93c5fd;
    font-weight: 600;
    margin-top: 6px;
}

/* Metric Pills */
.cbm-stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.85rem;
    margin-bottom: 1.5rem;
}

.cbm-stat-box {
    background: rgba(255, 255, 255, 0.07);
    border: 1.5px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 0.85rem 1rem;
}

.cbm-stat-label {
    font-size: 0.76rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #93c5fd;
    font-weight: 800;
    margin-bottom: 3px;
}

.cbm-stat-value {
    font-size: 1.25rem;
    font-weight: 800;
    color: #ffffff;
}

/* Volumetric Chargeable Weight Accordion Card */
.cbm-chargeable-box {
    background: rgba(255, 255, 255, 0.07);
    border-radius: 12px;
    padding: 1.15rem;
    margin-bottom: 1.5rem;
    border: 1.5px solid rgba(255, 255, 255, 0.15);
}

.cbm-chargeable-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 0.88rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: #f1f5f9;
}

.cbm-chargeable-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

/* High Contrast Chargeable Output Values */
#displaySeaChargeable {
    color: #6ee7b7 !important; /* Emerald Light */
    font-weight: 800;
    font-size: 0.95rem;
}

#displayAirChargeable {
    color: #fbbf24 !important; /* Gold/Amber */
    font-weight: 800;
    font-size: 0.95rem;
}

#displayCourierChargeable {
    color: #38bdf8 !important; /* Electric Cyan */
    font-weight: 800;
    font-size: 0.95rem;
}

/* Container Utilization Bars */
.cbm-container-item {
    background: #ffffff;
    border: 1.5px solid var(--cbm-border);
    border-radius: 12px;
    padding: 1.15rem;
    margin-bottom: 0.75rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.cbm-progress {
    height: 10px;
    background-color: #e2e8f0;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    overflow: hidden;
    margin: 9px 0;
}

.cbm-progress-bar {
    height: 100%;
    border-radius: 5px;
    transition: width 0.4s ease;
}

.cbm-progress-20ft {
    background: linear-gradient(90deg, #0284c7 0%, #0369a1 100%) !important;
}

.cbm-progress-40ft {
    background: linear-gradient(90deg, #0d9488 0%, #0f766e 100%) !important;
}

.cbm-progress-40hc {
    background: linear-gradient(90deg, #8b5cf6 0%, #7c3aed 100%) !important;
}

/* Action Buttons */
.cbm-action-btn-whatsapp {
    background: #25d366;
    color: #ffffff !important;
    font-weight: 800;
    border-radius: 10px;
    border: none;
    padding: 12px 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
    font-size: 0.92rem;
}

.cbm-action-btn-whatsapp:hover {
    background: #1ebc59;
    color: #ffffff !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.35);
}

.cbm-action-btn-outline {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff !important;
    border: 1.5px solid rgba(255, 255, 255, 0.35);
    font-weight: 700;
    font-size: 0.88rem;
    border-radius: 8px;
    padding: 10px 12px;
    transition: all 0.2s ease;
}

.cbm-action-btn-outline:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff !important;
    border-color: #ffffff;
}

/* Educational / FAQ Content */
.cbm-info-card {
    background: #ffffff;
    border: 1.5px solid var(--cbm-border);
    border-radius: 14px;
    padding: 2rem;
    margin-bottom: 1.75rem;
    box-shadow: 0 4px 15px -2px rgba(15, 23, 42, 0.04);
}

.cbm-info-card h3,
.cbm-info-card h4 {
    color: #0f172a;
    font-weight: 800;
}

.cbm-info-card p,
.cbm-info-card li {
    color: #334155;
    font-size: 0.94rem;
    line-height: 1.65;
}

/* High Contrast Formula Badges */
.cbm-formula-badge {
    background: #0f172a;
    font-family: var(--font-mono, 'Courier New', monospace);
    font-size: 0.88rem;
    font-weight: 700;
    color: #38bdf8;
    padding: 7px 14px;
    border-radius: 8px;
    display: inline-block;
    border: 1px solid #1e293b;
    letter-spacing: 0.3px;
    margin: 2px 0;
}

/* Custom Table Styling for Maximum Contrast */
.cbm-info-card table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-color: #cbd5e1 !important;
}

.cbm-info-card thead th {
    background: #f1f5f9 !important;
    color: #0f172a !important;
    font-weight: 800 !important;
    border-bottom: 2px solid #cbd5e1 !important;
    font-size: 0.88rem !important;
    padding: 10px 14px !important;
}

.cbm-info-card tbody td {
    color: #1e293b !important;
    font-size: 0.9rem !important;
    padding: 10px 14px !important;
    border-color: #e2e8f0 !important;
}

/* Specific Container Badges */
.badge-cbm-20ft {
    background: #dcfce7 !important;
    color: #15803d !important;
    border: 1.5px solid #86efac !important;
    font-weight: 800 !important;
    padding: 5px 12px !important;
    border-radius: 6px !important;
    font-size: 0.84rem !important;
}

.badge-cbm-40ft {
    background: #dbeafe !important;
    color: #1d4ed8 !important;
    border: 1.5px solid #93c5fd !important;
    font-weight: 800 !important;
    padding: 5px 12px !important;
    border-radius: 6px !important;
    font-size: 0.84rem !important;
}

.badge-cbm-40hc {
    background: #f3e8ff !important;
    color: #7e22ce !important;
    border: 1.5px solid #d8b4fe !important;
    font-weight: 800 !important;
    padding: 5px 12px !important;
    border-radius: 6px !important;
    font-size: 0.84rem !important;
}

.badge-cbm-45hc {
    background: #f1f5f9 !important;
    color: #334155 !important;
    border: 1.5px solid #cbd5e1 !important;
    font-weight: 800 !important;
    padding: 5px 12px !important;
    border-radius: 6px !important;
    font-size: 0.84rem !important;
}

/* FAQ Accordion Styling */
.cbm-info-card .accordion-button {
    color: #0f172a !important;
    font-weight: 700 !important;
    font-size: 0.98rem !important;
    background: #ffffff !important;
    padding: 1.15rem 1rem !important;
}

.cbm-info-card .accordion-button:not(.collapsed) {
    background: #f8fafc !important;
    color: var(--cbm-primary) !important;
    box-shadow: none !important;
}

.cbm-info-card .accordion-body {
    color: #334155 !important;
    font-size: 0.92rem !important;
    line-height: 1.65 !important;
    padding: 1rem !important;
}

/* Print Styles */
@media print {
    .header-main-v5, .cbm-hero, .cbm-preset-wrap, .cbm-btn-add, .cbm-action-row, footer, .trade-sponsor-banner {
        display: none !important;
    }
    .cbm-main-wrapper {
        background: #ffffff !important;
        padding: 0 !important;
    }
    .cbm-card, .cbm-summary-card {
        box-shadow: none !important;
        border: 1px solid #000000 !important;
        color: #000000 !important;
    }
}

/* Mobile & Tablet Optimizations */
@media (max-width: 991.98px) {
    .cbm-hero {
        padding: 2.25rem 1rem 1.75rem;
        text-align: center;
    }
    .cbm-hero h1 {
        font-size: 1.75rem;
    }
    .cbm-hero p {
        font-size: 0.95rem;
    }
    .cbm-main-wrapper {
        padding: 1.25rem 0 3rem;
    }
    .cbm-card-header {
        padding: 1rem;
    }
    .cbm-card-body {
        padding: 1rem 0.75rem;
    }
    .cbm-item-row {
        padding: 1rem 0.75rem;
    }
    .cbm-sticky-sidebar {
        position: static;
        margin-top: 1.5rem;
    }
    .cbm-main-number {
        font-size: 2.35rem;
    }
    .cbm-form-control, .cbm-form-select {
        height: 46px;
        font-size: 16px !important; /* Prevents auto zoom on iOS */
    }
}

@media (max-width: 575.98px) {
    .cbm-hero .cbm-btn-guide {
        white-space: normal;
        text-align: center;
        width: 100%;
        justify-content: center;
    }
    .cbm-preset-wrap {
        flex-wrap: wrap !important;
        gap: 6px !important;
    }
    .cbm-preset-btn {
        font-size: 0.78rem;
        padding: 6px 10px;
    }
}
