/* Delivery List Specific Styles */
.lists-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.list-card {
    background: white;
    border: 1.5px solid #f1f5f9;
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

.list-card:hover {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    transform: translateY(-4px);
    border-color: var(--primary-light);
}

.list-card.active-list {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, #ffffff 0%, #f8faff 100%);
}

.list-card.active-list::before {
    content: 'EM ROTA';
    position: absolute;
    top: 12px;
    right: -30px;
    background: var(--primary-color);
    color: white;
    font-size: 0.65rem;
    padding: 4px 30px;
    transform: rotate(45deg);
    font-weight: 800;
    letter-spacing: 1px;
    box-shadow: 0 2px 4px rgba(79, 70, 229, 0.3);
}

.list-header-card {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.list-title {
    font-size: clamp(1.1rem, 2vw, 1.25rem);
    font-weight: 800;
    color: #1e293b;
    margin-bottom: 0.35rem;
    letter-spacing: -0.02em;
}

.list-date {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.list-stats {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
    flex-wrap: wrap;
}

.stat-item {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.stat-value {
    font-weight: 800;
    color: #0f172a;
    font-size: clamp(1.1rem, 1.5vw, 1.3rem);
    white-space: nowrap;
    overflow: visible;
}

.stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.list-actions {
    margin-top: 1.25rem;
    display: flex;
    gap: 0.5rem;
}

.list-status-badge {
    padding: 4px 8px;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-open {
    background: #dcfce7;
    color: #166534;
}

.status-closed {
    background: #f1f5f9;
    color: #64748b;
}

/* Modal specific */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
}

.modal-overlay.open {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: white;
    padding: 2rem 0 0 0;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 500px;
    box-shadow: var(--shadow-lg);
    transform: scale(0.95);
    transition: all 0.2s;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 0 2rem;
}

.modal-overlay.open .modal {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 0 2rem;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
}

/* Orders Table in List View */
.orders-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

.orders-table th,
.orders-table td {
    padding: 0.75rem 0.5rem;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
    font-size: 0.85rem;
}

.orders-table th {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.city-group-header {
    background: #f8fafc;
    font-weight: 800;
    color: #4f46e5;
    padding: 0.75rem 1rem;
    border-bottom: 2px solid #e2e8f0;
    text-align: left !important;
}

.select-list-widget {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.select-list-widget select {
    padding: 0.5rem 2rem 0.5rem 1rem;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    font-weight: 600;
    color: #334155;
    background-color: #f8fafc;
    cursor: pointer;
}

/* --- History & List Section Polish --- */


/* Filter Card Layout */
.history-filter-grid {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 1.5rem;
}

.history-filter-grid .input-group {
    flex: 1;
    min-width: 180px;
}

/* Minimalist Inputs */
.history-filter-grid input[type="date"],
.history-filter-grid input[type="text"] {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    color: #334155;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
    width: 100%;
}

.history-filter-grid input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
    outline: none;
}

.history-filter-grid label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

/* Actions in Filter */
.filter-actions {
    display: flex;
    gap: 0.75rem;
}

/* Table Refinements */
.table-responsive {
    border: 1px solid #f1f5f9;
    border-radius: 12px;
    overflow-x: auto;
    width: 100%;
}

.orders-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.orders-table th {
    background: #f8fafc;
    color: #64748b;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    text-align: left;
    vertical-align: middle;
}

.orders-table td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #f8fafc;
    color: #334155;
    font-size: 0.9rem;
    background: white;
    vertical-align: middle;
}

.orders-table tr:last-child td {
    border-bottom: none;
}

.orders-table tbody tr:hover td {
    background-color: #f8fafc;
}

.col-primary {
    font-weight: 600;
    color: var(--text-primary);
}

.col-secondary {
    font-size: 0.8rem;
    color: #94a3b8;
    margin-top: 2px;
}

/* Status Badges - Minimal */
.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    height: 22px;
}

.status-badge.status-open {
    background: #edf7ed;
    /* Light Green */
    color: #1e4620;
    border: 1px solid #c8e6c9;
}

.status-badge.status-closed {
    background: #f3f4f6;
    /* Light Gray */
    color: #4b5563;
    border: 1px solid #e5e7eb;
}

/* Search Icon Positioning */
.search-wrapper input {
    padding-left: 2.5rem !important;
}

.search-wrapper i {
    color: #94a3b8;
    left: 14px;
    font-size: 1rem;
}

/* Payment Status Button Styles (Refined/Discreet) */
.btn-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s;
    justify-content: center;
    white-space: nowrap;
}

.btn-status.unpaid {
    background: #fef2f2;
    color: #991b1b;
    border-color: #fee2e2;
}

.btn-status.unpaid:hover {
    background: #fee2e2;
    border-color: #fecdd3;
}

.btn-status.paid {
    background: #f0fdf4;
    color: #166534;
    border-color: #dcfce7;
}

.btn-status.paid:hover {
    background: #dcfce7;
    border-color: #bbf7d0;
}

.btn-status i {
    font-size: 0.85rem;
}

/* Status de Entrega (Discreto) */
.btn-delivery {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.65rem;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s;
    justify-content: center;
    white-space: nowrap;
}

.btn-delivery.pending {
    background: #eff6ff;
    color: #1e40af;
    border-color: #dbeafe;
}

.btn-delivery.pending:hover {
    background: #dbeafe;
    border-color: #bfdbfe;
}

.btn-delivery.delivered {
    background: #f0fdf4;
    color: #166534;
    border-color: #dcfce7;
}

.btn-delivery.delivered:hover {
    background: #dcfce7;
    border-color: #bbf7d0;
}

.btn-delivery i {
    font-size: 0.85rem;
}