/* Variables */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --bg: #f8fafc;
    --surface: #ffffff;
    --text: #1e293b;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
}

/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    padding-bottom: 100px;
    overflow-y: auto;
    min-height: 100vh;
}

/* Header */
.header {
    background: var(--surface);
    box-shadow: var(--shadow);
    padding: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header h1 {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
    text-align: center;
}

.header-tabs {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

.tab-btn {
    padding: 0.5rem 1.25rem;
    border: 2px solid var(--border);
    background: var(--surface);
    color: var(--text-secondary);
    border-radius: 8px;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Tab Content */
.tab-content {
    display: none;
    padding: 1rem;
}

.tab-content.active {
    display: block;
}

/* Filtros */
.filters {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    justify-content: center;
}

.filter-btn {
    padding: 0.4rem 1rem;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-secondary);
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Lista de Recordatorios */
.recordatorios-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.recordatorio-card {
    background: var(--surface);
    border-radius: 12px;
    padding: 1rem;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary);
    transition: transform 0.2s;
}

.recordatorio-card.ajuste {
    border-left-color: #f59e0b;
}

.recordatorio-card.hecho {
    opacity: 0.6;
    border-left-color: var(--success);
}

.recordatorio-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 0.5rem;
}

.recordatorio-fecha {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.recordatorio-tipo {
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    background: var(--primary);
    color: white;
}

.recordatorio-tipo.ajuste {
    background: #f59e0b;
}

.recordatorio-texto {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.recordatorio-monto {
    font-size: 1.25rem;
    color: var(--primary);
    font-weight: 700;
    margin-bottom: 0.5rem;
}

/* Desglose de montos */
.recordatorio-desglose {
    background: var(--bg);
    border-radius: 8px;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border: 1px solid var(--border);
}

.desglose-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0;
    font-size: 0.95rem;
}

.desglose-item:not(:last-child) {
    border-bottom: 1px dashed var(--border);
}

.desglose-item.desglose-total {
    margin-top: 0.5rem;
    padding-top: 0.75rem;
    border-top: 2px solid var(--border);
    border-bottom: none;
}

.desglose-concepto {
    color: var(--text-secondary);
    font-weight: 500;
}

.desglose-item.desglose-total .desglose-concepto {
    color: var(--text);
    font-weight: 700;
}

.desglose-monto {
    color: var(--primary);
    font-weight: 600;
}

.desglose-item.desglose-total .desglose-monto {
    font-size: 1.25rem;
    font-weight: 700;
}

.recordatorio-descripcion {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.recordatorio-periodo {
    font-size: 0.8rem;
    color: #f59e0b;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.recordatorio-actions {
    display: flex;
    gap: 0.5rem;
}

.recordatorio-actions button {
    padding: 0.4rem 0.75rem;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

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

.btn-hecho:hover {
    background: #059669;
}

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

.btn-delete:hover {
    background: #dc2626;
}

/* Clientes */
.clientes-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.clientes-header h2 {
    font-size: 1.25rem;
}

.clientes-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.cliente-card {
    background: var(--surface);
    border-radius: 12px;
    padding: 1rem;
    box-shadow: var(--shadow);
}

.cliente-nombre {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.cliente-info {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.cliente-actions {
    margin-top: 0.75rem;
}

.cliente-actions button {
    padding: 0.4rem 0.75rem;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    background: var(--secondary);
    color: white;
    transition: all 0.2s;
}

.cliente-actions button:hover {
    background: #475569;
}

.cliente-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    gap: 0.75rem;
}

.cliente-estado {
    font-size: 0.75rem;
    padding: 0.25rem 0.6rem;
    border-radius: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.cliente-estado.facturado {
    background: #d1fae5;
    color: #065f46;
}

.cliente-estado.pendiente {
    background: #fef3c7;
    color: #92400e;
}

/* Estilos para historial */
.historial-card {
    opacity: 0.85;
}

.historial-card .recordatorio-fecha {
    color: #10b981;
}

/* Botón flotante */
.btn-float {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    transition: all 0.3s;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-float:hover {
    background: var(--primary-dark);
    transform: scale(1.1);
}

.btn-float:active {
    transform: scale(0.95);
}

/* Botones */
.btn-primary, .btn-secondary {
    padding: 0.6rem 1.25rem;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
}

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

.btn-secondary:hover {
    background: #475569;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--surface);
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 1.25rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.75rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

.modal-close:hover {
    background: var(--border);
}

.modal-body {
    padding: 1.25rem;
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

/* Audio Recording */
.audio-status {
    text-align: center;
    margin-bottom: 1.5rem;
}

.audio-indicator {
    width: 80px;
    height: 80px;
    margin: 0 auto 1rem;
    border-radius: 50%;
    background: var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.audio-indicator.recording {
    background: var(--danger);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.btn-record {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 1.25rem;
    border: 2px solid var(--primary);
    background: var(--surface);
    color: var(--primary);
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

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

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

.btn-record-icon {
    font-size: 2rem;
}

.processing-message {
    text-align: center;
    margin-top: 1rem;
    color: var(--text-secondary);
}

.spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 0.75rem;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Confirmación */
.confirmacion-field {
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: var(--bg);
    border-radius: 8px;
}

.confirmacion-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.confirmacion-value {
    font-size: 1rem;
    color: var(--text);
    font-weight: 500;
}

.confirmacion-value.highlight {
    color: var(--primary);
    font-size: 1.25rem;
    font-weight: 700;
}

/* Form */
.form-group {
    margin-bottom: 1rem;
}

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

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.6rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.form-group small {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    z-index: 3000;
    transition: transform 0.3s;
    max-width: 90%;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
}

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--danger);
}

/* Loading */
.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

/* Responsive */
@media (max-width: 640px) {
    .header h1 {
        font-size: 1.25rem;
    }

    .btn-float {
        width: 56px;
        height: 56px;
        font-size: 1.75rem;
    }

    .modal-content {
        max-width: 100%;
        margin: 0;
        border-radius: 16px 16px 0 0;
        max-height: 95vh;
    }
}
