/* ================================================
   THEME.CSS - GAMMA FINANZAS
   Sistema de diseno unificado
   ================================================ */

/* ============================================
   1. RESET
   ============================================ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ============================================
   2. DESIGN TOKENS
   ============================================ */
:root {
    /* Brand */
    --primary: #c9a227;
    --primary-hover: #a8871e;
    --primary-subtle: rgba(201, 162, 39, 0.12);
    --primary-border: rgba(201, 162, 39, 0.25);

    /* Surfaces */
    --bg-body: #111113;
    --bg-card: #1c1c1f;
    --bg-card-hover: #222226;
    --bg-elevated: #26262a;
    --bg-input: #16161a;

    /* Text */
    --text-primary: #e8e8ed;
    --text-secondary: #9898a0;
    --text-muted: #5c5c66;

    /* Borders */
    --border: #2e2e33;
    --border-subtle: #252529;
    --border-focus: var(--primary);

    /* Semantic */
    --success: #34d399;
    --success-hover: #10b981;
    --success-subtle: rgba(52, 211, 153, 0.1);
    --success-text: #6ee7b7;

    --warning: #fbbf24;
    --warning-hover: #f59e0b;
    --warning-subtle: rgba(251, 191, 36, 0.1);
    --warning-text: #fcd34d;

    --danger: #f87171;
    --danger-hover: #ef4444;
    --danger-subtle: rgba(248, 113, 113, 0.1);
    --danger-text: #fca5a5;

    --info: #818cf8;
    --info-subtle: rgba(129, 140, 248, 0.1);

    /* Secondary */
    --secondary: #3f3f46;
    --secondary-hover: #52525b;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.4);
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(201, 162, 39, 0.15);

    /* Radius */
    --radius-sm: 0.375rem;
    --radius: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-full: 9999px;

    /* Transitions */
    --transition: 0.2s ease;

    /* Legacy compatibility */
    --primary-color: var(--primary);
    --success-color: var(--success);
    --warning-color: var(--warning);
    --danger-color: var(--danger);
    --background-color: var(--bg-body);
    --card-background: var(--bg-card);
    --border-color: var(--border);
    --secondary-color: var(--secondary);
}

/* ============================================
   3. BASE
   ============================================ */
html, body {
    overflow-x: hidden;
    overflow-y: auto;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-body);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================
   4. HEADER Y NAVEGACION
   ============================================ */
header {
    background: linear-gradient(135deg, #1c1c1f 0%, #26262a 100%);
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    padding: 0.75rem 0;
    position: relative;
}

header h1 {
    text-align: center;
    margin-bottom: 0.5rem;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: -0.02em;
}

nav {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.25rem;
}

nav a {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.45rem 0.9rem;
    border-radius: var(--radius);
    transition: all var(--transition);
    font-size: 0.875rem;
    font-weight: 500;
}

nav a:hover {
    color: var(--text-primary);
    background: var(--primary-subtle);
}

nav a.active {
    color: var(--primary);
    background: var(--primary-subtle);
    border: 1px solid var(--primary-border);
}

/* ============================================
   5. BOTONES
   ============================================ */
.btn-primary {
    padding: 0.45rem 0.85rem;
    background: var(--primary);
    color: #111;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-secondary {
    padding: 0.45rem 0.85rem;
    background: var(--secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-secondary:hover {
    background: var(--secondary-hover);
    border-color: var(--text-muted);
}

.btn-success {
    padding: 0.45rem 0.85rem;
    background: var(--success-hover);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-success:hover {
    background: #059669;
    transform: translateY(-1px);
}

.btn-danger {
    padding: 0.45rem 0.85rem;
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger-subtle);
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
}

.btn-danger:hover {
    background: var(--danger-subtle);
    border-color: var(--danger);
}

.btn-small {
    padding: 0.3rem 0.55rem;
    font-size: 0.75rem;
    min-height: 28px;
}

/* ============================================
   6. STATUS BADGES (dark theme)
   ============================================ */
.status-badge {
    padding: 0.2rem 0.65rem;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.status-badge.active {
    background: var(--success-subtle);
    color: var(--success-text);
    border: 1px solid rgba(52, 211, 153, 0.2);
}

.status-badge.pending {
    background: var(--warning-subtle);
    color: var(--warning-text);
    border: 1px solid rgba(251, 191, 36, 0.2);
}

.status-badge.paused {
    background: var(--danger-subtle);
    color: var(--danger-text);
    border: 1px solid rgba(248, 113, 113, 0.2);
}

.status-badge.parcial {
    background: var(--info-subtle);
    color: var(--info);
    border: 1px solid rgba(129, 140, 248, 0.2);
}

/* ============================================
   7. MODALES
   ============================================ */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease-out;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideIn 0.25s ease-out;
    border: 1px solid var(--border);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    color: var(--text-primary);
    font-size: 1.15rem;
    font-weight: 600;
}

.modal-body {
    padding: 1.5rem;
}

.close {
    font-size: 1.4rem;
    font-weight: bold;
    color: var(--text-muted);
    cursor: pointer;
    transition: color var(--transition);
    background: none;
    border: none;
    line-height: 1;
}

.close:hover {
    color: var(--text-primary);
}

/* ============================================
   8. FORMULARIOS
   ============================================ */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
    font-size: 0.85rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    background: var(--bg-input);
    color: var(--text-primary);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-subtle);
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

/* ============================================
   9. CARDS BASE
   ============================================ */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    transition: all var(--transition);
}

.card:hover {
    background: var(--bg-card-hover);
    box-shadow: var(--shadow);
    border-color: var(--border-subtle);
}

/* ============================================
   10. SECTION HEADER
   ============================================ */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    margin-bottom: 1rem;
}

.section-header h2 {
    color: var(--text-primary);
    font-size: 1.15rem;
    font-weight: 600;
}

/* ============================================
   11. COLUMN LAYOUT (fondos, gastos)
   ============================================ */
.fondo-column,
.column-wrapper {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
}

.column-header {
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    padding: 0.85rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.column-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.column-total {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
    background: var(--primary-subtle);
    padding: 0.35rem 0.85rem;
    border-radius: var(--radius-full);
    border: 1px solid var(--primary-border);
}

.empty-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    margin: 1rem;
}

.empty-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    opacity: 0.4;
}

.empty-text {
    font-size: 0.85rem;
    font-weight: 500;
}

/* ============================================
   12. DETAIL VIEW
   ============================================ */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

.detail-column {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.detail-item {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.detail-item label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.detail-item span {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* ============================================
   13. PERSONAS LIST
   ============================================ */
.persona-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    margin-bottom: 0.4rem;
}

.persona-item .persona-name {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9rem;
}

/* ============================================
   14. NOTIFICATIONS
   ============================================ */
.notification {
    position: fixed;
    top: 1rem;
    right: 1rem;
    padding: 0.85rem 1.25rem;
    border-radius: var(--radius);
    color: white;
    font-weight: 500;
    font-size: 0.9rem;
    z-index: 2000;
    animation: slideIn 0.3s ease-out;
    box-shadow: var(--shadow-lg);
}

.notification.success { background: var(--success-hover); }
.notification.error { background: var(--danger-hover); }
.notification.info { background: var(--secondary); border: 1px solid var(--border); }

/* ============================================
   15. COBROS INFO
   ============================================ */
.card-cobros-info {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

.cobros-monto {
    color: var(--success-text);
}

.cobros-restante {
    color: var(--warning-text);
}

/* ============================================
   16. ANIMACIONES
   ============================================ */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ============================================
   17. RESPONSIVE - Mobile (max 768px)
   ============================================ */
@media (max-width: 768px) {
    header {
        padding: 0.5rem 0;
    }

    header h1 {
        font-size: 1.15rem;
        margin-bottom: 0.5rem;
    }

    nav {
        flex-wrap: wrap;
        gap: 0.25rem;
        padding: 0 0.5rem;
    }

    nav a {
        padding: 0.35rem 0.65rem;
        font-size: 0.8rem;
    }

    .section-header {
        flex-direction: column;
        gap: 0.75rem;
        text-align: center;
        padding: 0.75rem;
    }

    .modal-content {
        width: 95%;
        margin: 1rem;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    header h1 {
        font-size: 1rem;
    }

    nav a {
        padding: 0.3rem 0.5rem;
        font-size: 0.75rem;
    }

    .modal-content {
        width: 98%;
        margin: 0.5rem;
    }

    .modal-header {
        padding: 1rem;
    }

    .modal-body {
        padding: 1rem;
    }
}
