@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --bg-color: #f9fafb;
    --sidebar-bg: #111827;
    --sidebar-text: #9ca3af;
    --sidebar-active: #ffffff;
    --card-bg: #ffffff;
    --text-main: #111827;
    --text-muted: #6b7280;
    --border-color: #e5e7eb;
    --danger: #ef4444;
    --warning: #f59e0b;
    --success: #10b981;
    --modal-bg: rgba(0, 0, 0, 0.5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
    position: relative;
    z-index: 0;
}

body.custom-cursor-active {
    cursor: none;
}

body.custom-cursor-active a,
body.custom-cursor-active button,
body.custom-cursor-active .btn,
body.custom-cursor-active .nav-link,
body.custom-cursor-active input,
body.custom-cursor-active select,
body.custom-cursor-active textarea,
body.custom-cursor-active .notification-container {
    cursor: none !important;
}

/* Force hide custom cursor elements on mobile screens regardless of JS */
@media (max-width: 768px) {

    .cursor-follower,
    .cursor-dot {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }

    body.custom-cursor-active,
    body.custom-cursor-active a,
    body.custom-cursor-active button,
    body.custom-cursor-active .btn,
    body.custom-cursor-active .nav-link,
    body.custom-cursor-active input,
    body.custom-cursor-active select,
    body.custom-cursor-active textarea,
    body.custom-cursor-active .notification-container {
        cursor: auto !important;
        /* Restore default cursor */
    }
}


body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../img/truck_bg.jpg');
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
    filter: blur(3px);
    opacity: 0.15;
    z-index: -1;
    pointer-events: none;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    color: white;
    padding: 1.5rem 1.5rem 0 1.5rem;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10000;
}

.sidebar.hidden {
    left: -260px;
}

.sidebar-toggle-btn {
    position: absolute;
    right: 15px;
    top: 15px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 35px;
    height: 35px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    z-index: 10001;
}

.sidebar-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.sidebar.hidden .sidebar-toggle-btn {
    position: fixed;
    left: 15px;
    top: 15px;
    background: var(--sidebar-bg);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.sidebar-header {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 2rem;
    color: white;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-links {
    list-style: none;
}

.nav-item {
    margin-bottom: 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: 0.5rem;
    transition: all 0.2s;
    gap: 0.75rem;
}

.nav-link:hover,
.nav-link.active {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--sidebar-active);
}

.sidebar-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    margin-right: -1.5rem;
    padding-right: 1.5rem;
    padding-bottom: 2rem;
}

.sidebar-footer {
    margin-top: auto;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 1.5rem 0;
}

/* Main Content */
.main-content {
    margin-left: 260px;
    flex: 1;
    padding: 2rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 0;
}

/* Main content stays put as per user request "bukan mala yang puth" */
.main-content.expanded {
    margin-left: 260px;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.page-title {
    font-size: 1.5rem;
    font-weight: 700;
}

.notification-container {
    position: relative;
    cursor: pointer;
    padding: 5px;
}

.notification-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background-color: var(--danger);
    color: white;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 50%;
    border: 2px solid var(--bg-color);
}

.notification-dropdown {
    position: absolute;
    top: 40px;
    right: 0;
    width: 300px;
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border-color);
    display: none;
    z-index: 1000;
}

.notification-dropdown.show {
    display: block;
}

.dropdown-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    font-size: 0.875rem;
}

.dropdown-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    display: block;
    text-decoration: none;
    color: var(--text-main);
    transition: background 0.2s;
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background: #f9fafb;
}

.dropdown-item .title {
    font-weight: 600;
    font-size: 0.8125rem;
}

.dropdown-item .desc {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Cards & Tables */
.card {
    background: var(--card-bg);
    border-radius: 0.75rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    padding: 1.5rem;
    border: 1px solid var(--border-color);
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--modal-bg);
    z-index: 9999;
    overflow-y: auto;
    padding: 2rem 1rem;
    align-items: flex-start;
    justify-content: center;
}

.modal-content {
    width: 100%;
    max-width: 600px;
    margin: auto;
}

/* Puzzle Card Shapes */
.stat-card {
    position: relative;
    border-radius: 1rem;
    border: none !important;
    padding: 1.5rem;
    color: white;
    /* Use drop-shadow for irregular shapes */
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.1));
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    /* Ensure bumps are visible */
    overflow: visible;
    /* Default mask for all, overridden by specific children */
    mask-repeat: no-repeat;
    -webkit-mask-repeat: no-repeat;
}

.stat-card:hover {
    transform: translateY(-5px);
    z-index: 10;
}

/* Remove Folder Tab - not needed as we removed the before block entirely here */

/* "Innie" (Hole) on the Left - All except first */
.grid .stat-card:not(:first-child) {
    /* Create a semi-circle cutout on the left edge */
    -webkit-mask-image: radial-gradient(circle at 0% 50%, transparent 15px, black 16px);
    mask-image: radial-gradient(circle at 0% 50%, transparent 15px, black 16px);
    /* Adjust padding to account for the bite */
    padding-left: 2rem;
}

/* "Outie" (Bump) on the Right - All except last */
.grid .stat-card:not(:last-child)::after {
    content: "";
    position: absolute;
    right: -15px;
    /* Protrude out */
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    border-radius: 50%;
    z-index: 1;
}

/* Color Variations & Connectors */
.stat-card-blue {
    background: linear-gradient(135deg, #4f46e5 0%, #3b82f6 100%);
}

.stat-card-blue::after {
    background: #3b82f6;
}

.stat-card-red {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.stat-card-red::after {
    background: #dc2626;
}

.stat-card-orange {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.stat-card-orange::after {
    background: #d97706;
}

.stat-card-green {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.stat-card-green::after {
    background: #059669;
}

.stat-card-purple {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}

.stat-card-purple::after {
    background: #7c3aed;
}




.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    padding: 1rem;
    border-bottom: 2px solid var(--border-color);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.8125rem;
    white-space: nowrap;
}

td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.8125rem;
    white-space: nowrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    border: none;
    font-size: 0.875rem;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

.status-badge {
    padding: 0.35rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    display: inline-block;
}

.status-danger {
    background-color: #fee2e2;
    color: #991b1b;
}

.status-warning {
    background-color: #fef3c7;
    color: #92400e;
}

.status-success {
    background-color: #d1fae5;
    color: #065f46;
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
}

.form-control {
    width: 100%;
    padding: 0.625rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 0.875rem;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

/* Custom Cursor & Effects */
.cursor-follower {
    width: 35px;
    height: 35px;
    background-color: transparent;
    border: 1.5px solid rgba(17, 24, 39, 0.4);
    /* Slate-900 with opacity */
    border-radius: 50%;
    position: fixed;
    pointer-events: none;
    z-index: 999999;
    transition: transform 0.2s cubic-bezier(0.23, 1, 0.32, 1), background-color 0.3s, border-color 0.3s;
    transform: translate(-50%, -50%);
    display: none;
    backdrop-filter: blur(1px);
}

.cursor-dot {
    width: 24px;
    height: 24px;
    background-image: url("data:image/svg+xml,%3Csvg width='24' height='24' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1.5 1.5V18.5L5.5 14.5H12.5L1.5 1.5Z' fill='%23111827' stroke='white' stroke-width='1.5' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    position: fixed;
    pointer-events: none;
    z-index: 1000000;
    /* Offset by the padding in SVG (1.5px) to align tip exactly */
    margin-top: -1.5px;
    margin-left: -1.5px;
    display: none;
    transition: width 0.3s, height 0.3s, filter 0.3s;
}

.cursor-follower.active,
.cursor-dot.active {
    display: block;
}

.ripple {
    position: fixed;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    background: rgba(17, 24, 39, 0.1);
    border: 1px solid rgba(17, 24, 39, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    animation: ripple-out 0.5s cubic-bezier(0, 0, 0.2, 1) forwards;
    z-index: 999998;
}

@keyframes ripple-out {
    from {
        width: 0;
        height: 0;
        opacity: 0.8;
    }

    to {
        width: 80px;
        height: 80px;
        opacity: 0;
    }
}

.cursor-hovering {
    transform: translate(-50%, -50%) scale(1.5);
    background-color: rgba(17, 24, 39, 0.05);
    border-color: #111827;
}

.cursor-dot-hovering {
    filter: drop-shadow(0 0 2px var(--primary-color));
    transform: scale(1.1);
}

/* Print Styles */
@page {
    size: auto;
    margin: 15mm;
}

@media print {

    /* Hide specific UI elements */
    .sidebar,
    .sidebar-toggle-btn,
    .notification-container,
    .no-print,
    .btn,
    .modal,
    .cursor-follower,
    .cursor-dot {
        display: none !important;
    }

    /* Reset layout for print */
    body {
        background: white !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }

    /* Show Print Header */
    .print-header {
        display: flex !important;
        align-items: center;
        gap: 15px;
        margin-bottom: 30px !important;
        padding: 0 !important;
        text-align: left;
    }

    .main-content-inner {
        margin: 0 !important;
        padding: 0 !important;
    }

    .card {
        box-shadow: none !important;
        border: none !important;
        padding: 0 !important;
    }

    /* Hide "Aksi" Column in Print */
    table tr th:last-child,
    table tr td:last-child {
        display: none !important;
    }

    /* Ensure table fits and borders show */
    .table-container {
        overflow: visible !important;
    }

    table {
        border-collapse: collapse !important;
        width: 100% !important;
        table-layout: auto !important;
        border: 1px solid #000 !important;
        margin-bottom: 20px !important;
        min-width: 0 !important;
        /* Force no min-width in print */
    }

    th,
    td {
        border: 1px solid #000 !important;
        white-space: normal !important;
        word-wrap: break-word !important;
        font-size: 8pt !important;
        padding: 4px 2px !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    thead {
        background: #f0f0f0 !important;
    }

    /* Print Helpers for Daily Report */
    .no-print {
        display: none !important;
    }

    .truck-section {
        page-break-before: auto !important;
        page-break-inside: auto !important;
        margin-bottom: 30px !important;
        border-top: 1px solid #ddd !important;
        padding-top: 20px !important;
    }

    .truck-section:first-of-type {
        border-top: none !important;
        padding-top: 0 !important;
        margin-top: 10px !important;
    }

    .chart-section-header {
        display: block !important;
        margin-top: 10px !important;
        margin-bottom: 10px !important;
        visibility: visible !important;
    }

    .chart-section-header .page-title {
        font-size: 14px !important;
        margin: 0 !important;
    }

    .chart-total-card {
        max-width: 60% !important;
        /* Make total chart a bit smaller in print to fit center */
        margin: 0 auto 10px !important;
        display: block !important;
    }

    .chart-grid-three {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 8px !important;
        visibility: visible !important;
        margin-bottom: 15px !important;
    }

    .chart-grid-three .card,
    .chart-total-card {
        margin-bottom: 0 !important;
        width: 100% !important;
        display: block !important;
        page-break-inside: avoid !important;
        visibility: visible !important;
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        padding: 8px !important;
        border: 1px solid #eee !important;
    }

    .chart-grid-three .card h3,
    .chart-total-card h3 {
        font-size: 9px !important;
        margin-bottom: 5px !important;
    }

    .chart-total-card>div {
        height: 150px !important;
    }

    .chart-grid-three .card>div {
        height: 120px !important;
        /* Force smaller height for print */
    }

    canvas {
        width: 100% !important;
        height: 100% !important;
        visibility: visible !important;
    }

    /* Adjust main table for print to fit after charts */
    .table-container h3 {
        font-size: 12px !important;
        padding: 5px 0 !important;
        margin: 0 !important;
    }
}

/* --- Mobile Responsiveness --- */
@media screen and (max-width: 768px) {
    .sidebar {
        left: -260px !important;
        box-shadow: 10px 0 15px rgba(0, 0, 0, 0.1);
    }

    .sidebar.mobile-open {
        left: 0 !important;
    }

    .sidebar-toggle-btn {
        display: flex !important;
        /* Ensure toggle is always visible on mobile */
        position: fixed;
        left: 15px;
        top: 15px;
        background: var(--sidebar-bg);
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    }

    .main-content {
        margin-left: 0 !important;
        padding: 1rem;
        padding-top: 4rem;
        /* Space for the floating toggle button */
    }

    .main-content.expanded {
        margin-left: 0 !important;
    }

    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .grid {
        grid-template-columns: 1fr !important;
        gap: 1rem;
    }

    /* Reset puzzle piece shapes on mobile to keep it clean */
    .grid .stat-card:not(:first-child) {
        -webkit-mask-image: none;
        mask-image: none;
        padding-left: 1.5rem;
    }

    .grid .stat-card:not(:last-child)::after {
        display: none;
    }

    .stat-card {
        padding: 1.25rem;
    }

    .stat-card div div:nth-child(2) {
        font-size: 1.5rem !important;
        /* Smaller number on mobile */
    }

    .notification-dropdown {
        position: fixed;
        top: 60px;
        left: 10px;
        right: 10px;
        width: auto;
        z-index: 10001;
    }

    /* Form responsiveness */
    .card {
        padding: 1rem;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }

    /* Fix table responsiveness */
    .table-container {
        border-radius: 0.5rem;
        border: 1px solid var(--border-color);
    }

    .header-actions {
        width: 100%;
        flex-wrap: wrap;
        justify-content: flex-start !important;
        gap: 0.75rem !important;
    }

    .search-container {
        width: 100% !important;
        max-width: none !important;
    }

    .header-actions .btn {
        flex: 1 1 auto;
        /* Allow buttons to grow and shrink */
        min-width: 120px;
    }
}

/* --- Visual Landing Dashboard --- */
.visual-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    padding: 1rem 0;
}

.visual-card {
    background: white;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.3);
    text-decoration: none;
    color: inherit;
}

.visual-card:hover {
    transform: translateY(-12px) scale(1.02);
    box-shadow: 0 20px 40px -10px rgba(79, 70, 229, 0.2);
}

.visual-card-header {
    height: 200px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: #f3f4f6;
}

.visual-card-header i,
.visual-card-header img {
    z-index: 2;
    transition: transform 0.4s ease;
}

.visual-card-header i {
    font-size: 5rem;
}

.visual-card-header img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 0;
    /* Remove padding to maximize size */
}

/* Specific background for image headers to blend with white assets */
.visual-card-header:has(img) {
    background: #ffffff !important;
}

/* Hide the color overlay when an image is used */
.visual-card-header:has(img) .visual-card-overlay {
    display: none;
}

.visual-card:hover .visual-card-header i,
.visual-card:hover .visual-card-header img {
    transform: scale(1.1) rotate(5deg);
}

.visual-card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(79, 70, 229, 0.1) 0%, rgba(59, 130, 246, 0.2) 100%);
    opacity: 0.6;
}

.visual-card-body {
    padding: 1.5rem;
    text-align: center;
    background: white;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.visual-card-body h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-main);
}

.visual-card-body p {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.visual-card-footer {
    width: 100%;
    padding: 0 1.5rem 1.5rem 1.5rem;
}

.visual-card-btn {
    width: 100%;
    padding: 0.75rem;
    background: #5ea4ff;
    /* Changed from #ef4444 to blue as requested */
    color: white;
    text-align: center;
    border-radius: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.875rem;
    transition: all 0.3s;
    border: none;
}

.visual-card:hover .visual-card-btn {
    background: #3b82f6;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* Background Color Variants for Icons Header */
.bg-gradient-blue {
    background: linear-gradient(135deg, #e0e7ff 0%, #c7d2fe 100%);
    color: #4338ca;
}

.bg-gradient-green {
    background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
    color: #059669;
}

.bg-gradient-purple {
    background: linear-gradient(135deg, #f5f3ff 0%, #ddd6fe 100%);
    color: #7c3aed;
}

.bg-gradient-orange {
    background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
    color: #ea580c;
}

.bg-gradient-red {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    color: #dc2626;
}

.bg-gradient-indigo {
    background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
    color: #4f46e5;
}

.bg-gradient-teal {
    background: linear-gradient(135deg, #f0fdfa 0%, #ccfbf1 100%);
    color: #0d9488;
}