/* ==================== */
/* General Styles */
/* ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    color: #333;
    background-color: #f9f9f9;
}

/* Consistent shadow and border-radius */
.status-tile, .recent-activity-tile, .chart-container-shipping, #wpcargo-account .wpcargo-table-responsive, .alert-box {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    overflow: hidden;
}

/* ==================== */
/* Loading Spinner */
/* ==================== */
.loading-spinner {
    display: none; /* Hidden by default */
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    background: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.loading-spinner .spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #CC631B;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ==================== */
/* Charts Container */
/* ==================== */
.charts-row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    width: 100%;
    max-width: 100%;
    overflow: hidden; /* Prevent horizontal overflow */
}

.chart-container-shipping {
    flex: 1;
    background: #fff;
    padding: 20px;
    border: 1px solid #e0e0e0;
    max-width: 50%;
    box-sizing: border-box;
    position: relative; /* For positioning the total weight */
}

.chart-title {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 15px;
    color: #CC631B; /* Changed title color to orange */
    white-space: nowrap; /* Prevent title from wrapping */
    overflow: hidden;
    text-overflow: ellipsis; /* Add ellipsis if title is too long */
}

.chart-total {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 12px;
    color: #666;
    background: rgba(255, 255, 255, 0.8);
    padding: 4px 8px;
    border-radius: 4px;
    z-index: 5;
}

/* ==================== */
/* Recent Activity Tile */
/* ==================== */
.recent-activity-tile {
    background: #fff;
    padding: 20px;
    border: 1px solid #e0e0e0;
    margin-bottom: 20px;
    width: 100%;
    box-sizing: border-box;
}

.recent-activity-title {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 15px;
    color: #CC631B; /* Changed title color to orange */
}

.activity-item {
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-date {
    font-size: 12px;
    color: #888;
}

.activity-status {
    font-weight: bold;
    color: #333;
}

.activity-count {
    font-weight: bold;
    color: #CC631B;
}

/* ==================== */
/* Alert Box Styles */
/* ==================== */
/* Increase specificity */
.alerts-container {
    margin-top: 0px !important; /* Force the margin */
    margin-bottom: 30px;
}

.alert-box {
    background: #fff;
    padding: 15px 20px;
    margin-bottom: 20px;
    border-left: 4px solid #CC631B;
    display: flex;
    align-items: center;
    position: relative; /* For positioning the search icon */
}

.alert-box.warning {
    border-left-color: #f6c23e;
}

.alert-box.danger {
    border-left-color: #e74a3b;
}

.alert-box.success {
    border-left-color: #1cc88a;
}

.alert-icon {
    margin-right: 15px;
    color: #CC631B;
    font-size: 20px; /* Reduced icon size */
}

.alert-box.warning .alert-icon {
    color: #f6c23e;
}

.alert-box.danger .alert-icon {
    color: #e74a3b;
}

.alert-box.success .alert-icon {
    color: #1cc88a;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: bold;
    margin-bottom: 5px;
}

.alert-message {
    color: #666;
}

/* ==================== */
/* Search Icon Styles */
/* ==================== */
.search-icon-container {
    display: none; /* Hidden by default */
    position: relative; /* Changed from absolute to relative */
    margin-left: auto; /* Add some spacing between date filter and search icon */
}

.search-icon {
    font-size: 1.2em; /* Use relative units for font size */
    color: #CC631B;
    cursor: pointer;
    background: rgba(204, 99, 27, 0.1);
    padding: 0.5em; /* Use relative units for padding */
    border-radius: 50%;
    transition: transform 0.3s ease, background 0.3s ease; /* Smooth hover effects */
}

.search-icon:hover {
    transform: scale(1.1); /* Slightly enlarge on hover */
    background: rgba(204, 99, 27, 0.2);
}

.search-popup {
    display: none;
    position: absolute;
    top: 50px;
    right: 0;
    background: #fff;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    width: 250px; /* Fixed width for the popup */
}

/* ==================== */
/* Filters Wrapper */
/* ==================== */
.filters-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px; /* Added more space before tiles */
    position: relative;
}

/* Date Filter Container */
#date-filter-container {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

#date-filter-container input[type="date"] {
    padding: 8px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-size: 14px;
}

#date-filter-container button {
    padding: 8px 15px;
    background: #CC631B;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s ease;
}

#date-filter-container button:hover {
    background: #b3571b;
}

/* Dropdown Filter Styles */
#filter-type {
    padding: 8px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-size: 14px;
    background: #fff;
    color: #333;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

#filter-type:hover {
    border-color: #CC631B;
}

#filter-type:focus {
    outline: none;
    border-color: #CC631B;
    box-shadow: 0 0 0 2px rgba(204, 99, 27, 0.2);
}

/* Tracking Filter Container */
#tracking-filter-container {
    display: flex;
    gap: 10px;
    align-items: center;
}

#tracking-filter-container input[type="text"] {
    padding: 8px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    font-size: 14px;
}

#tracking-filter-container button {
    padding: 8px 15px;
    background: #CC631B;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s ease;
}

#tracking-filter-container button:hover {
    background: #b3571b;
}

/* ==================== */
/* Shipment Status Tiles */
/* ==================== */
.shipment-status-tiles {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.status-tile {
    flex: 1 1 calc(25% - 20px);
    padding: 20px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    text-align: left;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: relative;
    color: #333;
}

.status-tile:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.status-tile .counter {
    font-size: 24px;
    font-weight: bold;
    margin: 0;
}

.status-tile .status {
    font-size: 14px;
    margin: 5px 0 0;
}

.status-tile .fa-icon {
    font-weight: 900 !important;
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 24px; /* Reduced icon size */
    color: #CC631B;
    background: rgba(204, 99, 27, 0.1);
    padding: 12px; /* Reduced padding */
    border-radius: 50%;
}

/* ==================== */
/* Shipment Table Styles */
/* ==================== */
#wpcargo-account .wpcargo-table-responsive {
    max-height: 500px;
    overflow-y: auto !important;
    position: relative;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border-radius: 8px; /* Add border radius for a softer look */
}

#wpcargo-account .wpcargo-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0;
}

#wpcargo-account .wpcargo-table th, 
#wpcargo-account .wpcargo-table td {
    padding: 12px !important;
    text-align: left !important;
    border-left: none; /* Hide vertical borders */
    border-right: none; /* Hide vertical borders */
    border-bottom: 1px solid #f0f0f0; /* Restore horizontal borders */
}

#wpcargo-account .wpcargo-table th {
    background: #f9f9f9;
    color: #333;
    font-weight: bold;
    position: sticky !important;
    top: 0 !important;
    z-index: 2; /* Ensure header is above rows */
    border-top: none; /* Remove top border for sticky header */
}

#wpcargo-account .wpcargo-table tbody td {
    color: #333 !important; /* Dark text for readability */
}

/* Restore View Links Colors */
#wpcargo-account a.view-shipment,
#wpcargo-account a.invoice-link {
    color: #CC631B !important; /* Orange color for links */
    text-decoration: none !important; /* Remove underline */
    font-weight: bold !important; /* Bold text */
    transition: color 0.3s ease !important; /* Smooth transition */
}

#wpcargo-account a.view-shipment:hover,
#wpcargo-account a.invoice-link:hover {
    color: #b3571b !important; /* Darker orange on hover */
    text-decoration: underline !important; /* Add underline on hover */
}

/* Force vertical scrolling on table for all devices */
#wpcargo-account .wpcargo-table-responsive {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    -ms-overflow-style: -ms-autohiding-scrollbar;
}

/* ==================== */
/* Responsive Adjustments */
/* ==================== */

/* Tablet Adjustments */
@media (min-width: 769px) and (max-width: 1024px) {
    .status-tile {
        flex: 1 1 calc(33.33% - 20px); /* 3 tiles per row on tablets */
        padding: 15px; /* Reduced padding */
    }

    .status-tile .fa-icon {
        font-size: 20px; /* Smaller icon size */
        padding: 10px; /* Smaller circle container */
        right: 15px; /* Adjust position */
    }

    .status-tile .counter {
        font-size: 20px; /* Smaller counter text */
    }

    .status-tile .status {
        font-size: 12px; /* Smaller status text */
    }
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .charts-row {
        flex-direction: column;
        gap: 10px;
    }

    .chart-container-shipping {
        flex: 1 1 100%; /* Full width */
        max-width: 100%; /* Full width */
        padding: 15px; /* Reduced padding */
    }

    .chart-title {
        font-size: 14px;
    }

    .chart-total {
        font-size: 10px;
        top: 10px;
        right: 10px;
    }

    .shipment-status-tiles {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .status-tile {
        flex: 1 1 calc(50% - 10px);
        padding: 15px;
    }

    .status-tile .counter {
        font-size: 18px; /* Reduced counter size */
    }

    .status-tile .status {
        font-size: 12px;
    }

    .status-tile .fa-icon {
        font-size: 18px; /* Reduced icon size */
        padding: 8px; /* Reduced padding */
        right: 10px; /* Adjusted position */
    }

    .search-icon-container {
        display: flex; /* Show search icon */
        justify-content: flex-end;
        align-items: center;
        margin-bottom: -20px;
    }

    .search-icon {
        font-size: 18px; /* Reduced icon size */
        padding: 8px; /* Reduced padding */
    }

    .search-popup {
        top: 40px;
        right: 0;
        width: 250px;
    }

    .filters-wrapper {
        flex-direction: column;
        align-items: flex-start;
        padding-top: 10px; /* Reduced padding */
        margin-top: 10px;
    }

    #date-filter-container {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        flex: 1; /* Allow date filter to take remaining space */
        display: flex;
        gap: 10px;
    }

    #date-filter-container input[type="date"] {
        width: 100%;
    }

    #date-filter-container button {
        width: 100%;
        padding: 8px 15px;
        background: #CC631B;
        color: #fff;
        border: none;
        border-radius: 4px;
        cursor: pointer;
        font-size: 14px;
        transition: background 0.3s ease;
    }

    #tracking-filter-container {
        display: none !important;
    }

    #wpcargo-account .wpcargo-table-responsive {
        max-height: 400px;
    }
}