/* ========================================
   Global Variables
   ======================================== */
:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --success-gradient: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    --warning-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --info-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --danger-gradient: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
}

/* ========================================
   Base Styles
   ======================================== */
body {
    background-color: #f8f9fa;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* ========================================
   Navbar
   ======================================== */
.navbar {
    background: var(--primary-gradient) !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* ========================================
   Container
   ======================================== */
.container-main {
    margin: 30px auto;
    max-width: 1400px;
    padding: 0 15px;
}

/* ========================================
   Cards
   ======================================== */
.card {
    border: none;
    border-radius: 15px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
    margin-bottom: 25px;
}

.card-header {
    background: var(--primary-gradient);
    color: white;
    padding: 20px;
    border: none;
    border-radius: 15px 15px 0 0 !important;
}

.card-header h4, .card-header h5 {
    margin: 0;
    font-weight: 600;
}

/* ========================================
   Filter Tabs
   ======================================== */
.filter-tabs {
    background: white;
    border-radius: 15px;
    padding: 10px;
    margin-bottom: 25px;
    box-shadow: 0 3px 15px rgba(0,0,0,0.08);
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 12px 30px;
    border-radius: 10px;
    border: 2px solid #e9ecef;
    background: white;
    color: #6c757d;
    font-weight: 600;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-block;
}

.filter-btn:hover {
    background: #f8f9fa;
    color: #495057;
    transform: translateY(-2px);
}

.filter-btn.active {
    background: var(--primary-gradient);
    color: white;
    border-color: transparent;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

/* ========================================
   Stats Cards
   ======================================== */
.stats-card {
    border: none;
    border-radius: 15px;
    padding: 25px;
    color: white;
    margin-bottom: 25px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1);
    transition: transform 0.3s;
    position: relative;
    overflow: hidden;
}

.stats-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.stats-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 150px;
    height: 150px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    transform: translate(50%, -50%);
}

.stats-card-primary { background: var(--primary-gradient); }
.stats-card-success { background: var(--success-gradient); }
.stats-card-warning { background: var(--warning-gradient); }
.stats-card-info { background: var(--info-gradient); }
.stats-card-danger { background: var(--danger-gradient); }

.stats-icon {
    font-size: 2.5rem;
    opacity: 0.8;
    margin-bottom: 10px;
}

.stats-value {
    font-size: 2rem;
    font-weight: 700;
    margin: 10px 0;
}

.stats-label {
    font-size: 0.9rem;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.period-label {
    display: inline-block;
    background: rgba(255,255,255,0.2);
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.85rem;
    margin-left: 10px;
}

/* ========================================
   Stats Summary (for Laporan)
   ======================================== */
.stats-summary {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.stat-box {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    border-left: 4px solid #667eea;
    margin-bottom: 15px;
    flex: 1;
    min-width: 200px;
}

.stat-box .stat-label {
    font-size: 0.85rem;
    color: #6c757d;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-box .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #495057;
}

.laporan-stat-laba {
    border-left-color: #38ef7d;
}

.laporan-stat-laba .stat-value {
    color: #38ef7d;
}

/* ========================================
   Filter Section (for Laporan)
   ======================================== */
.filter-section {
    background: white;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.quick-filter {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 15px;
}

.quick-filter-btn {
    padding: 8px 20px;
    border: 2px solid #e9ecef;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    text-decoration: none;
    color: #495057;
    font-weight: 500;
}

.quick-filter-btn:hover {
    border-color: #667eea;
    color: #667eea;
    background: #f8f9fa;
}

.quick-filter-btn.active {
    background: var(--primary-gradient);
    color: white;
    border-color: transparent;
}

/* ========================================
   Forms
   ======================================== */
.form-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 8px;
}

.form-control, .form-select {
    border-radius: 10px;
    padding: 12px;
    border: 2px solid #e9ecef;
    transition: all 0.3s;
}

.form-control:focus, .form-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.15);
}

/* ========================================
   Buttons
   ======================================== */
.btn-submit {
    background: var(--primary-gradient);
    border: none;
    padding: 12px 30px;
    border-radius: 10px;
    font-weight: 600;
    transition: transform 0.2s;
    color: white;
}

.btn-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
    color: white;
}

.btn-cancel {
    background: #6c757d;
    border: none;
    padding: 12px 30px;
    border-radius: 10px;
    font-weight: 600;
    transition: transform 0.2s;
    color: white;
}

.btn-cancel:hover {
    background: #5a6268;
    transform: translateY(-2px);
    color: white;
}

.btn-action {
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.3s;
    border: none;
    margin: 0 2px;
}

.btn-edit {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
}

.btn-edit:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(240, 147, 251, 0.4);
    color: white;
}

.btn-delete {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    color: white;
}

.btn-delete:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(250, 112, 154, 0.4);
    color: white;
}

.btn-export {
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s;
    border: none;
    margin: 5px;
}

.btn-excel {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
}

.btn-excel:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(17, 153, 142, 0.3);
    color: white;
}

.btn-pdf {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    color: white;
}

.btn-pdf:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(250, 112, 154, 0.3);
    color: white;
}

/* ========================================
   Tables
   ======================================== */
.table {
    margin-bottom: 0;
    font-size: 0.9rem;
}

.table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.table thead th {
    border: none;
    padding: 12px 10px;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    white-space: nowrap;
    vertical-align: middle;
}

.table tbody tr {
    transition: all 0.3s;
}

.table tbody tr:hover {
    background-color: #f8f9fa;
}

.table tbody td {
    padding: 12px 10px;
    vertical-align: middle;
    border-bottom: 1px solid #f1f3f5;
}

.table tfoot {
    background-color: #f8f9fa;
    font-weight: 700;
}

.table tfoot td {
    padding: 12px 10px;
    border-top: 2px solid #dee2e6;
}

.table .text-end {
    text-align: right !important;
}

.table .text-center {
    text-align: center !important;
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 10px;
}

.table-responsive::-webkit-scrollbar {
    height: 8px;
}

.table-responsive::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.table-responsive::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

.table-responsive::-webkit-scrollbar-thumb:hover {
    background: #5568d3;
}

/* ========================================
   Badges
   ======================================== */
.badge-laba {
    background: var(--success-gradient);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 600;
}

.badge-rugi {
    background: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-weight: 600;
}

.badge-profit {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
    padding: 8px 15px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.85rem;
}

/* ========================================
   Charts
   ======================================== */
.chart-container {
    position: relative;
    height: 350px;
    padding: 20px;
}

/* ========================================
   Empty State
   ======================================== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
}

.empty-state i {
    font-size: 4rem;
    opacity: 0.3;
    margin-bottom: 20px;
}

/* ========================================
   Product Ranking
   ======================================== */
.product-rank {
    display: flex;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    margin-bottom: 10px;
    transition: all 0.3s;
}

.product-rank:hover {
    background: #e9ecef;
    transform: translateX(5px);
}

.rank-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: #667eea;
    margin-right: 15px;
    min-width: 40px;
}

.rank-info {
    flex: 1;
}

.rank-name {
    font-weight: 600;
    color: #495057;
}

.rank-detail {
    font-size: 0.85rem;
    color: #6c757d;
}

/* ========================================
   Breadcrumb
   ======================================== */
.breadcrumb {
    background: transparent;
    padding: 0;
    margin-bottom: 20px;
}

.breadcrumb-item a {
    color: #667eea;
    text-decoration: none;
}

.breadcrumb-item.active {
    color: #6c757d;
}

/* ========================================
   Info Box
   ======================================== */
.info-box {
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
    border-left: 4px solid #667eea;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 20px;
}

.info-box i {
    color: #667eea;
    margin-right: 10px;
}

/* ========================================
   Product Info (Harga Info)
   ======================================== */
.product-info {
    display: none;
    margin-top: 10px;
    padding: 10px;
    background-color: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

/* ========================================
   Calculation Preview
   ======================================== */
.calculation-preview {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 10px;
    margin-top: 20px;
    border-left: 4px solid #667eea;
}

.calculation-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #e9ecef;
}

.calculation-row:last-child {
    border-bottom: none;
    font-weight: 700;
    color: #667eea;
    font-size: 1.1rem;
}

/* ========================================
   Edit Mode Indicator
   ======================================== */
.edit-mode-indicator {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    padding: 10px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ========================================
   Profit Margin
   ======================================== */
.profit-margin {
    font-size: 0.85rem;
    color: #28a745;
    font-weight: 600;
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 768px) {
    .stats-value { 
        font-size: 1.5rem; 
    }
    
    .table { 
        font-size: 0.85rem; 
    }
    
    .filter-tabs {
        flex-direction: column;
    }
    
    .filter-btn {
        width: 100%;
        text-align: center;
    }

    .quick-filter {
        flex-direction: column;
    }

    .quick-filter-btn {
        width: 100%;
    }

    .btn-export {
        flex: 1;
        margin: 5px 0;
    }

    .stats-summary {
        flex-direction: column;
    }

    .stat-box {
        min-width: 100%;
    }

    .container-main {
        padding: 0 10px;
    }
}