/* css/components.css */

/* Cards */
.card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--color-border);
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
}

.disabled-card {
    opacity: 0.6;
    pointer-events: none;
    background-color: var(--color-secondary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    font-size: 0.95rem;
}

.btn-sm {
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.85rem;
}

.btn-primary {
    background-color: var(--color-primary);
    color: white;
}
.btn-primary:hover {
    background-color: var(--color-primary-hover);
    box-shadow: var(--shadow-md);
}

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

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

/* Forms */
.form-group {
    margin-bottom: var(--space-md);
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text);
    margin-bottom: var(--space-xs);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
select {
    width: 100%;
    padding: 0.6rem var(--space-sm);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-family: var(--font-family);
    font-size: 0.95rem;
    color: var(--color-text);
    transition: border-color 0.2s;
    background-color: #fff;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Tables */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th, td {
    padding: var(--space-md);
    border-bottom: 1px solid var(--color-border);
}

th {
    background-color: var(--color-background);
    color: var(--color-text-muted);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

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

/* Badges */
.badge {
    padding: 0.2rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-A { background-color: var(--color-secondary); color: var(--color-text); }
.badge-R { background-color: var(--color-warning-light); color: var(--color-warning); border: 1px solid var(--color-warning); }

.badge-Pendiente { background-color: #fef3c7; color: #b45309; }
.badge-Cobrada { background-color: #d1fae5; color: #047857; }
.badge-Vencida { background-color: #fee2e2; color: #b91c1c; }
.badge-Cancelada { background-color: #f3f4f6; color: #6b7280; }
.badge-aceptada-con-errores { background-color: #fef3c7; color: #b45309; border: 1px solid #fcd34d; }
.badge-rechazada { background-color: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.badge-aceptada { background-color: #d1fae5; color: #047857; border: 1px solid #a7f3d0; }

/* Modals */
.modal-backdrop {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
    backdrop-filter: blur(2px);
}

.modal-backdrop.active {
    display: flex;
}

.modal {
    background: var(--color-surface);
    width: 100%;
    max-width: 500px;
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    box-shadow: var(--shadow-md);
    animation: modalScale 0.3s ease-out;
}

.modal h3 { margin-bottom: var(--space-lg); }

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-sm);
    margin-top: var(--space-lg);
}

@keyframes modalScale {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* Specifics */
.wizard-card {
    max-width: 600px;
    margin: 2rem auto;
}

.filters-bar {
    display: flex;
    gap: var(--space-md);
    padding: var(--space-md);
}

.filters-bar input, .filters-bar select {
    max-width: 200px;
}

.client-select-wrapper {
    display: flex;
    gap: var(--space-sm);
}

/* Formulario factura: cabecera en columna (fecha/número y cliente apilados) */
.invoice-form-header-stack {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.invoice-fields-stack {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.lines-table input, .lines-table select {
    padding: 0.4rem;
}

.totals-section {
    border-top: 1px solid var(--color-border);
    padding-top: var(--space-md);
    display: flex;
    gap: var(--space-xl);
    justify-content: flex-end;
}

.tax-inline { max-width: 150px; }

.totals-box {
    background-color: var(--color-background);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    min-width: 250px;
    text-align: right;
}

.totals-box p { color: var(--color-text-muted); margin-bottom: var(--space-xs); font-size: 0.9rem; }
.totals-box h4 { font-size: 1.25rem; margin-top: var(--space-sm); color: var(--color-text); }

/* Notifications & Toasts */
.toast-container {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    min-width: 300px;
    max-width: 450px;
    background: var(--color-surface);
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    animation: toastIn 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    border-left: 4px solid var(--color-primary);
    position: relative;
    overflow: hidden;
}

.toast::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    width: 100%;
    background: rgba(0,0,0,0.1);
}

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    width: 100%;
    background: var(--color-primary);
    animation: toastProgress linear forwards;
}

.toast-success { border-left-color: var(--color-success); }
.toast-success .toast-progress { background: var(--color-success); }
.toast-warning { border-left-color: var(--color-warning); }
.toast-warning .toast-progress { background: var(--color-warning); }
.toast-danger { border-left-color: var(--color-danger); }
.toast-danger .toast-progress { background: var(--color-danger); }

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 2px;
}

.toast-message {
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

.toast-close {
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
}

.toast-close:hover {
    background: var(--color-secondary);
}

@keyframes toastIn {
    from { transform: translateX(120%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes toastOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(120%); opacity: 0; }
}

@keyframes toastProgress {
    from { width: 100%; }
    to { width: 0%; }
}

/* Notification Modal Enhancement */
#notification-modal .modal {
    max-width: 400px;
    text-align: center;
}

#notification-modal .modal-icon {
    font-size: 3rem;
    margin-bottom: var(--space-md);
    display: block;
}

#notification-modal .modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: var(--space-sm);
}

#notification-modal .modal-message {
    color: var(--color-text-muted);
    margin-bottom: var(--space-lg);
}

