/* ============================================================
   INVOICE MANAGEMENT PAGE - STYLES
   ============================================================
   For: /admin/invoices & /admin/credit-notes
   ============================================================ */

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    margin: 0;
    display: flex;
    background-color: var(--bg-color);
    color: var(--text-color);
}

.page-container {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 2rem;
    max-width: none;
    margin: 0;
    padding: 0;
}

@media (max-width: 1200px) {
    .page-container {
        grid-template-columns: 1fr;
    }
}

/* .main-content styles now inherited from design-system.ejs for dynamic sidebar width */

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0;
    grid-column: 1 / -1;
}

.page-header h1 {
    margin: 0;
    font-size: 2rem;
    font-weight: 700;
}

/* Filter Panel - Glassmorphism Style */
.filter-panel {
    background: linear-gradient(135deg, rgba(28, 28, 31, 0.6), rgba(36, 36, 40, 0.4));
    border-radius: 12px;
    padding: 1.5rem;
    height: fit-content;
    position: sticky;
    top: 7.5rem;
    box-shadow:
        0px 4px 16px rgba(0, 0, 0, 0.4),
        0px 2px 8px rgba(0, 0, 0, 0.3),
        0px 0px 1px rgba(255, 255, 255, 0.06),
        inset 0px 1px 0px rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.filter-panel h3 {
    margin: 0 0 1rem 0;
    font-size: 1.125rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.total-count {
    font-size: 1rem;
    color: #6b4423;
    font-weight: 600;
    margin-bottom: 1.5rem;
    padding: 0.75rem 1rem;
    background: rgba(18, 18, 20, 0.9);
    border: 0.9px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    text-align: center;
}

.filter-group {
    margin-bottom: 1rem;
}

.filter-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
    opacity: 0.8;
}

.filter-group input,
.filter-group select {
    width: 100%;
    padding: 0.75rem;
    background: var(--surface-control);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9375rem;
    transition: all 0.2s;
    box-sizing: border-box;
}

.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(107, 68, 35, 0.1);
}

/* Custom dropdown arrow for select elements */
.filter-group select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23ffffff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 12px;
    padding-right: 2.5rem;
}

.clear-filters-btn {
    width: 100%;
    padding: 0.75rem;
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 1rem;
}

.clear-filters-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: #ef4444;
    color: #ef4444;
}

.result-count {
    text-align: center;
    padding: 0.5rem;
    font-size: 0.9rem;
    opacity: 0.7;
    margin-top: 1rem;
}

/* Table styling */
table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    padding: 1rem;
    text-align: center !important;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    opacity: 0.7;
}

tbody td {
    padding: 1rem;
    text-align: center !important;
}

tr:last-child td {
    border-bottom: none;
}

tbody tr:hover {
    background: var(--surface-2-hover);
}

.action-btn {
    padding: 0.5rem 0.9rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    font-size: 1.1rem;
    margin-right: 0.3rem;
    transition: all 0.2s;
    background: rgba(255, 255, 255, 0.06);
    min-width: 38px;
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    transform: translateY(-1px);
}

.view-btn {
    background: #007bff;
    color: white;
}

.view-btn:hover {
    background: #0056b3;
    transform: translateY(-1px);
}

.finalize-btn {
    background: #28a745;
    color: white;
}

.finalize-btn:hover {
    background: #218838;
    transform: translateY(-1px);
}

.cancel-btn {
    background: #dc3545;
    color: white;
}

.cancel-btn:hover {
    background: #c82333;
    transform: translateY(-1px);
}

/* Status Badge */
.status-badge {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-draft {
    background: rgba(255, 193, 7, 0.1);
    color: #ffc107;
    border: 1px solid rgba(255, 193, 7, 0.3);
}

.status-finalized {
    background: rgba(23, 162, 184, 0.1);
    color: #17a2b8;
    border: 1px solid rgba(23, 162, 184, 0.3);
}

.status-sent {
    background: rgba(0, 123, 255, 0.1);
    color: #007bff;
    border: 1px solid rgba(0, 123, 255, 0.3);
}

.status-paid {
    background: rgba(40, 167, 69, 0.1);
    color: #28a745;
    border: 1px solid rgba(40, 167, 69, 0.3);
}

.status-cancelled {
    background: rgba(220, 53, 69, 0.1);
    color: #dc3545;
    border: 1px solid rgba(220, 53, 69, 0.3);
}

.status-overdue {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.4);
    animation: pulse-overdue 2s infinite;
}

@keyframes pulse-overdue {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.status-issued {
    background: rgba(23, 162, 184, 0.1);
    color: #17a2b8;
    border: 1px solid rgba(23, 162, 184, 0.3);
}

.status-paid_reference {
    background: rgba(40, 167, 69, 0.08);
    color: #22c55e;
    border: 1px solid rgba(40, 167, 69, 0.2);
}

