/*
 * Sistema de Pagos para Inquilinos
 * Estilos personalizados (complementan Tailwind CSS)
 */

/* ----------------------------------------
   Variables
---------------------------------------- */
:root {
    --spi-primary:      #3b82f6;
    --spi-primary-dark: #2563eb;
    --spi-success:      #10b981;
    --spi-danger:       #ef4444;
    --spi-warning:      #f59e0b;
    --spi-text:         #1f2937;
    --spi-text-muted:   #6b7280;
    --spi-bg:           #f9fafb;
    --spi-card-bg:      #ffffff;
    --spi-border:       #e5e7eb;
    --spi-radius:       0.75rem;
    --spi-shadow:       0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
}

html.dark {
    --spi-primary:      #60a5fa;
    --spi-primary-dark: #3b82f6;
    --spi-success:      #34d399;
    --spi-danger:       #f87171;
    --spi-warning:      #fbbf24;
    --spi-text:         #f9fafb;
    --spi-text-muted:   #9ca3af;
    --spi-bg:           #111827;
    --spi-card-bg:      #1f2937;
    --spi-border:       #374151;
    --spi-shadow:       0 1px 3px rgba(0,0,0,.3), 0 1px 2px rgba(0,0,0,.2);
}

/* ----------------------------------------
   Base
---------------------------------------- */
.spi-wrap {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, sans-serif;
    background-color: var(--spi-bg);
    color: var(--spi-text);
    min-height: 100vh;
    padding: 1.5rem;
}

/* ----------------------------------------
   Tarjetas
---------------------------------------- */
.spi-card {
    background: var(--spi-card-bg);
    border: 1px solid var(--spi-border);
    border-radius: var(--spi-radius);
    box-shadow: var(--spi-shadow);
    padding: 1.5rem;
}

/* ----------------------------------------
   Botones
---------------------------------------- */
.spi-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.15s, transform 0.1s, box-shadow 0.15s;
    text-decoration: none;
    border: none;
}

.spi-btn:active {
    transform: scale(0.97);
}

.spi-btn-primary {
    background-color: var(--spi-primary);
    color: #fff;
}
.spi-btn-primary:hover {
    background-color: var(--spi-primary-dark);
    color: #fff;
    text-decoration: none;
}

.spi-btn-danger {
    background-color: var(--spi-danger);
    color: #fff;
}

/* ----------------------------------------
   Badges de estado
---------------------------------------- */
.spi-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: capitalize;
}
.spi-badge-green  { background: #d1fae5; color: #065f46; }
.spi-badge-red    { background: #fee2e2; color: #991b1b; }
.spi-badge-yellow { background: #fef3c7; color: #92400e; }
.spi-badge-gray   { background: #f3f4f6; color: #374151; }

html.dark .spi-badge-green  { background: rgba(16,185,129,.15); color: #34d399; }
html.dark .spi-badge-red    { background: rgba(239,68,68,.15);  color: #f87171; }
html.dark .spi-badge-yellow { background: rgba(245,158,11,.15); color: #fbbf24; }
html.dark .spi-badge-gray   { background: rgba(156,163,175,.15); color: #d1d5db; }

/* ----------------------------------------
   Animaciones
---------------------------------------- */
@keyframes spi-fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.spi-fade-in {
    animation: spi-fade-in 0.3s ease forwards;
}

/* ----------------------------------------
   Dark mode toggle
---------------------------------------- */
#spi-dark-toggle {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 9999px;
    background: var(--spi-card-bg);
    border: 1px solid var(--spi-border);
    box-shadow: 0 2px 8px rgba(0,0,0,.12);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    transition: background 0.2s;
    z-index: 9999;
}

/* ============================================================
   Componentes reutilizables para templates de inquilino
   ============================================================ */

/* card */
.card {
    background: var(--spi-card-bg);
    border: 1px solid var(--spi-border);
    border-radius: 1rem;
    box-shadow: var(--spi-shadow);
    padding: 2rem;
}

/* input-field */
.input-field {
    display: block;
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1.5px solid var(--spi-border);
    border-radius: 0.5rem;
    font-size: 0.9375rem;
    color: var(--spi-text);
    background: var(--spi-card-bg);
    transition: border-color 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
    font-family: inherit;
}
.input-field:focus {
    outline: none;
    border-color: var(--spi-primary);
    box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}

/* button-primary */
.button-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff !important;
    border-radius: 0.625rem;
    font-size: 0.9375rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
    box-shadow: 0 2px 8px rgba(59,130,246,.35);
    line-height: 1;
    white-space: nowrap;
}
.button-primary:hover {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    box-shadow: 0 4px 14px rgba(59,130,246,.45);
    color: #fff !important;
    text-decoration: none;
}
.button-primary:active { transform: scale(0.97); }
.button-primary.w-full { width: 100%; }

/* button-secondary */
.button-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.125rem;
    background: transparent;
    color: var(--spi-text) !important;
    border-radius: 0.625rem;
    font-size: 0.875rem;
    font-weight: 600;
    border: 1.5px solid var(--spi-border);
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s;
    line-height: 1;
    white-space: nowrap;
}
.button-secondary:hover {
    background: var(--spi-border);
    text-decoration: none;
    color: var(--spi-text) !important;
}

/* ============================================================
   Animaciones
   ============================================================ */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn 0.35s ease forwards; }

/* ============================================================
   Nav del dashboard de inquilino
   ============================================================ */
.spi-nav {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}
.spi-nav a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--spi-text-muted);
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}
.spi-nav a:hover { background: var(--spi-border); color: var(--spi-text); text-decoration: none; }
.spi-nav a.active { background: rgba(59,130,246,.1); color: var(--spi-primary); }
