/* Recolecciones and Reportes Page Styles */

/* Main content adjustments */
.main-content {
    margin-left: 0;
    background: #f8f9fa;
    min-height: calc(100vh - 80px);
}

/* Subtitle */
.subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 4px;
    font-weight: normal;
}

/* Filters Section */
.filters-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 24px;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.filter-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.filter-label svg {
    width: 20px;
    height: 20px;
    color: var(--primary-color);
}

.filter-select {
    flex: 1;
    max-width: 400px;
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.95rem;
    color: var(--text-primary);
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.filter-select:hover {
    border-color: var(--primary-color);
}

.filter-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.1);
}

/* Pickups Section */
.pickups-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
}

.pickup-card {
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    transition: all 0.2s ease;
}

.pickup-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-color: var(--primary-color);
}

.pickup-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.pickup-id-badge {
    color: var(--text-primary);
    font-size: 1.125rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.pickup-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-download {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: white;
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-download:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.btn-download svg {
    width: 16px;
    height: 16px;
}

.btn-download.csv {
    border-color: #27ae60;
    color: #27ae60;
}

.btn-download.csv:hover {
    background: #27ae60;
    color: white;
}

.btn-download.pdf {
    border-color: #e74c3c;
    color: #e74c3c;
}

.btn-download.pdf:hover {
    background: #e74c3c;
    color: white;
}

.pickup-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.info-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.info-value {
    font-size: 0.95rem;
    color: var(--text-primary);
    font-weight: 500;
}

/* Phases List Simple */
.phases-list-simple {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.phases-list-header {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.phase-simple-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    font-size: 0.875rem;
    color: var(--text-primary);
    border-bottom: 1px solid #f0f0f0;
}

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

.phase-index {
    color: var(--text-secondary);
    font-weight: 600;
    min-width: 24px;
    flex-shrink: 0;
}

.phase-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.phase-line {
    line-height: 1.5;
}

.product-name-small {
    font-size: 0.65rem;
    color: var(--text-secondary);
    font-style: italic;
    opacity: 0.8;
}

.phases-empty {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-style: italic;
}

/* Pagination */
.pagination-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    flex-wrap: wrap;
    gap: 16px;
}

.pagination-info {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

.pagination-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: white;
    color: var(--text-primary);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

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

.pagination-btn svg {
    width: 16px;
    height: 16px;
}

.pagination-current {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: 20px;
    color: var(--text-secondary);
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Loading Container */
.loading-container {
    text-align: center;
    padding: 60px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.loading-container .loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-container p {
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 500;
    margin: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .filters-section {
        padding: 16px;
    }
    
    .filter-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-select {
        max-width: 100%;
    }
    
    .pickup-header {
        flex-direction: column;
        align-items: stretch;
    }

    .pickup-actions {
        width: 100%;
        justify-content: stretch;
    }

    .btn-download {
        flex: 1;
        justify-content: center;
    }

    .pickup-info {
        grid-template-columns: 1fr;
    }

    .pagination-section {
        flex-direction: column;
        text-align: center;
    }

    .pagination-controls {
        flex-direction: column;
        width: 100%;
    }

    .pagination-btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .pickups-section {
        padding: 16px;
    }
    
    .pickup-card {
        padding: 16px;
    }
}

/* PDF Download Loader */
.pdf-loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

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

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

.pdf-loader-content {
    background: white;
    border-radius: 12px;
    padding: 40px 60px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

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

.pdf-loader-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

.pdf-loader-text {
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.pdf-loader-subtext {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ============================================
   REPORTES SPECIFIC STYLES
   ============================================ */

/* Filter Row */
.filter-row {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.filter-row .filter-group {
    flex: 1;
    min-width: 200px;
}

.filter-row .filter-group[style*="flex: 1"] {
    flex: 1 1 100%;
    max-width: 100%;
}

/* States Checkbox Group */
.states-checkbox-group-simple {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 16px;
    background: #fafbfc;
    border-radius: 8px;
    border: 1px solid #e1e4e8;
}

.checkbox-label-simple {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: #24292e;
    cursor: pointer;
    user-select: none;
    padding: 10px 14px;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    transition: all 0.15s ease;
    font-weight: 400;
}

.checkbox-label-simple:hover {
    border-color: #6366f1;
    box-shadow: 0 0 0 1px #6366f1;
}

.checkbox-label-simple input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    margin: 0;
    flex-shrink: 0;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    border: 2px solid #cbd5e0;
    border-radius: 4px;
    background: white;
    position: relative;
    transition: all 0.15s ease;
}

.checkbox-label-simple input[type="checkbox"]:checked {
    background: #6366f1;
    border-color: #6366f1;
}

.checkbox-label-simple input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 2px;
    width: 4px;
    height: 8px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.checkbox-label-simple input[type="checkbox"]:hover {
    border-color: #6366f1;
}

.checkbox-label-simple span {
    line-height: 1.2;
    color: #1f2937;
}

/* States Toggle Buttons */
.states-toggle-buttons {
    display: flex;
    gap: 8px;
}

.btn-toggle {
    padding: 4px 12px;
    font-size: 0.8rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: white;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

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

/* Filter Actions */
.filter-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    align-items: center;
    width: 100%;
    margin-top: 16px;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    background: #1565c0;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(25, 118, 210, 0.3);
}

.btn-primary svg {
    width: 18px;
    height: 18px;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: white;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-secondary:hover {
    background: #f5f5f5;
    border-color: var(--text-secondary);
}

.btn-secondary svg {
    width: 18px;
    height: 18px;
}

/* Period Indicator */
.period-indicator {
    display: flex;
    gap: 16px;
    padding: 16px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    margin-bottom: 24px;
    align-items: center;
    flex-wrap: wrap;
}

.period-badge,
.states-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
    font-size: 0.95rem;
}

.period-badge svg,
.states-badge svg {
    flex-shrink: 0;
}

.period-badge strong {
    font-weight: 600;
}

/* Stats Summary */
.stats-summary {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
}

.stats-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card-report {
    display: flex;
    align-items: center;
    gap: 16px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 20px;
    transition: all 0.2s ease;
}

.stat-card-report:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.stat-icon-report {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-icon-report svg {
    width: 24px;
    height: 24px;
}

.stat-content-report {
    flex: 1;
}

.stat-label-report {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.stat-value-report {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* States Breakdown */
.states-breakdown {
    padding-top: 24px;
    border-top: 1px solid var(--border);
    margin-top: 8px;
}

.breakdown-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 20px;
    text-transform: none;
    letter-spacing: 0.3px;
}

.breakdown-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.breakdown-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0;
    background: transparent;
    transition: all 0.2s ease;
}

.breakdown-state {
    min-width: 140px;
    font-size: 0.8rem;
    color: #4a5568;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.breakdown-bar-container {
    flex: 1;
    height: 32px;
    background: linear-gradient(to right, #e2e8f0 0%, #cbd5e0 100%);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.breakdown-bar {
    height: 100%;
    background: linear-gradient(90deg, #4a5d7c 0%, #5a8cb8 100%);
    border-radius: 6px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 12px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.breakdown-bar-label {
    font-size: 0.75rem;
    color: white;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    white-space: nowrap;
}

.breakdown-count {
    min-width: 100px;
    text-align: right;
    font-size: 0.875rem;
    font-weight: 700;
    color: #2d3748;
}

/* Products Summary Section */
.products-summary-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
}

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

.report-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

.report-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.report-table thead th {
    padding: 16px;
    text-align: left;
    font-size: 0.875rem;
    font-weight: 600;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.report-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: background 0.2s ease;
}

.report-table tbody tr:hover {
    background: #f9fafb;
}

.report-table tbody tr:last-child {
    border-bottom: none;
}

.report-table tbody td {
    padding: 16px;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.report-table tfoot {
    background: #f9fafb;
    font-weight: 600;
}

.report-table tfoot td {
    padding: 16px;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.products-summary-table tbody td:first-child {
    font-weight: 500;
}

.products-summary-table tbody td:nth-child(2) {
    text-align: center;
    font-weight: 600;
    color: var(--primary-color);
}

/* Results Header */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 16px;
}

.results-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.results-header h3 span {
    color: var(--primary-color);
}

.download-buttons {
    display: flex;
    gap: 12px;
}

.btn-download:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Responsive Adjustments for Reportes */
@media (max-width: 1024px) {
    .filter-row {
        flex-direction: column;
    }
    
    .filter-row .filter-group {
        width: 100%;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .period-indicator {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .states-checkbox-group-simple {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 12px;
    }
    
    .checkbox-label-simple {
        font-size: 0.875rem;
        padding: 10px 12px;
    }
    
    .filter-actions {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-primary,
    .btn-secondary {
        width: 100%;
        justify-content: center;
    }
    
    .results-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .download-buttons {
        width: 100%;
    }
    
    .btn-download {
        flex: 1;
    }
}

@media (max-width: 480px) {
    .states-checkbox-group-simple {
        grid-template-columns: 1fr;
    }
    
    .breakdown-item {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .breakdown-state {
        min-width: auto;
        text-align: left;
    }
    
    .breakdown-bar-container {
        width: 100%;
    }
    
    .breakdown-count {
        text-align: left;
        min-width: auto;
    }
}

