/**
 * Reports Engine Frontend Styles
 *
 * @package ReportsEngine
 */

/* Container */
.reports-engine-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px 0;
}

.reports-engine-container h2 {
    margin-bottom: 20px;
    font-size: 1.5em;
    color: #23282d;
}

/* Reports List */
.reports-list {
    margin-bottom: 30px;
}

.report-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    margin-bottom: 15px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.report-card:hover {
    border-color: #2271b1;
}

.report-info h3 {
    margin: 0 0 5px 0;
    font-size: 1.1em;
    color: #23282d;
}

.report-info p {
    margin: 0;
    color: #666;
    font-size: 0.9em;
}

.report-actions {
    flex-shrink: 0;
    margin-left: 20px;
}

.btn-generate-report {
    background: #2271b1 !important;
    color: #fff !important;
    border-color: #2271b1 !important;
    padding: 8px 20px !important;
    font-size: 14px !important;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-generate-report:hover {
    background: #135e96 !important;
    border-color: #135e96 !important;
}

.btn-generate-report:disabled {
    background: #a0a5aa !important;
    border-color: #a0a5aa !important;
    cursor: not-allowed;
}

/* Reports Sections */
.reports-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #ddd;
}

.reports-section h3 {
    margin: 0 0 15px 0;
    font-size: 1.1em;
    color: #23282d;
}

/* Collapsible Header */
.collapsible-header {
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.collapsible-header:hover {
    color: #2271b1;
}

.collapsible-header .toggle-icon {
    font-size: 0.8em;
    transition: transform 0.2s;
}

.collapsible-header .count {
    color: #666;
    font-weight: normal;
    font-size: 0.9em;
}

/* Jobs List */
.reports-jobs-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.report-job-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    border-left: 4px solid #ccc;
    transition: all 0.3s ease;
}

.report-job-row.status-queued {
    border-left-color: #f0ad4e;
}

.report-job-row.status-running {
    border-left-color: #5bc0de;
}

.report-job-row.status-completed {
    border-left-color: #5cb85c;
}

.report-job-row.status-failed {
    border-left-color: #d9534f;
}

.job-info {
    flex: 1;
}

.job-info .job-type {
    display: block;
    font-weight: 500;
    color: #23282d;
    margin-bottom: 3px;
}

.job-info .job-date {
    display: block;
    font-size: 0.85em;
    color: #666;
}

.job-status {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 20px;
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8em;
    font-weight: 500;
    text-transform: uppercase;
}

.status-badge.status-queued {
    background: #fcf8e3;
    color: #8a6d3b;
}

.status-badge.status-running {
    background: #d9edf7;
    color: #31708f;
}

.status-badge.status-completed {
    background: #dff0d8;
    color: #3c763d;
}

.status-badge.status-failed {
    background: #f2dede;
    color: #a94442;
}

.job-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-download {
    background: #5cb85c !important;
    color: #fff !important;
    border-color: #5cb85c !important;
    text-decoration: none !important;
}

.btn-download:hover {
    background: #449d44 !important;
    border-color: #449d44 !important;
}

.btn-retry {
    background: #f0ad4e !important;
    color: #fff !important;
    border-color: #f0ad4e !important;
}

.btn-retry:hover {
    background: #ec971f !important;
    border-color: #ec971f !important;
}

.error-message {
    cursor: help;
    font-size: 1.2em;
}

/* Spinner */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #ddd;
    border-top-color: #2271b1;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Responsive */
@media (max-width: 600px) {
    .report-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .report-actions {
        margin-left: 0;
        width: 100%;
    }

    .btn-generate-report {
        width: 100%;
        text-align: center;
    }

    .report-job-row {
        flex-wrap: wrap;
        gap: 10px;
    }

    .job-info {
        flex: 1 1 100%;
    }

    .job-status {
        margin: 0;
    }

    .job-actions {
        flex: 1 1 100%;
        justify-content: flex-end;
    }
}

/* Active Reports Animation */
.reports-section.active-reports .report-job-row {
    animation: slideIn 0.3s ease;
}

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

/* WooCommerce Integration - ensure styles work within My Account */
.woocommerce-account .reports-engine-container {
    padding: 0;
}

.woocommerce-account .report-card .button,
.woocommerce-account .report-job-row .button {
    margin: 0;
}
