/* ================================================
   EKSPOR IMPOR DASHBOARD STYLES - PREMIUM EDITION
   ================================================ */


/* Hero Section with Wave Animation */

.exim-hero {
    min-height: 120px;
}

.exim-wave-bg {
    position: absolute;
    width: 200%;
    height: 100%;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 320'%3E%3Cpath fill='%23ffffff' fill-opacity='0.1' d='M0,160L48,138.7C96,117,192,75,288,80C384,85,480,139,576,154.7C672,171,768,149,864,128C960,107,1056,85,1152,90.7C1248,96,1344,128,1392,144L1440,160L1440,320L1392,320C1344,320,1248,320,1152,320C1056,320,960,320,864,320C768,320,672,320,576,320C480,320,384,320,288,320C192,320,96,320,48,320L0,320Z'%3E%3C/path%3E%3C/svg%3E");
    background-size: cover;
    animation: eximWaveMove 15s linear infinite;
}

@keyframes eximWaveMove {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-50%);
    }
}


/* Filter Glass Effect */

.exim-filter-glass {
    position: relative;
}

.exim-filter-glass::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(248, 250, 252, 0.8) 100%);
    z-index: -1;
}


/* Premium Select Styling */

.exim-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236b7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 16px;
    padding-right: 40px;
}

.exim-select:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}


/* Premium Card Effects */

.exim-card-premium {
    position: relative;
    overflow: hidden;
}


/* Chart Card Styling */

.exim-chart-card {
    position: relative;
    overflow: hidden;
    padding: 0 !important;
    display: flex;
    flex-direction: column;
    min-height: 420px;
    /* slightly smaller to show more cards/data */
}

.exim-chart-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, rgba(16, 185, 129, 0.3), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.exim-chart-card:hover::after {
    opacity: 1;
}

.exim-chart-card h3 {
    margin: 0;
}

.exim-chart-card .bg-gradient-to-r {
    padding: 0.75rem;
    flex-shrink: 0;
}


/* Chart/Table Container */

.exim-chart-card>div:nth-child(2) {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}


/* Enhanced ECharts Container (replaces canvas) */

#chartEximTimeSeries {
    width: 100% !important;
    height: 390px !important;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.97) 0%, rgba(249, 250, 251, 0.97) 100%);
    transition: filter 0.3s ease, transform 0.3s ease;
}

#chartEximTimeSeries:hover {
    filter: drop-shadow(0 6px 18px rgba(16, 185, 129, 0.12));
}


/* Gradient Text Effect */

.exim-gradient-text {
    background: linear-gradient(135deg, #10b981 0%, #3b82f6 50%, #8b5cf6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}


/* Toggle Buttons for Ekspor/Impor */

.exim-toggle-container {
    display: flex;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 12px;
    padding: 4px;
}

.exim-toggle-btn {
    padding: 8px 20px;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    background: transparent;
    color: #6b7280;
}

.exim-toggle-btn:hover {
    color: #374151;
}

.exim-toggle-btn.active-ekspor {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.exim-toggle-btn.active-impor {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}


/* Shimmer Effect for Loading States */

@keyframes eximShimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.exim-shimmer-loading {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: eximShimmer 1.5s ease-in-out infinite;
}


/* Responsive Adjustments */

@media (max-width: 768px) {
    .exim-hero {
        min-height: 150px;
    }
    .exim-hero h2 {
        font-size: 1.5rem;
    }
    .exim-card-premium {
        padding: 1rem;
    }
    .exim-card-premium .text-3xl {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .exim-hero {
        min-height: 120px;
    }
    .exim-hero .w-16 {
        width: 3rem;
        height: 3rem;
    }
    .exim-hero .text-3xl {
        font-size: 1.25rem;
    }
    .exim-filter-glass .grid {
        grid-template-columns: 1fr;
    }
}


/* Glow Effects */

.glow-green {
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
}

.glow-orange {
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.3);
}

.glow-blue {
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
}

.glow-purple {
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.3);
}


/* Card Number Counter Animation */

@keyframes eximCountUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.exim-card-premium p[id^="card"] {
    animation: eximCountUp 0.5s ease-out;
}


/* Scroll Reveal Animation */

@keyframes eximFadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.exim-card-premium,
.exim-chart-card {
    animation: eximFadeInUp 0.6s ease-out;
}

.exim-card-premium:nth-child(1) {
    animation-delay: 0.1s;
}

.exim-card-premium:nth-child(2) {
    animation-delay: 0.2s;
}

.exim-card-premium:nth-child(3) {
    animation-delay: 0.3s;
}

.exim-card-premium:nth-child(4) {
    animation-delay: 0.4s;
}


/* Table Styling for Exim Data */

.exim-table {
    width: 100%;
    border-collapse: collapse;
}

.exim-table thead th {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    padding: 12px 16px;
    text-align: left;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #475569;
    border-bottom: 2px solid #e2e8f0;
}

.exim-table tbody tr {
    transition: all 0.2s ease;
    border-bottom: 1px solid #f1f5f9;
}

.exim-table tbody tr:hover {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.05) 0%, rgba(59, 130, 246, 0.05) 100%);
}

.exim-table tbody td {
    padding: 12px 16px;
    font-size: 0.875rem;
    color: #334155;
}


/* Table Styling for Top Komoditas */

.table-komoditas {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.table-komoditas thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.table-komoditas thead tr {
    background: linear-gradient(to right, #f3e8ff 0%, #e0e7ff 50%, #f3e8ff 100%);
}

.table-komoditas thead th {
    padding: 0.5rem 0.75rem;
    text-align: left;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #7c3aed;
    border-bottom: 2px solid #d8b4fe;
}

.table-komoditas tbody tr {
    transition: all 0.3s ease;
}

.table-komoditas tbody tr:hover {
    transform: translateX(4px);
    box-shadow: inset 4px 0 0 0 #a78bfa;
}

.table-komoditas tbody td {
    padding: 0.4rem 0.75rem;
    font-size: 0.75rem;
}

.table-komoditas tbody tr:nth-child(even) {
    background-color: rgba(243, 232, 255, 0.4);
}

.table-komoditas tbody tr:nth-child(odd) {
    background-color: white;
}


/* Table Styling for Top Partner Pasar */

.table-partner {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.table-partner thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.table-partner thead tr {
    background: linear-gradient(to right, #dbeafe 0%, #cffafe 50%, #dbeafe 100%);
}

.table-partner thead th {
    padding: 0.5rem 0.75rem;
    text-align: left;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #1e40af;
    border-bottom: 2px solid #93c5fd;
}

.table-partner tbody tr {
    transition: all 0.3s ease;
}

.table-partner tbody tr:hover {
    transform: translateX(4px);
    box-shadow: inset 4px 0 0 0 #60a5fa;
}

.table-partner tbody td {
    padding: 0.4rem 0.75rem;
    font-size: 0.75rem;
}


/* Scroll wrapper with subtle top/bottom indicators (lines/gradients)
   Use this wrapper around the table element in the card markup.
   It keeps the header sticky while the body scrolls and shows
   top/bottom gradient edges to indicate more content. */

.table-scroll-wrapper {
    position: relative;
    overflow-y: auto;
    max-height: 270px;
    /* compact card height */
}

.table-scroll-wrapper::before,
.table-scroll-wrapper::after {
    content: '';
    position: sticky;
    left: 0;
    right: 0;
    height: 12px;
    pointer-events: none;
    z-index: 9;
}

.table-scroll-wrapper::before {
    top: 0;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.06), rgba(0, 0, 0, 0));
}

.table-scroll-wrapper::after {
    bottom: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.06), rgba(0, 0, 0, 0));
}


/* Make sticky thead sit above the gradient hints */

.table-scroll-wrapper thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.table-partner tbody tr:nth-child(even) {
    background-color: rgba(219, 234, 254, 0.4);
}

.table-partner tbody tr:nth-child(odd) {
    background-color: white;
}


/* Progress Bar for Rankings */

.exim-progress-bar {
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}

.exim-progress-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.5s ease;
}

.exim-progress-fill.ekspor {
    background: linear-gradient(90deg, #10b981, #059669);
}

.exim-progress-fill.impor {
    background: linear-gradient(90deg, #f59e0b, #d97706);
}


/* Status Badges */

.exim-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.exim-badge-surplus {
    background: rgba(16, 185, 129, 0.15);
    color: #059669;
}

.exim-badge-deficit {
    background: rgba(239, 68, 68, 0.15);
    color: #dc2626;
}

.exim-badge-up {
    background: rgba(16, 185, 129, 0.15);
    color: #059669;
}

.exim-badge-down {
    background: rgba(239, 68, 68, 0.15);
    color: #dc2626;
}


/* YoY Indicator Styling */

[id$="YoY"] {
    display: inline-flex;
    align-items: center;
    font-size: 0.75rem;
    font-weight: 700;
}


/* Scorecard Compact Size */

.exim-card-premium {
    min-height: auto;
}

.exim-card-premium p.text-3xl,
.exim-card-premium p.text-4xl {
    font-size: 1.75rem;
    line-height: 1.2;
}

.exim-card-premium .w-12 {
    width: 2.75rem;
    height: 2.75rem;
}

.exim-card-premium .w-12 i {
    font-size: 1.25rem;
}


/* YoY Badge Styling */

[id$="YoY"] span {
    display: inline-flex !important;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.5rem;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    animation: slideInUp 0.4s ease-out;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(8px);
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* YoY Positive (Green) */

.bg-green-100 {
    background-color: rgba(34, 197, 94, 0.25) !important;
}

.text-green-700 {
    color: #15803d !important;
}

.border-green-300 {
    border-color: rgba(34, 197, 94, 0.4) !important;
}


/* YoY Negative (Red) */

.bg-red-100 {
    background-color: rgba(239, 68, 68, 0.25) !important;
}

.text-red-700 {
    color: #b91c1c !important;
}

.border-red-300 {
    border-color: rgba(239, 68, 68, 0.4) !important;
}


/* YoY Neutral (Gray) */

.bg-gray-100 {
    background-color: rgba(107, 114, 128, 0.25) !important;
}

.text-gray-600 {
    color: #4b5563 !important;
}

.border-gray-300 {
    border-color: rgba(107, 114, 128, 0.4) !important;
}


/* Card Hover Effects */

.exim-card-premium:hover {
    transform: translateY(-4px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.exim-card-premium:hover .bg-white\/15 {
    background-color: rgba(255, 255, 255, 0.25);
}
