/* Custom styles for popular products report */
.product-card {
    transition: all 0.3s ease;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.05);
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* Move rank badge outside card body */
.rank-badge {
    position: absolute;
    top: 10px; /* Slightly above card */
    left: 15px;
    width: 40px;
    height: 40px;
    background-color: #7367f0;
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    font-size: 18px;
    z-index: 10;
}

/* Special style for top 3 rankings */
.top-3 {
    background-color: #ff9f43;
    font-size: 20px;
}

/* Ensure card title and content don't overlap */
.top-product .card-body {
    padding-top: 60px; /* Push content below rank badge */
    padding-left: 15px;
    padding-right: 15px;
    position: relative;
}

.top-product .card-title {
    font-size: 16px;
    margin: 0;
    padding: 10px 0;
    background-color: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    font-weight: 600;
}

/* Add spacing between card content */
.product-stats {
    margin-top: 20px; /* Ensures enough space between content and stats */
}

/* Ensure the progress bar has some margin */
.product-progress {
    height: 8px;
    margin-top: 10px; /* Space out progress bar from content */
}

/* Top products grid styles */
.top-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 15px;
}

/* Responsive adjustment */
@media (max-width: 768px) {
    .top-products-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }

    .rank-badge {
        width: 35px;
        height: 35px;
        font-size: 16px;
        top: -10px;
    }

    .product-card .card-body {
        padding-top: 70px;
    }
}

/* Ensure cards are aligned properly on small screens */
@media (max-width: 576px) {
    .product-card .card {
        min-height: 250px;
    }
}

/* Progress bar styles */
.product-progress {
    height: 8px;
    margin-top: 5px;
}

/* Top products grid styles */
.top-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 15px;
}

/* Memastikan card memiliki tinggi minimum */
.product-card .card {
    min-height: 200px;
    height: 100%;
    width: 100%; /* Pastikan lebar penuh */
    display: flex;
    flex-direction: column;
    margin-left: auto; /* Pindahkan kartu ke kanan dengan margin kiri otomatis */
    margin-right: 0; /* Menjaga margin kanan tidak tumpang tindih */
}

/* Custom styles for view toggle buttons */
.view-toggle .btn {
    padding: 0.25rem 0.5rem;
}

.view-toggle .btn i {
    margin-right: 0;
}

/* Chart container styles */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

/* Employee-specific warning styles */
.employee-warning {
    display: none;
}

.employee .employee-warning {
    display: block;
    padding: 5px 10px;
    border-radius: 4px;
    background-color: #fff8e1;
    border-left: 4px solid #ffc107;
    margin-bottom: 15px;
}

/* Role-based styling */
.admin-only {
    display: none;
}

.admin .admin-only {
    display: block;
}

.employee .sensitive-financial {
    filter: blur(4px);
    position: relative;
}

.employee .sensitive-financial:hover::after {
    content: "Data terbatas";
    position: absolute;
    left: 0;
    top: 0;
    background: rgba(255,0,0,0.2);
    padding: 2px 5px;
    border-radius: 3px;
    font-size: 10px;
    white-space: nowrap;
}

/* Disabled buttons for employees */
.employee .disabled-for-employee {
    opacity: 0.6;
    pointer-events: none;
}

.employee .request-only {
    display: inline-block;
}

.admin .request-only {
    display: none;
}

/* Styling untuk tabel view */
#table-view th:first-child {
    width: 70px; /* Lebar tetap untuk kolom ranking */
    text-align: center;
}

#table-view .badge {
    font-size: 14px;
    padding: 5px 8px;
}

/* Print specific styles */
@media print {
    .sidebar, .header, .no-print, #filter_inputs, .wordset, .search-set {
        display: none !important;
    }
    
    .page-wrapper {
        margin-left: 0 !important;
        padding: 0 !important;
    }
    
    .card {
        box-shadow: none !important;
        margin-bottom: 1rem !important;
    }
    
    .content {
        padding: 0 !important;
    }
    
    .table {
        width: 100% !important;
    }
    
    .table th, .table td {
        padding: 0.25rem !important;
    }
    
    .report-header {
        display: block !important;
        text-align: center;
        margin-bottom: 20px;
    }
    
    .report-header h2 {
        margin-bottom: 5px;
    }
    
    /* Force table view in print mode */
    #table-view {
        display: block !important;
    }
    
    #grid-view {
        display: none !important;
    }
    
    /* Hide chart canvases as they don't print well */
    canvas {
        display: none !important;
    }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .top-products-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
    
    .dash-widget {
        margin-bottom: 15px;
    }
    
    .chart-container {
        height: 250px;
    }
    
    .rank-badge {
        width: 30px;
        height: 30px;
        font-size: 14px;
    }
    
    .rank-badge.top-3 {
        width: 35px;
        height: 35px;
        font-size: 16px;
    }
    
    .top-product .card-title {
        font-size: 14px;
        min-height: 40px;
    }
}

/* Make the table more compact on smaller screens */
@media (max-width: 576px) {
    .datanew th, .datanew td {
        padding: 0.5rem 0.25rem;
        font-size: 0.875rem;
    }
    
    .view-toggle {
        margin-left: auto;
    }
}
