/* Tailwind-like Utility Classes */
.bg-light-gray { background-color: #F5F6F5; }
.bg-navy-blue { background-color: #123E59; }
.bg-teal-green { background-color: #49A087; }
.bg-teal-green-opac { background-color: #49A08780; }
.bg-gray-100 { background-color: #F3F4F6; }
.text-teal-green { color: #49A087; }
.text-teal-blue { color: #368D98; }
.text-white { color: #FFFFFF; }
.text-gray-300 { color: #D1D5DB; }
.text-gray-500 { color: #6B7280; }
.text-gray-600 { color: #4B5563; }
.text-red-600 { color: #DC2626; }
.text-sm { font-size: 0.875rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.p-4 { padding: 1rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.text-center { text-align: center; }
.w-full {
    width: 100% !important;
    padding-right: 20px;
}
.w-16 { width: 4rem; }
.max-w-xs { max-width: 200px; }
.ml-2 { margin-left: 0.5rem; }
.rounded-lg { border-radius: 0.5rem; }
.inline { display: inline; }

/* Hover Utilities */
.hover\:text-gray-300:hover { color: #D1D5DB; }

/* Flex Utilities */
.flex-row {
    display: flex;
    flex-direction: row;
    gap: 1rem;
    align-items: stretch;
    flex-wrap: nowrap;
}
.flex-row.gap {
    gap: 2rem;
}
.gap {
    gap: 1rem;
}
.gap-sm {
    gap: 0.5rem;
}
.section-graph {
    flex-grow: 1;
    min-width: 300px;
    min-height: 400px;
    position: relative;
}
.section-graph canvas {
    width: 100%;
    height: 100%;
}
.section-half {
    width: 50%;
    padding: 1rem;
}
.section-selection {
    width: 300px;
    flex-shrink: 0;
}

/* Container and Navigation */
.container {
    max-width: 1400px;
    margin: 2rem auto;
    padding: 0 1rem;
    font-family: Arial, sans-serif;
}
.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
}
.page-name {
    font-family: Arial, sans-serif;
}
.nav-links a {
    margin-left: 1.5rem;
    text-decoration: none;
    font-family: Arial, sans-serif;
}
.nav-links a:hover {
    color: #368D98;
}

/* Card Styles */
.card {
    background-color: #FFFFFF;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

/* Summary Stats */
.summary-stats {
    display: flex;
    justify-content: space-around;
    margin-top: 2rem;
}
.summary-card {
    background-color: #FFFFFF;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    text-align: center;
    width: 30%;
}
.summary-card p {
    margin: 0;
    font-family: Arial, sans-serif;
}
.summary-card .value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #49A087;
    margin-top: 0.5rem;
}

/* Button Styles */
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    text-decoration: none;
    font-family: Arial, sans-serif;
    display: inline-block;
    cursor: pointer;
}
.btn-primary {
    background-color: #49A087;
    color: #FFFFFF;
    border: none;
}
.btn-primary:hover {
    background-color: #368D98;
}
.btn-sm {
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
}
.btn-link {
    color: #49A087;
    background: none;
    border: none;
    padding: 0.75rem 1.5rem;
    text-decoration: underline;
    cursor: pointer;
    font-family: Arial, sans-serif;
    display: inline-block;
}
.btn-link:hover {
    color: #368D98;
}
.close-btn {
    padding: 0.5rem 1rem;
    background-color: #49A087;
    color: #FFFFFF;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-family: Arial, sans-serif;
}
.close-btn:hover {
    background-color: #368D98;
}

/* Form and Filter Styles */
.form-group {
    margin-bottom: 1rem;
}
.form-group label {
    display: inline-block;
    margin-bottom: 0.5rem;
    font-weight: bold;
    font-family: Arial, sans-serif;
    width: 220px;
    vertical-align: middle;
}
.form-group input,
.form-group select {
    width: 300px;
    padding: 0.2rem;
    border: 1px solid #D1D5DB;
    border-radius: 4px;
    font-family: Arial, sans-serif;
    display: inline-block;
    height: 2.5rem;
    vertical-align: middle;
}
.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #49A087;
    box-shadow: 0 0 0 3px rgba(73, 160, 135, 0.1);
}
.form-group input[type="checkbox"] {
    width: auto;
    margin-right: 0.5rem;
}
.form-group input[type="checkbox"] + label {
    display: inline-block;
    margin-left: 0.25rem;
    font-weight: normal;
    width: auto;
    vertical-align: middle;
}
.form-group button {
    height: 2.5rem;
    padding: 0 1rem;
    vertical-align: middle;
}
.form-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 1rem;
    max-width: 600px;
}
.filter-form {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.5rem;
    background-color: #FFFFFF;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 1rem;
}
.filter-form .form-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}
.filter-form .form-group label {
    margin-right: 0;
    font-weight: bold;
    width: auto;
}
.filter-form input {
    width: 100%;
    max-width: none;
}
.filter-form button {
    width: 100%;
    height: 1.5rem;
    padding: 0 0.5rem;
    font-size: 0.875rem;
}
.filter-form select,
.filter-form input[type="date"] {
    width: 300px;
    height: 2.5rem;
    padding: 0.5rem;
    border: 1px solid #D1D5DB;
    border-radius: 4px;
}
.input-sm {
    height: 1.5rem;
    font-size: 0.875rem;
    padding: 0.1rem;
}
#endDay {
    width: 280px !important;
    padding: 0 !important;
}
.filter-type-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    background-color: #FFFFFF;
    border-radius: 4px;
    padding: 0.5rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.filter-type-container label {
    font-family: Arial, sans-serif;
    font-weight: bold;
    color: #4B5563;
    margin-right: 0.5rem;
}
.filter-type-container input[type="radio"] {
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid #D1D5DB;
    border-radius: 50%;
    appearance: none;
    cursor: pointer;
}
.filter-type-container input[type="radio"]:checked {
    border-color: #49A087;
    background-color: #49A087;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='8' cy='8' r='4'/%3E%3C/svg%3E");
}
.filter-type-container input[type="radio"]:hover {
    border-color: #368D98;
}

/* Table Styles */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
    background-color: #FFFFFF;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
table.sortable {
    border-radius: 8px;
    overflow: hidden;
}
th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #E5E7EB;
    font-family: Arial, sans-serif;
}
th {
    background-color: #F9FAFB;
    font-weight: bold;
    cursor: pointer;
}
th:hover {
    background-color: #E5E7EB;
}
table.sortable th,
table.sortable td {
    transition: background-color 0.2s;
}
tr:hover {
    background-color: #F9FAFB;
}
table.sortable tr:hover td {
    color: #123E59;
}
th.asc::after {
    content: ' ↑';
    color: #49A087;
}
th.desc::after {
    content: ' ↓';
    color: #49A087;
}
.sort-arrow {
    display: inline-block;
    font-size: 0.8em;
    color: #666;
}
.sorted-asc .sort-arrow,
.sorted-desc .sort-arrow {
    color: #000;
    font-weight: bold;
}
.table-input {
    padding: 0.5rem;
    border: 1px solid #D1D5DB;
    border-radius: 4px;
}
.match-row {
    background-color: #D4EDDA;
}
.mismatch-row {
    background-color: #F8D7DA;
}

/* Popup Styles */
.popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}
.popup-content {
    background-color: #FFFFFF;
    padding: 1.5rem;
    border-radius: 8px;
    text-align: center;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}
.popup-content.error {
    background-color: #FEE2E2;
    color: #DC2626;
}
.popup-content p {
    margin: 0 0 1rem 0;
    font-family: Arial, sans-serif;
}
.hidden {
    display: none;
}

/* Toast Styles */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: #D1FAE5;
    color: #065F46;
    padding: 1rem;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    max-width: 300px;
    font-family: Arial, sans-serif;
    animation: slideIn 0.3s ease-out;
}
.toast.error {
    background-color: #FEE2E2;
    color: #DC2626;
}
.toast p {
    margin: 0;
}
@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Log Viewer Styles */
.log-container {
    background-color: #FFFFFF;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-top: 2rem;
}
.log-container pre {
    white-space: pre-wrap;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.875rem;
    margin: 0;
}

/* Buybox Status Indicators */
.bg-green, .green { background-color: #D1FAE5; }
.bg-red, .red { background-color: #FEE2E2; }
.bg-white, .white { background-color: #FFFFFF; }

/* Chart Styles */
.chart-container {
    max-width: 800px;
    height: 300px;
    margin: 0 auto;
    padding: 1rem;
}
:root {
    --chart-units-color: #26A69A; /* Darker teal for border */
    --chart-units-bg: #4DB6AC;    /* Muted teal for background */
    --chart-revenue-color: #ff6384;
    --chart-revenue-bg: rgba(255, 99, 132, 0.2);
    --chart-text-color: #333;
    --chart-grid-color: #e0e0e0;
    --chart-font-size: 14px;
}
.dynamic-color {
    /* Placeholder for JavaScript to set background-color dynamically */
}

/* Loading Indicator */
.loading-indicator {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: rgba(73, 160, 135, 0.8); /* #49A087 with opacity */
    color: #FFFFFF;
    padding: 2rem;
    border-radius: 8px;
    z-index: 1001;
}
.loading-indicator.hidden {
    display: none;
}
.loading-indicator .spinner {
    width: 48px;
    height: 48px;
    border: 5px solid #26A69A; /* Darker teal */
    border-top: 5px solid #FFFFFF;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}
.loading-indicator p {
    margin: 0.75rem 0 0;
    font-family: Arial, sans-serif;
    font-size: 1rem;
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Alert Styles */
.alert {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    font-family: Arial, sans-serif;
}
.alert-success {
    background-color: #D1FAE5;
    color: #065F46;
}
.alert-error {
    background-color: #FEE2E2;
    color: #DC2626;
}

/* Link Styles */
a {
    color: #49A087;
    text-decoration: underline;
}

/* Product List Styles */
.product-list {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #D1D5DB;
    border-radius: 4px;
    padding: 0.5rem;
}
.product-list .form-group {
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
}
.product-list .form-group .color-box {
    width: 12px;
    height: 12px;
    margin-right: 0.5rem;
    border: 1px solid #000;
    display: inline-block;
}
.product-list .form-group label {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    display: inline-block;
    vertical-align: middle;
}
.product-list .form-group label:hover::after {
    content: attr(title);
    position: absolute;
    background-color: #333;
    color: #fff;
    padding: 2px 6px;
    border-radius: 3px;
    white-space: nowrap;
    z-index: 1;
    margin-left: 5px;
}
.product-list .form-group input[type="checkbox"] {
    margin-right: 0.5rem;
}

/* Profit Over Time Styles */
.profit-over-time {
    overflow-y: auto;
    overflow-x: auto;
    width: 100%;
    box-sizing: border-box;
    display: block;
    white-space: nowrap;
}
.profit-over-time .form-group {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
    padding-right: 2rem;
}
.profit-over-time .form-group .color-box {
    width: 12px;
    height: 12px;
    margin-right: 0.5rem;
    border: 1px solid #000;
    display: inline-block;
    flex-shrink: 0;
}
.profit-over-time .form-group label {
    white-space: nowrap;
    overflow: visible;
    max-width: none;
    width: auto;
    display: inline-block;
    vertical-align: middle;
    padding-right: 1rem;
}
.profit-over-time .form-group input[type="checkbox"] {
    margin-right: 0.5rem;
    flex-shrink: 0;
}
.profit-over-time label[title]:hover:after {
    content: attr(title);
    position: absolute;
    background-color: rgba(128, 128, 128, 0.9);
    color: white;
    padding: 5px 10px;
    border-radius: 3px;
    white-space: nowrap;
    z-index: 1000;
    margin-left: 10px;
    max-width: 600px;
    overflow: hidden;
    text-overflow: ellipsis;
    transform: translateX(0);
    left: 100%;
    top: -5px;
}

/* Logo Styles */
.logo {
    height: 40px;
    width: auto;
    vertical-align: middle;
}

/* Responsive Adjustments */
@media (max-width: 1400px) {
    .container {
        max-width: 90%;
    }
    .nav-container {
        max-width: 90%;
    }
}
@media (max-width: 768px) {
    .container {
        max-width: 95%;
        padding: 0 0.5rem;
    }
    .nav-container {
        max-width: 95%;
    }
    .flex-row {
        flex-direction: column;
        align-items: stretch;
    }
    .flex-row.gap {
        gap: 1rem;
    }
    .section-graph {
        width: 100%;
        min-height: 300px;
    }
    .section-selection {
        width: 100%;
    }
    .summary-stats {
        flex-direction: column;
        align-items: center;
    }
    .summary-card {
        width: 80%;
        margin-bottom: 1rem;
    }
    .nav-links a {
        margin-left: 1rem;
    }
    .form-group label {
        width: 100%;
        display: block;
    }
    .form-group input,
    .form-group select {
        width: 100%;
    }
    .form-group input[type="checkbox"] {
        margin-left: 0;
    }
    .form-group button {
        width: 100%;
        margin-top: 0.5rem;
    }
    .filter-form {
        flex-direction: column;
        padding: 0.5rem;
    }
    .filter-form .form-group {
        min-width: 100%;
    }
    .filter-form select,
    .filter-form input[type="date"],
    .filter-form button {
        width: 100%;
    }
    #endDay {
        width: 100% !important;
        padding: 0 !important;
    }
}
@media (max-width: 600px) {
    .profit-over-time label[title]:hover:after {
        left: auto;
        right: 100%;
        margin-right: 10px;
    }
}
