/* Dashboard Styles */
.dashboard-container {
    padding: 0;
	margin-left: -20px;
    margin-right: -20px;
    background-color: transparent;
    border-radius: 0;
    box-shadow: none;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.dashboard-header h2 {
    margin: 0;
    color: #333;
    font-size: 24px;
    font-weight: 595;
}

.dashboard-controls {
    display: flex;
    gap: 15px;
    align-items: center;
}

.date-range-selector {
    display: flex;
    align-items: center;
    gap: 8px;
}

.date-range-selector label {
    font-weight: 510;
    color: #555;
    font-size: 12px;
}

.date-range-selector select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 12px;
    background: #fff;
}

.custom-date-range {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

.custom-date-range input[type="date"] {
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 11px;
}

/* Metrics Cards */
.metrics-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.metric-card {
    background: #fff;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border-left: 4px solid;
}

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

.metric-card.revenue {
    border-left-color: #007bff;
}

.metric-card.orders {
    border-left-color: #6c757d;
}

.metric-card.delivered {
    border-left-color: #28a745;
}

.metric-card.profit {
    border-left-color: #fd7e14;
}

.metric-icon {
    font-size: 34px;
    opacity: 0.8;
}

.metric-content h3 {
    margin: 0 0 8px 0;
    font-size: 12px;
    color: #666;
    font-weight: 510;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-value {
    font-size: 27px;
    font-weight: 595;
    color: #333;
    margin-bottom: 5px;
}

.metric-change {
    font-size: 10px;
    font-weight: 425;
}

.metric-change.positive {
    color: #28a745;
}

.metric-change.negative {
    color: #dc3545;
}

/* Charts Section */
.charts-section {
    margin-bottom: 30px;
}

.chart-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.chart-container {
    background: #fff;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.chart-header h3 {
    margin: 0;
    color: #333;
    font-size: 15px;
    font-weight: 510;
}

.chart-controls {
    display: flex;
    gap: 5px;
}

.chart-toggle {
    padding: 6px 12px;
    border: 1px solid #ddd;
    background: #f8f9fa;
    border-radius: 4px;
    cursor: pointer;
    font-size: 10px;
    font-weight: 425;
    transition: all 0.3s ease;
}

.chart-toggle.active {
    background: #007bff;
    color: white;
    border-color: #007bff;
}

.chart-toggle:hover:not(.active) {
    background: #e9ecef;
}

.chart-content {
    position: relative;
    height: 300px;
}

.chart-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: #666;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

.legend-color.delivered {
    background: #28a745;
}

.legend-color.failed {
    background: #dc3545;
}

.legend-color.revenue {
    background: #007bff;
}

.legend-color.profit {
    background: #28a745;
}

/* Additional Metrics */
.additional-metrics {
    margin-top: 30px;
}

.metrics-toggle {
    text-align: center;
    margin-bottom: 20px;
}

.additional-metrics-content {
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Top Items List */
.top-items-list {
    max-height: 300px;
    overflow-y: auto;
}

.top-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #eee;
}

.top-item:last-child {
    border-bottom: none;
}

.item-info {
    flex: 1;
}

.item-name {
    font-weight: 510;
    color: #333;
    margin-bottom: 4px;
}

.item-stats {
    font-size: 10px;
    color: #666;
}

.item-revenue {
    font-weight: 595;
    color: #007bff;
    font-size: 14px;
}

/* Recent Activity */
.recent-activity-section {
    background: #fff;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.section-header h3 {
    margin: 0;
    color: #333;
    font-size: 15px;
    font-weight: 510;
}

.view-all-link {
    color: #007bff;
    text-decoration: none;
    font-weight: 425;
    font-size: 12px;
}

.view-all-link:hover {
    text-decoration: underline;
}

.recent-orders-table {
    overflow-x: auto;
}

.recent-orders-table table {
    width: 100%;
    border-collapse: collapse;
}

.recent-orders-table th,
.recent-orders-table td {
    padding: 12px 8px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.recent-orders-table th {
    background: #f8f9fa;
    font-weight: 510;
    color: #333;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

/* Loading States */
.dashboard-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    color: #666;
    font-size: 14px;
    font-weight: 425;
}

/* Chart Loading State */
.chart-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 300px;
    color: #666;
    font-style: italic;
}

/* Button Styles */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 425;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s ease;
}

.btn-primary {
    background: #007bff;
    color: white;
}

.btn-primary:hover {
    background: #0056b3;
    transform: translateY(-1px);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #545b62;
}

.btn-small {
    padding: 6px 12px;
    font-size: 10px;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .chart-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    /* FIX 4: Makes dashboard use full screen width */
    .dashboard-container {
    width: 100vw;
    position: relative;
    left: 50%;
    transform: translateX(-50%);
    box-sizing: border-box;
    padding-left: 5px;  /* Adjust this value to your liking */
    padding-right: 5px; /* Adjust this value to your liking */
}

    .dashboard-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }

    .dashboard-controls {
        flex-direction: column;
        gap: 10px;
    }

    /* FIX 2: Creates a consistent 2-column layout for cards */
    .metrics-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    /* FIX 3: Reduces internal spacing of the cards */
    .metric-card {
        padding: 15px;
        gap: 10px;
    }

    .metric-icon {
        font-size: 27px;
    }

    .metric-value {
        font-size: 20px;
    }

    /* FIX 1: Stacks the charts vertically */
    .chart-row {
        grid-template-columns: 1fr;
    }

    .chart-container {
        /* This can be removed or left, but the rule below is more important */
        overflow-x: auto;
    }

    .chart-header {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }

    .chart-content {
    height: 250px; /* This is for the graphical charts */
    overflow-x: auto; /* This adds horizontal scroll to tables */
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

    .chart-legend {
        flex-wrap: wrap;
        gap: 10px;
    }

    .custom-date-range {
        flex-direction: column;
        gap: 5px;
    }
}

@media (max-width: 480px) {
    .metrics-cards {
        grid-template-columns: 1fr;
    }
    
    .metric-card {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    .chart-controls {
        flex-direction: column;
        gap: 5px;
    }
    
    .chart-toggle {
        width: 100%;
        justify-content: center;
    }
}

/* Status Badge Styles for Recent Orders */
.status-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 9px;
    font-weight: 510;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-badge.delivered {
    background: #d4edda;
    color: #155724;
}

.status-badge.confirmed {
    background: #d1ecf1;
    color: #0c5460;
}

.status-badge.dispatched {
    background: #fff3cd;
    color: #856404;
}

.status-badge.failed {
    background: #f8d7da;
    color: #721c24;
}

.status-badge.ongoing {
    background: #ffeaa7;
    color: #6c5ce7;
}

/* Animation for metric cards */
.metric-card {
    animation: fadeInUp 0.6s ease forwards;
}

.metric-card:nth-child(1) { animation-delay: 0.1s; }
.metric-card:nth-child(2) { animation-delay: 0.2s; }
.metric-card:nth-child(3) { animation-delay: 0.3s; }
.metric-card:nth-child(4) { animation-delay: 0.4s; }

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

/* Chart container animations */
.chart-container {
    animation: fadeIn 0.8s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Notification Styles */
.opm-notification {
    position: fixed;
    top: 32px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 425;
    z-index: 9999;
    max-width: 400px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    animation: slideInRight 0.3s ease;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.opm-notification-success {
    background: linear-gradient(135deg, #28a745, #20c997);
}

.opm-notification-error {
    background: linear-gradient(135deg, #dc3545, #e74c3c);
}

.opm-notification-info {
    background: linear-gradient(135deg, #17a2b8, #007bff);
}

.opm-notification-close {
    background: none;
    border: none;
    color: white;
    font-size: 15px;
    cursor: pointer;
    margin-left: 15px;
    padding: 0;
    line-height: 1;
    opacity: 0.8;
}

.opm-notification-close:hover {
    opacity: 1;
}

.toplevel_page_opm-dashboard .wrap {
    margin: 5px;
}