@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Outfit:wght@300;400;500;600;700;800&family=Dancing+Script:wght@700&family=Satisfy&display=swap');

:root {
    --primary: #3b82f6;
    /* Brighter blue for buttons */
    --primary-dark: #2563eb;
    --secondary: #0f172a;
    --accent: #60a5fa;
    --background: #ffffff;
    --text: #1e293b;
    --text-light: #94a3b8;
    --white: #ffffff;
    --topbar-bg: #09122c;
    --nav-height: 70px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    color: var(--text);
    background-color: var(--background);
    line-height: 1.6;
    overflow-x: hidden;
    width: 100%;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
}

a {
    text-decoration: none;
    transition: all 0.3s ease;
}

ul {
    list-style: none;
}

.container {
    max-width: 1700px;
    margin: 0 auto;
    padding: 0 40px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 28px;
    border-radius: 50px;
    font-weight: 600;
    font-size: 15px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    border: none;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
    padding: 14px 32px;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(59, 130, 246, 0.3);
}

.btn-outline {
    background: transparent;
    color: var(--white);
    border: none;
    text-decoration: underline;
    font-weight: 500;
}

.btn-outline:hover {
    color: var(--accent);
}

/* Interactive Map Section Styles */
.global-map-section {
    position: relative;
    overflow: hidden;
    padding-bottom: 80px;
    background-color: #ffffff;
}

#leafletMap {
    cursor: default !important;
    height: 550px;
    width: 100%;
    background-color: #f8fafc;
    border-radius: 40px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.03);
    z-index: 1;
}

.leaflet-marker-icon.leaflet-interactive,
.leaflet-image-layer.leaflet-interactive,
.leaflet-pane>svg path.leaflet-interactive,
svg.leaflet-image-layer.leaflet-interactive path {
    pointer-events: none;
    pointer-events: none;
}

.leaflet-interactive {
    cursor: default !important;
}

.map-wrapper {
    position: relative;
    max-width: 1540px;
    margin: 0 auto;
}

/* Floating Cards Styling */
.map-card-floating {
    position: absolute;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-radius: 25px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.08);
    z-index: 10;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.territories-card {
    top: 40px;
    left: 40px;
    width: 260px;
    padding: 35px;
}

.operations-card {
    bottom: 40px;
    left: 40px;
    background: white;
    padding: 20px 30px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.territory-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
    cursor: pointer;
    transition: all 0.3s;
    padding: 10px 0;
}

.territory-item span:first-child {
    font-weight: 700;
    color: #1e293b;
    font-size: 15px;
}

.territory-item i {
    color: var(--primary);
    font-size: 14px;
    opacity: 0.6;
}

.territory-item:hover {
    transform: translateX(5px);
}

.territory-item:hover i {
    opacity: 1;
}

.territory-active {
    color: var(--primary) !important;
}

/* Territory Info Panel */
.territory-info-panel {
    position: absolute;
    top: 40px;
    left: 320px;
    width: 320px;
    max-height: calc(100% - 80px);
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(32px);
    -webkit-backdrop-filter: blur(32px);
    border-radius: 30px;
    padding: 30px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.15);
    z-index: 25;
    transform: translateX(-120%) scale(0.95);
    opacity: 0;
    pointer-events: none;
    transition: all 0.6s cubic-bezier(0.23, 1, 0.32, 1);
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.territory-info-panel::-webkit-scrollbar {
    display: none;
}

.territory-info-panel.panel-visible {
    transform: translateX(0) scale(1);
    opacity: 1;
    pointer-events: auto;
}

.territory-info-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f1f5f9;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #64748b;
    transition: all 0.3s;
}

.territory-info-close:hover {
    background: #e2e8f0;
    color: #1e293b;
}

/* Custom Marker Styling */
.marker-pulse {
    cursor: default !important;
    position: relative;
    width: 14px;
    height: 14px;
    background: #ef4444;
    /* Default HQ Red */
    border: 3px solid #fff;
    border-radius: 50%;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.marker-hq {
    background: #ef4444 !important;
}

.marker-region {
    background: var(--primary) !important;
}

@keyframes leafletPulse {
    0% {
        transform: translate(-50%, -50%) scale(0.5);
        opacity: 0.8;
    }

    100% {
        transform: translate(-50%, -50%) scale(2.8);
        opacity: 0;
    }
}

.leaflet-tooltip.map-label {
    background: #1e293b !important;
    color: white !important;
    border: none !important;
    border-radius: 8px !important;
    padding: 6px 12px !important;
    font-family: 'Inter', sans-serif !important;
    font-weight: 800 !important;
    font-size: 11px !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2) !important;
    white-space: nowrap !important;
}

.leaflet-tooltip-top.map-label::before {
    border-top-color: #1e293b !important;
}

.leaflet-premium-popup .leaflet-popup-content-wrapper {
    border-radius: 12px;
    padding: 6px;
    font-weight: 700;
}

/* Info Panel Content Styling */
.tip-rtitle {
    font-size: 22px;
    margin-bottom: 5px;
    color: #0a0a0a;
}

.tip-rsub {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--primary);
    font-weight: 800;
    margin-bottom: 15px;
}

.tip-desc {
    font-size: 14px;
    color: #64748b;
    line-height: 1.6;
    margin-bottom: 25px;
}

.tip-stats {
    display: flex;
    gap: 40px;
    margin-bottom: 25px;
    padding: 20px 0;
    border-top: 1px solid #f1f5f9;
    border-bottom: 1px solid #f1f5f9;
}

.tip-stat span:first-child {
    display: block;
    font-size: 20px;
    font-weight: 900;
    color: #1e293b;
}

.tip-stat span:last-child {
    font-size: 10px;
    text-transform: uppercase;
    color: #94a3b8;
    font-weight: 700;
}

.tip-clbl {
    font-weight: 800;
    text-transform: uppercase;
    font-size: 10px;
    color: #94a3b8;
    margin-bottom: 15px;
}

.tip-cgrid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.tip-country {
    padding: 10px;
    background: #f8fafc;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

@media (max-width: 1024px) {
    .territory-info-panel {
        left: 40px;
        top: 180px;
        width: calc(100% - 80px);
        max-height: 400px;
    }

    .territories-card {
        width: calc(100% - 80px);
    }

    #leafletMap {
        height: 600px;
    }
}

@media (max-width: 1024px) {
    #leafletMap {
        height: 600px;
    }

    .map-wrapper {
        padding: 0 20px;
    }

    .territories-card {
        left: 20px;
        top: 20px;
        width: 220px;
    }

    .territory-info-panel {
        left: 20px;
        top: 20px;
        width: calc(100% - 40px);
        max-height: calc(100% - 40px);
    }
}

@media (max-width: 768px) {
    #leafletMap {
        height: 550px;
        border-radius: 30px;
    }

    .territories-card {
        position: absolute !important;
        top: 20px !important;
        left: 20px !important;
        width: 170px !important;
        padding: 15px 20px !important;
        transform: scale(0.9);
        transform-origin: top left;
        margin-bottom: 0;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1) !important;
    }

    .territories-card p {
        margin-bottom: 15px !important;
        font-size: 9px !important;
    }

    .territory-item {
        padding: 5px 0 !important;
        margin-bottom: 5px !important;
    }

    .territory-item span:first-child {
        font-size: 13px !important;
    }

    .operations-card {
        position: absolute !important;
        bottom: 20px !important;
        left: 20px !important;
        width: auto !important;
        margin-top: 0;
        padding: 10px 15px !important;
        transform: scale(0.9);
        transform-origin: bottom left;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1) !important;
    }

    .operations-card i {
        font-size: 16px !important;
    }

    .operations-card p:first-child {
        font-size: 9px !important;
    }

    .operations-card p:last-child {
        font-size: 9px !important;
    }

    .territory-info-panel {
        position: absolute !important;
        top: auto !important;
        bottom: 15px !important;
        left: 15px !important;
        width: calc(100% - 30px) !important;
        height: auto !important;
        max-height: 60% !important;
        z-index: 30 !important;
        border-radius: 25px !important;
        padding: 20px !important;
        transform: translateY(120%) scale(0.95);
        opacity: 0;
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.2) !important;
    }

    .territory-info-panel.panel-visible {
        transform: translateY(0) scale(1);
        opacity: 1;
    }

    .territory-info-close {
        width: 32px !important;
        height: 32px !important;
        background: #f1f5f9 !important;
        border-radius: 50% !important;
        top: 15px !important;
        right: 15px !important;
    }

    .tip-rtitle {
        font-size: 18px !important;
    }

    .tip-desc {
        font-size: 13px !important;
        margin-bottom: 15px !important;
    }

    .tip-stats {
        padding: 10px 0 !important;
        gap: 20px !important;
        margin-bottom: 15px !important;
    }

    .tip-stat span:first-child {
        font-size: 15px !important;
    }

    .tip-cgrid {
        grid-template-columns: 1fr 1fr !important;
        gap: 6px !important;
    }

    .tip-country {
        padding: 6px 10px !important;
        font-size: 11px !important;
    }
}

@media (max-width: 480px) {
    #leafletMap {
        height: 600px;
    }

    .territories-card {
        width: 140px !important;
        transform: scale(0.85);
        left: 10px !important;
        top: 10px !important;
    }

    .operations-card {
        left: 10px !important;
        bottom: 10px !important;
        transform: scale(0.85);
    }

    .territory-info-panel {
        left: 10px !important;
        bottom: 10px !important;
        width: calc(100% - 20px) !important;
        padding: 15px !important;
    }
}

/* Home - Global Trade Network */
.global-trade-network {
    background-color: var(--secondary);
    color: var(--white);
    position: relative;
    overflow: hidden;
    padding: 100px 0;
    /* More breathing room */
}

.trade-network-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
        "details map"
        "actions map";
    gap: 60px;
    /* Balanced gap */
    align-items: center;
    max-width: 1400px;
    /* Better for centering on ultra-wide */
    margin: 0 auto;
}

.trade-details {
    grid-area: details;
    text-align: left;
}

.trade-map-container {
    grid-area: map;
    position: relative;
    width: 100%;
}

.trade-actions {
    grid-area: actions;
    margin-top: -30px;
    /* Optimized spacing */
}

/* Base Feature Styles */
.trade-features {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 40px;
}

.trade-feature-card {
    display: flex;
    gap: 20px;
    /* Increased gap */
    background: rgba(255, 255, 255, 0.04);
    padding: 24px;
    /* More padding */
    border-radius: 24px;
    /* Smoother corners */
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.trade-feature-card:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateY(-8px);
    border-color: rgba(59, 130, 246, 0.4);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3), 0 0 20px rgba(59, 130, 246, 0.1);
}

.tf-icon {
    width: 54px;
    /* Larger icon box */
    height: 54px;
    background: rgba(59, 130, 246, 0.15);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
    font-size: 22px;
    /* Larger icon */
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.trade-feature-card:hover .tf-icon {
    background: var(--primary);
    color: var(--white);
    transform: rotate(-10deg);
}

.tf-content h4 {
    color: var(--white);
    font-size: 16px;
    margin-bottom: 5px;
}

.tf-content p {
    color: rgba(255, 255, 255, 0.6);
    font-size: 13px;
    line-height: 1.4;
}

.text-light-muted {
    color: rgba(255, 255, 255, 0.75);
    font-size: 18px;
    /* Slightly larger for readability */
    line-height: 1.7;
    margin-bottom: 40px;
    max-width: 600px;
    /* Prevents text from being too wide */
}

@media (max-width: 1024px) {
    .trade-network-grid {
        gap: 40px;
        grid-template-columns: 1fr 1.1fr;
        max-width: 960px;
    }

    .section-title {
        font-size: 2.5rem !important;
    }

    .text-light-muted {
        font-size: 16px;
    }
}

@media (max-width: 768px) {
    .trade-network-grid {
        grid-template-columns: 1fr;
        grid-template-areas:
            "details"
            "map"
            "actions";
        gap: 40px;
        text-align: center;
    }

    .trade-details {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .trade-actions {
        justify-content: center;
        margin-top: 10px;
    }

    .text-light-muted {
        margin-left: auto;
        margin-right: auto;
        font-size: 16px !important;
    }

    .trade-features {
        justify-content: center;
        grid-template-columns: 1fr 1fr !important;
        gap: 12px !important;
    }

    .section-title {
        font-size: 32px !important;
        margin-bottom: 20px;
    }

    .section-desc {
        font-size: 16px !important;
        line-height: 1.6;
    }

    .hide-mobile {
        display: none;
    }

    .trade-feature-card {
        padding: 12px !important;
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 8px !important;
    }

    .tf-icon {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }

    .tf-content h4 {
        font-size: 13px;
        margin: 0;
    }

    .global-trade-network {
        padding: 50px 0 80px;
    }

    #homeLeafletMap {
        height: 400px !important;
        /* Slightly taller for better map view */
        border-radius: 30px !important;
    }
}

@media (max-width: 480px) {
    .global-trade-network {
        padding: 40px 0;
    }

    .trade-features {
        grid-template-columns: 1fr 1fr !important;
        /* Force side-by-side on even the smallest screens */
        gap: 10px !important;
    }

    .trade-feature-card {
        padding: 12px !important;
    }

    .tf-content h4 {
        font-size: 12px !important;
    }
}