/* ==========================================================================
   BOX - SYSTEM STYLESHEET (Fundedpipps Theme: Deep Space & Electric Purple)
   Estética Futurista Oscura con Sidebar Desplegable / Contraíble
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
    --primary: #8b5cf6;
    --primary-hover: #7c3aed;
    --primary-light: rgba(139, 92, 246, 0.15);
    --primary-gradient: linear-gradient(135deg, #7c3aed 0%, #a855f7 100%);
    --button-gradient: linear-gradient(135deg, #9333ea 0%, #c084fc 100%);
    --banner-gradient: linear-gradient(135deg, #1e1338 0%, #0d071b 100%);
    
    --accent-blue: #38bdf8;
    --accent-green: #22c55e;
    --accent-warning: #f59e0b;
    --accent-danger: #ef4444;
    
    --bg-app: #080612;
    --bg-card: #120e24;
    --bg-card-hover: #18132e;
    --bg-sidebar: #070510;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-light: #64748b;
    
    --border-color: #241a3e;
    --border-card: rgba(139, 92, 246, 0.2);
    --border-radius-sm: 8px;
    --border-radius-md: 14px;
    --border-radius-lg: 20px;
    --border-radius-full: 9999px;
    
    --shadow-sm: 0 2px 8px rgba(0,0,0,0.4);
    --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.6);
    --shadow-purple: 0 10px 30px rgba(124, 58, 237, 0.35);
    --font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    --transition-fast: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-app);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
}

button, input, select, textarea {
    font-family: inherit;
}

/* APP LAYOUT */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* SIDEBAR (Estilo Contraíble / Desplegable) */
.sidebar {
    width: 260px;
    background: var(--bg-sidebar);
    color: #ffffff;
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1.25rem;
    position: fixed;
    height: 100vh;
    z-index: 100;
    border-right: 1px solid var(--border-color);
    transition: var(--transition-fast);
}

/* ESTADO SIDEBAR CONTRAÍDO (DISMINUIDO - REFORZADO CON !IMPORTANT) */
.sidebar.collapsed {
    width: 85px !important;
    padding: 1.5rem 0.65rem !important;
}

.sidebar.collapsed .brand-header {
    justify-content: center !important;
    gap: 0.5rem !important;
    flex-direction: column !important;
    align-items: center !important;
    padding-bottom: 1rem !important;
}

.sidebar.collapsed .brand-header button.toggle-sidebar-btn {
    margin-left: 0 !important;
    margin-top: 0.4rem !important;
}

.sidebar.collapsed .brand-text span {
    display: none !important;
}

.sidebar.collapsed .brand-text h2 {
    font-size: 1.1rem !important;
    display: block !important;
    text-align: center !important;
}

.sidebar.collapsed .nav-item {
    justify-content: center !important;
    padding: 0.85rem 0.5rem !important;
}

.sidebar.collapsed .nav-item-text {
    display: none !important;
}

.sidebar.collapsed .user-info {
    display: none !important;
}

.sidebar.collapsed .user-profile-pill {
    justify-content: center !important;
    padding: 0.5rem !important;
}

.brand-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-bottom: 1.5rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.brand-icon {
    width: 44px;
    height: 44px;
    background: var(--primary-gradient);
    border-radius: var(--border-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    color: #fff;
    box-shadow: var(--shadow-purple);
    flex-shrink: 0;
}

.brand-text h2 {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #ffffff 0%, #c084fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.brand-text span {
    font-size: 0.75rem;
    color: var(--text-light);
    font-weight: 500;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.85rem 1.1rem;
    color: #94a3b8;
    border-radius: var(--border-radius-md);
    font-weight: 600;
    font-size: 0.92rem;
    transition: var(--transition-fast);
}

.nav-item:hover {
    color: #ffffff;
    background: rgba(139, 92, 246, 0.1);
}

.nav-item.active {
    color: #ffffff;
    background: rgba(139, 92, 246, 0.2);
    border: 1px solid rgba(168, 85, 247, 0.4);
    box-shadow: 0 4px 20px rgba(124, 58, 237, 0.25);
}

.nav-item-master {
    background: var(--primary-gradient);
    color: #ffffff !important;
    box-shadow: var(--shadow-purple);
    margin-top: 0.5rem;
}

.sidebar-footer {
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-color);
}

.user-profile-pill {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    padding: 0.75rem;
    border-radius: var(--border-radius-md);
}

.user-avatar {
    width: 38px;
    height: 38px;
    border-radius: var(--border-radius-full);
    background: var(--primary-gradient);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    flex-shrink: 0;
}

.user-info h4 {
    font-size: 0.85rem;
    color: #fff;
    font-weight: 600;
}

.user-info p {
    font-size: 0.72rem;
    color: var(--text-light);
}

/* MAIN CONTENT AREA CON SOPORTE SIDEBAR CONTRAÍDO */
.main-content {
    margin-left: 260px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--bg-app);
    transition: var(--transition-fast);
}

.main-content.sidebar-collapsed {
    margin-left: 85px !important;
}

/* TOP HEADER */
.top-header {
    background: rgba(18, 14, 36, 0.8);
    backdrop-filter: blur(12px);
    padding: 1.25rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 90;
}

.header-title h1 {
    font-size: 1.5rem;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: -0.4px;
}

.header-title p {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* BUTTONS */
.btn-primary {
    background: var(--button-gradient);
    color: #ffffff;
    border: none;
    padding: 0.75rem 1.4rem;
    border-radius: var(--border-radius-md);
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition-fast);
    box-shadow: var(--shadow-purple);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(168, 85, 247, 0.5);
}

.btn-outline {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 0.65rem 1.2rem;
    border-radius: var(--border-radius-md);
    font-weight: 600;
    font-size: 0.88rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition-fast);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(139, 92, 246, 0.4);
}

.btn-whatsapp {
    background: linear-gradient(135deg, #25d366 0%, #128c7e 100%);
    color: #ffffff;
    border: none;
    padding: 0.6rem 1rem;
    border-radius: var(--border-radius-md);
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: var(--transition-fast);
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
}

.btn-whatsapp:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(37, 211, 102, 0.45);
}

/* CONTENT BODY */
.content-body {
    padding: 2rem;
    flex: 1;
}

/* HERO METALLIC BANNER */
.hero-banner-funded {
    background: var(--banner-gradient);
    border: 1px solid var(--border-card);
    border-radius: var(--border-radius-lg);
    padding: 2.5rem;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.hero-banner-funded::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.25) 0%, rgba(0,0,0,0) 70%);
    pointer-events: none;
}

.hero-banner-funded h2 {
    font-size: 2.2rem;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 0.75rem;
    letter-spacing: -0.5px;
}

.hero-banner-funded p {
    font-size: 1rem;
    color: var(--text-muted);
    max-width: 650px;
    margin-bottom: 1.5rem;
}

/* CARDS GRID */
.cards-grid-funded {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.card-funded {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 1.75rem;
    transition: var(--transition-fast);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.card-funded:hover {
    background: var(--bg-card-hover);
    border-color: var(--primary);
    transform: translateY(-4px);
    box-shadow: var(--shadow-purple);
}

.card-icon-badge {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    margin-bottom: 1.25rem;
}

.icon-purple-funded { background: rgba(139, 92, 246, 0.2); color: #c084fc; border: 1px solid rgba(192, 132, 252, 0.3); }
.icon-gold-funded { background: rgba(245, 158, 11, 0.2); color: #fbbf24; border: 1px solid rgba(251, 191, 36, 0.3); }
.icon-cyan-funded { background: rgba(56, 189, 248, 0.2); color: #38bdf8; border: 1px solid rgba(56, 189, 248, 0.3); }

.card-funded h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 0.5rem;
}

.card-funded p {
    font-size: 0.88rem;
    color: var(--text-muted);
    margin-bottom: 1.25rem;
}

.card-checklist {
    list-style: none;
    margin-bottom: 1.5rem;
}

.card-checklist li {
    font-size: 0.85rem;
    color: #cbd5e1;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-checklist li i {
    color: var(--accent-green);
}

/* METRICS CARDS GRID */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.metric-card {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    transition: var(--transition-fast);
}

.metric-card:hover {
    border-color: var(--primary);
    transform: translateY(-3px);
}

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

.metric-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}

.metric-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--border-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.icon-blue { background: rgba(56, 189, 248, 0.15); color: #38bdf8; }
.icon-green { background: rgba(34, 197, 94, 0.15); color: #22c55e; }
.icon-warning { background: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.icon-purple { background: rgba(139, 92, 246, 0.15); color: #c084fc; }

.metric-value {
    font-size: 1.85rem;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: -0.5px;
    margin-bottom: 0.4rem;
}

.metric-subtext {
    font-size: 0.78rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.subtext-up { color: var(--accent-green); }
.subtext-alert { color: var(--accent-danger); }

/* CHARTS ROW */
.charts-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

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

.card {
    background: var(--bg-card);
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

.card-title h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #ffffff;
}

.card-title p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* TABLES */
.table-container {
    overflow-x: auto;
    border-radius: var(--border-radius-md);
}

.table-custom {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    text-align: left;
}

.table-custom th {
    background: rgba(255, 255, 255, 0.02);
    padding: 0.85rem 1rem;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
}

.table-custom td {
    padding: 1rem;
    font-size: 0.88rem;
    color: var(--text-main);
    border-bottom: 1px solid var(--border-color);
    background: transparent;
}

.table-custom tr:hover td {
    background: rgba(139, 92, 246, 0.05);
}

.table-custom tr:last-child td {
    border-bottom: none;
}

code {
    background: rgba(255, 255, 255, 0.06);
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-family: monospace;
    color: #c084fc;
}

/* BADGES DE ESTADO */
.badge-status {
    padding: 0.35rem 0.75rem;
    border-radius: var(--border-radius-full);
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    text-transform: capitalize;
}

.badge-disponible { background: rgba(34, 197, 94, 0.2); color: #4ade80; border: 1px solid rgba(74, 222, 128, 0.3); }
.badge-ocupada { background: rgba(56, 189, 248, 0.2); color: #38bdf8; border: 1px solid rgba(56, 189, 248, 0.3); }
.badge-activa { background: rgba(34, 197, 94, 0.2); color: #4ade80; border: 1px solid rgba(74, 222, 128, 0.3); }
.badge-por_vencer { background: rgba(245, 158, 11, 0.2); color: #fbbf24; border: 1px solid rgba(251, 191, 36, 0.3); }
.badge-vencida { background: rgba(239, 68, 68, 0.2); color: #fca5a5; border: 1px solid rgba(252, 165, 165, 0.3); }
.badge-superadmin { background: rgba(168, 85, 247, 0.2); color: #c084fc; border: 1px solid rgba(192, 132, 252, 0.3); }

.brand-logo-badge {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 800;
    flex-shrink: 0;
}

/* MODALS */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(5, 3, 12, 0.8);
    backdrop-filter: blur(8px);
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: var(--transition-fast);
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-box {
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--border-radius-lg);
    width: 100%;
    max-width: 540px;
    padding: 2rem;
    box-shadow: var(--shadow-purple);
    transform: translateY(20px);
    transition: var(--transition-fast);
    position: relative;
    color: #ffffff;
}

.modal-overlay.active .modal-box {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.modal-header h3 {
    font-size: 1.25rem;
    font-weight: 800;
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 1.2rem;
    color: var(--text-muted);
    cursor: pointer;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 0.4rem;
    color: #e2e8f0;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius-md);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: #ffffff;
    font-size: 0.9rem;
    outline: none;
    transition: var(--transition-fast);
}

.form-control:focus {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}

/* PUBLIC LANDING PAGE & AUTH STYLES */
.public-body {
    background: radial-gradient(circle at top right, #1a103c, #080612);
    color: #ffffff;
    min-height: 100vh;
}

.public-navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 4rem;
    max-width: 1280px;
    margin: 0 auto;
}

.hero-section {
    max-width: 1280px;
    margin: 3rem auto 5rem;
    padding: 0 4rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}

.hero-title {
    font-size: 3.2rem;
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, #ffffff 0%, #c084fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-sub {
    font-size: 1.15rem;
    color: #94a3b8;
    margin-bottom: 2rem;
}

.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: radial-gradient(circle at top right, #1a103c, #080612);
}

.auth-card {
    background: rgba(18, 14, 36, 0.9);
    border: 1px solid var(--border-card);
    backdrop-filter: blur(16px);
    width: 100%;
    max-width: 440px;
    border-radius: var(--border-radius-lg);
    padding: 2.5rem;
    box-shadow: var(--shadow-purple);
    color: #ffffff;
}
