/* BERKAH TRACEABILITY SYSTEM - Custom Styles */

:root {
    --bts-primary: #28a745;
    --bts-secondary: #1e7e34;
    --bts-accent: #ffc107;
    --bts-danger: #dc3545;
    --bts-info: #17a2b8;
}

body {
    font-family: 'Source Sans Pro', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.sidebar-dark-success .brand-link {
    background: linear-gradient(135deg, #28a745, #1e7e34) !important;
    border-bottom: none;
}

.sidebar-dark-success {
    background-color: #1a2e1f !important;
}

.sidebar-dark-success .nav-link.active {
    background: linear-gradient(135deg, #28a745, #1e7e34) !important;
    color: white !important;
}

.sidebar-dark-success .nav-link:hover {
    background-color: rgba(40, 167, 69, 0.2) !important;
}

.sidebar-dark-success .nav-treeview .nav-link {
    color: #c2c7d0 !important;
}

.sidebar-dark-success .nav-treeview .nav-link.active {
    color: white !important;
}

.content-wrapper {
    background: #f4f6f9;
    min-height: calc(100vh - 57px);
}

.content-header h1 {
    font-weight: 600;
    color: #2d3748;
}

.breadcrumb {
    background: transparent;
}

/* Card Styling */
.card {
    border: none;
    box-shadow: 0 0 15px rgba(0,0,0,0.05);
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
}

.card-header {
    border-bottom: 1px solid rgba(0,0,0,0.05);
    background: white;
    border-radius: 0.5rem 0.5rem 0 0 !important;
}

.card-primary.card-outline {
    border-top: 3px solid #007bff;
}

.card-success.card-outline {
    border-top: 3px solid #28a745;
}

.card-warning.card-outline {
    border-top: 3px solid #ffc107;
}

.card-danger.card-outline {
    border-top: 3px solid #dc3545;
}

.card-info.card-outline {
    border-top: 3px solid #17a2b8;
}

/* Info Box */
.info-box {
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    border-radius: 0.5rem;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.info-box:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(0,0,0,0.12);
}

.info-box-icon {
    border-radius: 0.5rem 0 0 0.5rem;
}

/* Buttons */
.btn {
    border-radius: 0.375rem;
    font-weight: 500;
}

.btn-success {
    background: linear-gradient(135deg, #28a745, #1e7e34);
    border: none;
}

.btn-success:hover {
    background: linear-gradient(135deg, #218838, #15732a);
}

.btn-primary {
    background: linear-gradient(135deg, #007bff, #0056b3);
    border: none;
}

.btn-warning {
    background: linear-gradient(135deg, #ffc107, #e0a800);
    border: none;
}

/* Table */
.table thead th {
    border-top: none;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    background: #f8f9fa;
}

.table-hover tbody tr:hover {
    background-color: rgba(40, 167, 69, 0.05);
}

/* Badges */
.badge {
    font-weight: 500;
    padding: 0.35em 0.65em;
}

/* Form Controls */
.form-control, .form-select {
    border-radius: 0.375rem;
    border: 1px solid #d2d6dc;
}

.form-control:focus, .form-select:focus {
    border-color: #28a745;
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.15);
}

.input-group-text {
    background: #f8f9fa;
}

/* Scan Area */
.scan-area {
    background: linear-gradient(135deg, #1a2e1f, #2d4a33);
    color: white;
    padding: 2rem;
    border-radius: 0.75rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.scan-area::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60' viewBox='0 0 60 60'%3E%3Cg fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

.scan-area input {
    font-size: 1.5rem;
    text-align: center;
    letter-spacing: 2px;
    font-weight: bold;
}

.scan-line {
    position: absolute;
    left: 10%;
    right: 10%;
    height: 3px;
    background: linear-gradient(90deg, transparent, #28a745, #ffc107, #28a745, transparent);
    animation: scan 2s linear infinite;
}

@keyframes scan {
    0% { top: 10%; }
    50% { top: 90%; }
    100% { top: 10%; }
}

/* Barcode Display */
.barcode-display {
    display: inline-block;
    padding: 0.75rem;
    background: white;
    border: 2px solid #28a745;
    border-radius: 0.5rem;
    font-family: 'Courier New', monospace;
    font-size: 1.2rem;
    font-weight: bold;
    letter-spacing: 3px;
}

.qrcode-container {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    background: white;
    border-radius: 0.5rem;
}

/* Timeline */
.timeline-item {
    position: relative;
    padding-left: 2.5rem;
    padding-bottom: 1.5rem;
    border-left: 2px solid #28a745;
}

.timeline-item:last-child {
    border-left: 2px solid transparent;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 0;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #28a745;
    border: 3px solid white;
    box-shadow: 0 0 0 2px #28a745;
}

/* LOT Display */
.lot-display {
    background: linear-gradient(135deg, #ffc107, #ff9800);
    color: #1a1a1a;
    padding: 1rem 2rem;
    border-radius: 0.5rem;
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: 4px;
    text-align: center;
    font-family: 'Courier New', monospace;
    box-shadow: 0 4px 15px rgba(255, 193, 7, 0.4);
}

/* Print Modal */
@media print {
    .no-print {
        display: none !important;
    }
    .print-only {
        display: block !important;
    }
    body {
        background: white !important;
    }
}

.print-only {
    display: none;
}

.print-area {
    background: white;
    padding: 2rem;
}

.print-header {
    text-align: center;
    border-bottom: 2px solid #000;
    padding-bottom: 1rem;
    margin-bottom: 1rem;
}

.print-header h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: bold;
}

.print-header p {
    margin: 0;
    font-size: 0.9rem;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* Animation */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Approval Warning */
.warning-box {
    background: linear-gradient(135deg, #fff3cd, #ffeeba);
    border: 2px solid #ffc107;
    border-radius: 0.5rem;
    padding: 1rem;
    margin: 1rem 0;
}

.danger-box {
    background: linear-gradient(135deg, #f8d7da, #f5c6cb);
    border: 2px solid #dc3545;
    border-radius: 0.5rem;
    padding: 1rem;
    margin: 1rem 0;
}

.success-box {
    background: linear-gradient(135deg, #d4edda, #c3e6cb);
    border: 2px solid #28a745;
    border-radius: 0.5rem;
    padding: 1rem;
    margin: 1rem 0;
}

/* Select2 customization */
.select2-container--default .select2-selection--single {
    height: calc(1.5em + 0.75rem + 2px);
    border: 1px solid #d2d6dc;
    border-radius: 0.375rem;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: calc(1.5em + 0.75rem);
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: calc(1.5em + 0.75rem);
}

/* Stats Cards */
.stat-card {
    background: white;
    border-radius: 0.75rem;
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
    transition: all 0.3s;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: -20px;
    right: -20px;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    opacity: 0.1;
}

.stat-card:hover::after {
    transform: scale(1.2);
}

.stat-card .stat-icon {
    font-size: 3rem;
    opacity: 0.3;
    position: absolute;
    right: 1rem;
    bottom: 0.5rem;
}

/* Flow diagram */
.flow-diagram {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 1rem;
}

.flow-step {
    background: white;
    border: 2px solid #28a745;
    border-radius: 0.5rem;
    padding: 0.75rem 1rem;
    text-align: center;
    font-size: 0.85rem;
    font-weight: 600;
    min-width: 100px;
}

.flow-arrow {
    color: #28a745;
    font-size: 1.25rem;
}

/* DataTables-like styling */
.data-table-wrapper {
    overflow-x: auto;
}

/* Mini barcode in table */
svg.bc-mini {
    max-width: 140px;
    height: 32px;
    vertical-align: middle;
}

/* Gap utility */
.gap-1 { gap: 0.25rem !important; display: inline-flex; }
.gap-2 { gap: 0.5rem !important; display: inline-flex; }
.d-flex.gap-2, .flex-wrap.gap-2, .d-flex.gap-1 { display: flex !important; }

/* Badge bg-orange untuk Gula Semut */
.badge.bg-orange,
.bg-orange {
    background-color: #fd7e14 !important;
    color: #fff !important;
}
/* Warna outline purple (jika tidak ada di AdminLTE) */
.btn-outline-purple {
    color: #6f42c1;
    border: 1px solid #6f42c1;
    background: transparent;
}
.btn-outline-purple:hover {
    background: #6f42c1;
    color: #fff;
}
.bg-purple { background-color: #6f42c1 !important; color: #fff; }
.text-purple { color: #6f42c1 !important; }
.card-purple.card-outline { border-top: 3px solid #6f42c1; }
.card-purple .card-header.bg-purple { background: #6f42c1 !important; color: #fff; }

/* === Form Barang Masuk — wilayah info wrap rapi === */
.bm-wilayah-wrap {
    white-space: normal !important;
    word-wrap: break-word;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 3px 6px;
    font-size: 12px;
    line-height: 1.7 !important;
}
.bm-wilayah-wrap .badge {
    font-size: 11px !important;
    padding: 3px 7px;
}
.bm-wilayah-wrap .wil-nama {
    font-size: 12px;
    color: #495057;
}
.bm-wilayah-wrap .wil-sep {
    color: #adb5bd;
    margin: 0 2px;
}
