/* ============================================================
   cuentas.css  --  Accounts receivable styles
   ============================================================ */

.cuentas-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 5rem 2rem 2rem;
}

/* --- Customer list --- */
.cuentas-search {
    display: flex;
    gap: 0.8rem;
    margin-bottom: 1rem;
}

.cuentas-search input {
    flex: 1;
    max-width: 400px;
    padding: 0.5rem 0.8rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.cuentas-search input:focus {
    outline: none;
    border-color: var(--accent);
}

.customer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 0.8rem;
    margin-bottom: 1.5rem;
}

.customer-card-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s;
}

.customer-card-item:hover {
    border-color: var(--accent);
    background: var(--bg-hover);
}

.cci-name {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 0.2rem;
}

.cci-rfc {
    font-family: monospace;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.cci-balance-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
}

.cci-balance {
    font-size: 1.1rem;
    font-weight: 700;
}

.cci-balance.positive { color: var(--danger); }
.cci-balance.zero { color: var(--success); }

.cci-limit {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* --- Customer detail view --- */
.detail-view {
    display: none;
}

.detail-header {
    background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-hover) 100%);
    border: 1px solid var(--accent);
    border-radius: 12px;
    padding: 1.2rem 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.dh-info {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.dh-field .dh-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.dh-field .dh-value {
    font-size: 1rem;
    font-weight: 600;
}

.dh-field .dh-value.accent { color: var(--accent); }
.dh-field .dh-value.danger { color: var(--danger); }
.dh-field .dh-value.success { color: var(--success); }

/* --- Two-column layout for invoices/payments --- */
.detail-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .detail-columns { grid-template-columns: 1fr; }
}

.detail-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}

.detail-card h3 {
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.detail-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.detail-table th {
    text-align: left;
    padding: 0.5rem 0.6rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.75rem;
    text-transform: uppercase;
}

.detail-table td {
    padding: 0.4rem 0.6rem;
    border-bottom: 1px solid rgba(42, 42, 58, 0.5);
}

.status-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.status-badge.pending { background: rgba(245, 158, 11, 0.15); color: var(--warning); }
.status-badge.partial { background: rgba(59, 130, 246, 0.15); color: var(--info); }
.status-badge.paid { background: rgba(34, 197, 94, 0.15); color: var(--success); }
.status-badge.cancelled { background: rgba(255, 68, 68, 0.15); color: var(--danger); }

/* --- Payment form --- */
.payment-form {
    padding: 1rem;
    border-top: 1px solid var(--border);
}

.payment-form h4 {
    font-size: 0.85rem;
    color: var(--accent);
    margin-bottom: 0.8rem;
}

.pf-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.pf-field {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.pf-field label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
}

.pf-field input,
.pf-field select {
    padding: 0.4rem 0.6rem;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.85rem;
}

.pf-field input:focus,
.pf-field select:focus {
    outline: none;
    border-color: var(--accent);
}

/* --- Toast --- */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 0.8rem 1.5rem;
    border-radius: 10px;
    color: #fff;
    font-weight: 600;
    font-size: 0.9rem;
    z-index: 9999;
    animation: toastIn 0.3s ease;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
@keyframes toastIn {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

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

.cuentas-pagination button {
    padding: 0.4rem 0.8rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.85rem;
}

.cuentas-pagination button:hover { border-color: var(--accent); }
.cuentas-pagination button:disabled { opacity: 0.4; cursor: not-allowed; }
.cuentas-pagination .page-info { font-size: 0.8rem; color: var(--text-secondary); }

.empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}
