/* CSS Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #0066cc;
    --primary-hover: #0052a3;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --secondary-color: #6c757d;
    --light-gray: #f8f9fa;
    --border-color: #dee2e6;
    --text-color: #212529;
    --text-muted: #6c757d;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--light-gray);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
header {
    background-color: var(--primary-color);
    color: white;
    padding: 2rem 0;
    margin-bottom: 2rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

header h1 {
    margin-bottom: 0.5rem;
}

header p {
    opacity: 0.9;
    font-size: 0.95rem;
}

/* Sections */
section {
    background: white;
    border-radius: 8px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

section h2 {
    margin-bottom: 1.5rem;
    color: var(--primary-color);
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input[type="text"],
.form-group input[type="date"],
.form-group input[type="file"],
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
}

.form-group input[type="checkbox"] {
    width: auto;
    margin-right: 0.5rem;
}

.help-text {
    display: block;
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Upload Section */
.upload-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.upload-section h2 {
    color: white;
}

.upload-section label {
    color: white;
}

.upload-section .help-text {
    color: rgba(255,255,255,0.8);
}

/* Progress */
.progress-container {
    margin-top: 1rem;
}

.progress-bar {
    width: 100%;
    height: 4px;
    background-color: rgba(255,255,255,0.3);
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background-color: white;
    animation: progress 2s ease-in-out infinite;
}

@keyframes progress {
    0% { width: 0%; }
    50% { width: 100%; }
    100% { width: 0%; }
}

.progress-text {
    margin-top: 0.5rem;
    text-align: center;
}

/* Extraction Result */
.extraction-result {
    margin-top: 1.5rem;
    padding: 1rem;
    background: rgba(255,255,255,0.2);
    border-radius: 4px;
}

.extraction-result.success {
    background: var(--success-color);
}

.extraction-result.error {
    background: var(--danger-color);
}

/* Filter Section */
.filter-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    align-items: end;
}

/* Table */
.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.table-actions {
    display: flex;
    gap: 0.5rem;
}

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background-color: var(--light-gray);
}

th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
}

th:hover {
    background-color: var(--border-color);
}

th[data-sort]::after {
    content: ' ↕';
    opacity: 0.3;
}

th[data-sort].asc::after {
    content: ' ↑';
    opacity: 1;
}

th[data-sort].desc::after {
    content: ' ↓';
    opacity: 1;
}

td {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
}

tr:hover {
    background-color: var(--light-gray);
}

.loading {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
}

.badge-sale {
    background-color: var(--danger-color);
    color: white;
}

.badge-regular {
    background-color: var(--secondary-color);
    color: white;
}

.action-btn {
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
    margin-right: 0.25rem;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

#pageInfo {
    font-weight: 500;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 8px;
    width: 90%;
    max-width: 800px;
    max-height: 90vh;
    overflow: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    margin: 0;
}

.close-btn {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
}

.close-btn:hover {
    color: var(--text-color);
}

.modal-body {
    padding: 2rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 10px;
    }

    section {
        padding: 1.5rem;
    }

    .filter-controls {
        grid-template-columns: 1fr;
    }

    .table-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .table-actions {
        justify-content: stretch;
    }

    .table-actions .btn {
        flex: 1;
    }

    table {
        font-size: 0.875rem;
    }

    th, td {
        padding: 0.5rem;
    }

    .modal-content {
        width: 95%;
    }
}

/* Price formatting */
.price {
    font-weight: 600;
}

.price-sale {
    color: var(--danger-color);
}

.price-regular {
    color: var(--text-color);
}

.price-crossed {
    text-decoration: line-through;
    color: var(--text-muted);
    font-weight: normal;
}
