/* ===================================
   GLOBAL STYLES & VARIABLES
   =================================== */
:root {
    --primary-color: #ff6600;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --font-heading: 'Poppins', sans-serif;
    --font-body: 'Inter', sans-serif;
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    line-height: 1.6;
    color: #333;
    overflow-x: hidden;
}

body.dark-mode {
    background-color: #1a1a1a;
    color: #e0e0e0;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
}

.navbar {
    padding: 1rem 0;
    transition: var(--transition);
}

.navbar-brand {
    font-size: 1.5rem;
    color: var(--primary-color) !important;
}

.nav-link {
    font-weight: 500;
    padding: 0.5rem 1rem !important;
    transition: var(--transition);
}

.nav-link:hover {
    color: var(--primary-color) !important;
}

/* ===================================
   HERO SECTION
   =================================== */
.hero-section {
    background: linear-gradient(135deg, #ff6600 0%, #ff8c00 100%);
    color: white;
    padding: 150px 0 80px;
    margin-top: 70px;
    position: relative;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 102, 0, 0.85) 0%, rgba(255, 140, 0, 0.85) 100%);
    z-index: 1;
}

.hero-section h1 {
    animation: fadeInUp 1s ease;
}

.stat-card {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    padding: 1rem;
    border-radius: 10px;
    text-align: center;
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
}

.stat-label {
    font-size: 0.9rem;
    opacity: 0.9;
}

.tracking-card {
    background: white;
    color: #333;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.tracking-card h3 {
    color: var(--primary-color);
}

/* ===================================
   SERVICES SECTION
   =================================== */
.service-card {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.service-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
}

.service-card.featured {
    border: 3px solid var(--primary-color);
}

.badge-featured {
    position: absolute;
    top: 15px;
    right: -30px;
    background: var(--warning-color);
    color: white;
    padding: 5px 40px;
    transform: rotate(45deg);
    font-size: 0.75rem;
    font-weight: 600;
}

.service-icon {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.service-card h4 {
    margin-bottom: 1rem;
}

.service-card ul li {
    padding: 0.5rem 0;
}

.price-tag {
    background: var(--primary-color);
    color: white;
    padding: 0.75rem;
    border-radius: 8px;
    font-weight: 600;
    margin-top: 1.5rem;
    display: inline-block;
    width: 100%;
    text-align: center;
}

/* ===================================
   TRACKING RESULTS
   =================================== */
.timeline {
    position: relative;
    padding-left: 40px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 15px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--primary-color);
}

.timeline-item {
    position: relative;
    padding-bottom: 2rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -29px;
    top: 5px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: white;
    border: 3px solid var(--primary-color);
    z-index: 1;
}

.timeline-item.active::before {
    background: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(0, 123, 255, 0.2);
}

.timeline-content {
    background: var(--light-color);
    padding: 1rem;
    border-radius: 8px;
}

.timeline-date {
    font-size: 0.85rem;
    color: #666;
}

/* ===================================
   CONTACT CARDS
   =================================== */
.contact-card {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    text-align: center;
    transition: var(--transition);
}

.contact-card:hover {
    transform: translateY(-5px);
}

.contact-card i {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

/* ===================================
   FOOTER
   =================================== */
footer {
    margin-top: 3rem;
    background: #212529 !important;
}

footer a {
    transition: var(--transition);
}

footer a:hover {
    color: var(--primary-color) !important;
    transform: translateX(5px);
}

.social-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-radius: 50%;
    transition: var(--transition);
    text-decoration: none;
}

.social-links a:hover {
    background: var(--primary-color);
    transform: scale(1.1) translateY(-3px);
    color: white !important;
}

/* ===================================
   PWA INSTALL BUTTON
   =================================== */
.btn-install {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 1000;
    border-radius: 50px;
    padding: 1rem 1.5rem;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* ===================================
   DARK MODE
   =================================== */
body.dark-mode .card,
body.dark-mode .service-card,
body.dark-mode .tracking-card,
body.dark-mode .contact-card {
    background: #2d2d2d;
    color: #e0e0e0;
}

body.dark-mode .navbar {
    background: #1a1a1a !important;
}

body.dark-mode .bg-light {
    background: #2d2d2d !important;
}

body.dark-mode .timeline-content {
    background: #3a3a3a;
}

body.dark-mode .text-muted {
    color: #aaa !important;
}

/* ===================================
   ADMIN STYLES
   =================================== */
.admin-body {
    background: #f5f7fa;
}

/* Login Screen */
.login-screen {
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-container {
    width: 100%;
    max-width: 450px;
}

.login-card {
    background: white;
    padding: 3rem;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 260px;
    height: 100vh;
    background: linear-gradient(180deg, #2c3e50 0%, #34495e 100%);
    color: white;
    z-index: 1000;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 2rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.sidebar-menu {
    padding: 1rem 0;
    flex: 1 1 auto;
    overflow-y: auto;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.menu-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.menu-item.active {
    background: rgba(0, 123, 255, 0.2);
    border-left-color: var(--primary-color);
    color: white;
}

.menu-item i {
    margin-right: 1rem;
    width: 20px;
}

.sidebar-footer {
    position: sticky;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: linear-gradient(180deg, #2c3e50 0%, #34495e 100%);
}

/* Main Content */
.main-content {
    margin-left: 260px;
    min-height: 100vh;
}

.topbar {
    background: white;
    padding: 1.5rem 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

.content-area {
    padding: 2rem;
}

/* Dashboard Cards */
.stat-card-admin {
    padding: 1.5rem;
    border-radius: 15px;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.stat-icon {
    font-size: 3rem;
    opacity: 0.3;
}

.stat-info h3 {
    margin: 0;
    font-size: 2rem;
}

.stat-info p {
    margin: 0;
    font-size: 0.9rem;
}

/* Table Styles */
.table-responsive {
    border-radius: 10px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    margin-bottom: 0;
}

.table thead {
    background: var(--primary-color);
    color: white;
}

.badge {
    padding: 0.4rem 0.8rem;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Courier Card */
.courier-card {
    background: white;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    text-align: center;
    transition: var(--transition);
}

.courier-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.courier-avatar {
    font-size: 5rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.courier-stats {
    display: flex;
    justify-content: space-around;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

.stat-item {
    text-align: center;
}

.stat-item strong {
    display: block;
    font-size: 1.5rem;
    color: var(--primary-color);
}

.stat-item small {
    color: #666;
}

/* Waybill Print Styles */
.waybill {
    background: white;
    padding: 2rem;
    border: 2px solid #000;
}

.waybill-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #000;
}

.waybill-section {
    margin-bottom: 1.5rem;
    padding: 1rem;
    border: 1px solid #ddd;
}

.waybill-barcode {
    text-align: center;
    margin: 2rem 0;
}

@media print {
    body * {
        visibility: hidden;
    }
    
    #waybillContent,
    #waybillContent * {
        visibility: visible;
    }
    
    #waybillContent {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
    }
    
    .modal-header,
    .modal-footer {
        display: none !important;
    }
}

/* ===================================
   ANIMATIONS
   =================================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    }
}

/* Delivery Marker Custom Styles */
.delivery-marker {
    background: transparent !important;
    border: none !important;
}

/* Map pins */
.map-pin-wrap {
    background: transparent !important;
    border: none !important;
}
.map-pin {
    width: var(--pin);
    height: var(--pin);
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    border: 3px solid #fff;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: calc(var(--pin) * 0.42);
    position: relative;
}
.map-pin i {
    transform: rotate(45deg);
}
.pin-current { background: var(--primary-color); }
.pin-origin { background: #28a745; }
.pin-dest { background: #dc3545; }
.pin-current::after {
    content: '';
    position: absolute;
    inset: -9px;
    border-radius: 50%;
    border: 3px solid rgba(255, 102, 0, 0.5);
    animation: pin-pulse 1.8s ease-out infinite;
}
@keyframes pin-pulse {
    0% { transform: scale(0.7); opacity: 1; }
    100% { transform: scale(1.5); opacity: 0; }
}
.map-label {
    background: #fff;
    color: #333;
    border: none;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
    font-size: 11px;
    font-weight: 600;
    padding: 1px 8px;
}
.map-label::before { display: none; }
.fade-in {
    animation: fadeInUp 0.5s ease;
}

/* ===================================
   RESPONSIVE
   =================================== */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .hero-section {
        padding: 100px 0 60px;
    }
    
    .stat-card {
        margin-bottom: 1rem;
    }
}

@media (max-width: 768px) {
    .hero-section {
        padding: 80px 0 40px;
    }
    
    .hero-section h1 {
        font-size: 2rem;
    }
    
    .service-card {
        margin-bottom: 1.5rem;
    }
    
    .btn-install {
        bottom: 20px;
        right: 20px;
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
}

/* ===================================
   UTILITY CLASSES
   =================================== */
.cursor-pointer {
    cursor: pointer;
}

.card {
    border: none;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    border-radius: 15px;
    margin-bottom: 1.5rem;
}

.card-header {
    background: white;
    border-bottom: 1px solid #eee;
    padding: 1rem 1.5rem;
    font-weight: 600;
}

.btn {
    border-radius: 8px;
    padding: 0.6rem 1.5rem;
    font-weight: 500;
    transition: var(--transition);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.form-control,
.form-select {
    border-radius: 8px;
    border: 1px solid #ddd;
    padding: 0.7rem 1rem;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Loading Spinner */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* Alert Animations */
.alert {
    border-radius: 10px;
    border: none;
    animation: fadeInUp 0.5s ease;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Tracking input mobile */
#trackingNumber { min-width: 0; text-overflow: ellipsis; }
@media (max-width: 576px) {
    #trackingForm .input-group-lg > .form-control, #trackingForm .input-group-lg > .btn { font-size: 0.95rem; padding-left: 0.75rem; padding-right: 0.75rem; }
}

/* ===================================
   ADMIN RESPONSIVE
   =================================== */
.min-w-0 { min-width: 0; }
.sidebar-backdrop { display: none; }
.content-page .table-responsive, .content-page .card { max-width: 100%; }
.content-page table { white-space: nowrap; }
.content-page canvas { max-width: 100%; }

@media (max-width: 992px) {
    .sidebar { width: 280px; max-width: 85vw; box-shadow: none; }
    .sidebar.show { box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3); }
    .sidebar.show + .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.45);
        z-index: 999;
    }
    .topbar { padding: 1rem 1.25rem; z-index: 998; }
    .content-area { padding: 1.25rem; }
}

@media (max-width: 576px) {
    .topbar { padding: 0.75rem 0.75rem; }
    .topbar h4 { font-size: 1.1rem; }
    .topbar .btn-sm { padding: 0.4rem 0.6rem; font-size: 0.8rem; }
    .topbar .btn-sm i { margin: 0; }
    .content-area { padding: 0.75rem; }
    .card-header { padding: 0.75rem 1rem; }
    .card-body { padding: 1rem; }
    .stat-card-admin { padding: 1rem; gap: 0.5rem; }
    .stat-card-admin h3 { font-size: 1.1rem; word-break: break-word; }
    .stat-card-admin p { font-size: 0.75rem; margin-bottom: 0; }
    .stat-card-admin .stat-icon { font-size: 1.5rem; }
    .login-card { padding: 1.75rem 1.25rem; }
    .btn { padding: 0.5rem 1rem; }
    .modal-dialog { margin: 0.5rem; }
    .content-page .table { font-size: 0.85rem; }
}

/* Tabel jadi kartu di layar kecil */
@media (max-width: 768px) {
    .content-page table.table-stack { white-space: normal; }
    .table-stack thead { display: none; }
    .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
    .table-stack tr {
        background: #fff;
        border: 1px solid #e5e8ee;
        border-radius: 12px;
        margin-bottom: 0.75rem;
        padding: 0.5rem 0.75rem;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
    }
    .table-stack td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 1rem;
        padding: 0.4rem 0;
        border: 0;
        text-align: right;
        word-break: break-word;
    }
    .table-stack td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #6c757d;
        text-align: left;
        flex-shrink: 0;
    }
    .table-stack td.td-actions { justify-content: flex-end; border-top: 1px solid #eee; margin-top: 0.4rem; padding-top: 0.6rem; }
    .table-stack td.td-actions::before { margin-right: auto; }
}
