/* ============================================================
   EDESSIS SRL - Plataforma Gestion Fundacion
   Estilos principales - Diseno tipo Dynamics 365
   ============================================================ */

:root {
    --sidebar-w: 260px;
    --header-h: 52px;
    --bg-body: #f4f6f9;
    --bg-card: #ffffff;
    --bg-sidebar: #1e293b;
    --bg-sidebar-hover: #334155;
    --bg-sidebar-active: #0f766e;
    --accent: #0f766e;
    --accent-light: #ccfbf1;
    --accent-text: #0d9488;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --text-sidebar: #cbd5e1;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --success: #059669;
    --success-bg: #ecfdf5;
    --warning: #d97706;
    --warning-bg: #fffbeb;
    --danger: #dc2626;
    --danger-bg: #fef2f2;
    --info: #2563eb;
    --info-bg: #eff6ff;
    --purple: #7c3aed;
    --purple-bg: #f5f3ff;
    --orange: #ea580c;
    --orange-bg: #fff7ed;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --radius: 8px;
    --radius-lg: 12px;
    --transition: all 0.2s ease;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg-body);
    color: var(--text-primary);
    font-size: 13px;
    line-height: 1.5;
    overflow-x: hidden;
}
a { text-decoration: none; color: var(--accent-text); }
a:hover { text-decoration: underline; }

/* ===== SIDEBAR ===== */
.sidebar {
    position: fixed; top: 0; left: 0;
    width: var(--sidebar-w); height: 100vh;
    background: var(--bg-sidebar);
    z-index: 100; display: flex; flex-direction: column;
    transition: var(--transition);
}
.sidebar.collapsed { left: calc(var(--sidebar-w) * -1); }
.sidebar-brand {
    height: var(--header-h); display: flex; align-items: center;
    padding: 0 20px; border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}
.brand-icon {
    width: 32px; height: 32px; background: var(--accent);
    border-radius: 8px; display: flex; align-items: center;
    justify-content: center; margin-right: 12px; flex-shrink: 0;
    color: #fff; font-size: 16px;
}
.brand-text { color: #fff; font-size: 15px; font-weight: 700; letter-spacing: -0.3px; }
.brand-sub { color: var(--text-muted); font-size: 9px; letter-spacing: 0.5px; text-transform: uppercase; margin-top: 1px; }
.sidebar-nav {
    flex: 1; overflow-y: auto; padding: 12px 0;
    scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.1) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }
.nav-section-title {
    padding: 14px 20px 6px; font-size: 10px; font-weight: 600;
    color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px;
}
.sidebar-nav .nav-link {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px; margin: 0 12px;
    color: var(--text-sidebar); border-radius: 6px;
    font-size: 13px; transition: var(--transition); cursor: pointer;
    text-decoration: none;
}
.sidebar-nav .nav-link:hover { background: var(--bg-sidebar-hover); color: #fff; text-decoration: none; }
.sidebar-nav .nav-link.active { background: var(--bg-sidebar-active); color: #fff; font-weight: 500; }
.sidebar-nav .nav-link i { font-size: 18px; opacity: 0.65; width: 20px; text-align: center; flex-shrink: 0; }
.sidebar-nav .nav-link.active i { opacity: 1; }
.nav-badge {
    margin-left: auto; background: var(--accent); color: #fff;
    font-size: 10px; font-weight: 600; padding: 1px 7px; border-radius: 10px;
}
.nav-arrow { margin-left: auto; font-size: 12px; opacity: 0.4; transition: transform 0.2s; }
.nav-group.open > .nav-link .nav-arrow { transform: rotate(90deg); }
.nav-sub { max-height: 0; overflow: hidden; transition: max-height 0.25s ease; }
.nav-group.open > .nav-sub { max-height: 600px; }
.nav-sub .nav-link {
    padding-left: 52px; font-size: 12px; color: var(--text-muted); margin: 0 12px;
}
.nav-sub .nav-link:hover { color: #fff; }
.nav-sub .nav-link.active { color: #fff; background: rgba(255,255,255,0.06); }
.sidebar-footer {
    padding: 12px 16px; border-top: 1px solid rgba(255,255,255,0.06); flex-shrink: 0;
}
.sidebar-footer-text { font-size: 10px; color: var(--text-muted); text-align: center; line-height: 1.4; }

/* ===== TOPBAR ===== */
.topbar {
    position: fixed; top: 0; left: var(--sidebar-w); right: 0;
    height: var(--header-h); background: var(--bg-card);
    border-bottom: 1px solid var(--border); z-index: 90;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 24px; transition: var(--transition);
}
.sidebar.collapsed ~ .topbar { left: 0; }
.topbar-left { display: flex; align-items: center; gap: 16px; }
.sidebar-toggle {
    width: 36px; height: 36px; border: 1px solid var(--border);
    border-radius: var(--radius); display: flex; align-items: center;
    justify-content: center; background: #fff; cursor: pointer;
    font-size: 18px; color: var(--text-secondary); transition: var(--transition);
}
.sidebar-toggle:hover { background: var(--bg-body); }
.breadcrumb-nav { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-secondary); }
.breadcrumb-nav a { color: var(--text-secondary); text-decoration: none; }
.breadcrumb-nav a:hover { color: var(--accent-text); text-decoration: underline; }
.breadcrumb-sep { color: var(--text-muted); font-size: 11px; }
.breadcrumb-current { color: var(--text-primary); font-weight: 500; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.topbar-search { position: relative; }
.topbar-search input {
    width: 280px; height: 34px; border: 1px solid var(--border);
    border-radius: var(--radius); padding: 0 12px 0 34px;
    font-size: 12px; background: var(--bg-body); font-family: inherit;
    transition: var(--transition);
}
.topbar-search input:focus { outline: none; border-color: var(--accent); background: #fff; box-shadow: 0 0 0 3px rgba(15,118,110,0.1); }
.topbar-search i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.topbar-icon-btn {
    width: 36px; height: 36px; border: 1px solid var(--border);
    border-radius: var(--radius); display: flex; align-items: center;
    justify-content: center; background: #fff; cursor: pointer;
    position: relative; transition: var(--transition); font-size: 18px;
    color: var(--text-secondary);
}
.topbar-icon-btn:hover { background: var(--bg-body); border-color: var(--text-muted); }
.notif-dot {
    position: absolute; top: 6px; right: 6px; width: 7px; height: 7px;
    background: var(--danger); border-radius: 50%; border: 1.5px solid #fff;
    display: none;
}
.notif-dot.show { display: block; }
.topbar-divider { width: 1px; height: 28px; background: var(--border); margin: 0 8px; }
.topbar-user {
    display: flex; align-items: center; gap: 10px; cursor: pointer;
    padding: 4px 8px; border-radius: var(--radius); position: relative;
    transition: var(--transition);
}
.topbar-user:hover { background: var(--bg-body); }
.user-info-header { text-align: right; }
.user-name-header { font-size: 13px; font-weight: 600; }
.user-role-header { font-size: 11px; color: var(--text-secondary); }
.user-avatar-header {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--accent); color: #fff; display: flex;
    align-items: center; justify-content: center;
    font-size: 13px; font-weight: 600;
}
.user-dropdown-menu {
    display: none; position: absolute; top: 100%; right: 0;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-md);
    min-width: 200px; padding: 8px 0; margin-top: 8px; z-index: 200;
}
.user-dropdown-menu.show { display: block; }
.user-dropdown-menu a {
    display: flex; align-items: center; gap: 10px; padding: 8px 16px;
    font-size: 13px; color: var(--text-primary); transition: var(--transition);
}
.user-dropdown-menu a:hover { background: var(--bg-body); text-decoration: none; }
.user-dropdown-menu .text-danger { color: var(--danger); }
.dropdown-divider { height: 1px; background: var(--border-light); margin: 4px 0; }

/* ===== MAIN CONTENT ===== */
.main-content {
    margin-left: var(--sidebar-w); margin-top: var(--header-h);
    padding: 24px; min-height: calc(100vh - var(--header-h));
    transition: var(--transition);
}
.sidebar.collapsed ~ .main-content { margin-left: 0; }

/* ===== PAGE HEADER ===== */
.page-header-bar {
    display: flex; justify-content: space-between; align-items: flex-start;
    margin-bottom: 24px;
}
.page-title { font-size: 20px; font-weight: 700; letter-spacing: -0.3px; }
.page-subtitle { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }

/* ===== CARDS ===== */
.card-custom {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); overflow: hidden;
}
.card-custom .card-header-custom {
    display: flex; justify-content: space-between; align-items: center;
    padding: 16px 20px; border-bottom: 1px solid var(--border-light);
}
.card-header-title { font-size: 14px; font-weight: 600; }

/* ===== METRIC CARDS ===== */
.metric-card {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 20px; transition: var(--transition);
}
.metric-card:hover { box-shadow: var(--shadow-md); border-color: var(--text-muted); }
.metric-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.metric-icon {
    width: 40px; height: 40px; border-radius: 10px; display: flex;
    align-items: center; justify-content: center; font-size: 20px;
}
.metric-change { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 20px; }
.metric-change.up { background: var(--success-bg); color: var(--success); }
.metric-change.down { background: var(--danger-bg); color: var(--danger); }
.metric-value { font-size: 28px; font-weight: 700; letter-spacing: -1px; }
.metric-label { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

/* ===== DATA TABLE ===== */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
    text-align: left; padding: 10px 16px; font-size: 11px;
    font-weight: 600; color: var(--text-muted); text-transform: uppercase;
    letter-spacing: 0.5px; border-bottom: 1px solid var(--border);
    background: var(--bg-body);
}
.data-table td {
    padding: 10px 16px; font-size: 13px;
    border-bottom: 1px solid var(--border-light); vertical-align: middle;
}
.data-table tbody tr { transition: var(--transition); }
.data-table tbody tr:hover { background: var(--border-light); }
.data-table tbody tr:last-child td { border-bottom: none; }

/* ===== BADGES ===== */
.badge-custom {
    display: inline-flex; align-items: center; padding: 3px 10px;
    border-radius: 20px; font-size: 11px; font-weight: 500;
}
.badge-success-custom { background: var(--success-bg); color: var(--success); }
.badge-warning-custom { background: var(--warning-bg); color: var(--warning); }
.badge-danger-custom { background: var(--danger-bg); color: var(--danger); }
.badge-info-custom { background: var(--info-bg); color: var(--info); }
.badge-purple-custom { background: var(--purple-bg); color: var(--purple); }
.badge-orange-custom { background: var(--orange-bg); color: var(--orange); }

/* ===== AVATAR ===== */
.avatar {
    border-radius: 50%; display: inline-flex; align-items: center;
    justify-content: center; font-weight: 600; color: #fff; flex-shrink: 0;
}
.avatar-sm { width: 28px; height: 28px; font-size: 10px; }
.avatar-md { width: 36px; height: 36px; font-size: 12px; }
.avatar-lg { width: 48px; height: 48px; font-size: 16px; }
.avatar-xl { width: 72px; height: 72px; font-size: 24px; }

/* ===== BUTTONS ===== */
.btn-accent {
    background: var(--accent); color: #fff; border-color: var(--accent);
}
.btn-accent:hover { background: #0e6b63; color: #fff; border-color: #0e6b63; }

/* ===== PAGINATION ===== */
.pagination-custom {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 20px; border-top: 1px solid var(--border-light);
}
.pagination-info { font-size: 12px; color: var(--text-secondary); }

/* ===== PROGRESS BAR ===== */
.progress-mini { display: inline-flex; align-items: center; gap: 8px; }
.progress-mini-track {
    width: 70px; height: 5px; background: var(--border-light);
    border-radius: 3px; overflow: hidden;
}
.progress-mini-fill { height: 100%; border-radius: 3px; }

/* ===== LOGIN PAGE ===== */
.login-wrapper {
    min-height: 100vh; display: flex; align-items: center;
    justify-content: center; background: linear-gradient(135deg, #0f2920 0%, #16a34a 100%);
}
.login-card {
    background: var(--bg-card); border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0,0,0,0.3); width: 420px;
    overflow: hidden;
}
.login-header {
    background: var(--bg-sidebar); padding: 32px; text-align: center;
}
.login-body { padding: 32px; }

/* ===== FORMS ===== */
.form-label-custom {
    font-size: 12px; font-weight: 500; color: var(--text-secondary); margin-bottom: 6px;
}

/* ===== PUBLIC FORM ===== */
.public-form-wrapper {
    min-height: 100vh; background: linear-gradient(135deg, #f4f6f9 0%, #e2e8f0 100%);
    padding: 40px 20px;
}
.public-form-card {
    max-width: 800px; margin: 0 auto; background: var(--bg-card);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-md);
    overflow: hidden;
}
.public-form-header {
    background: linear-gradient(135deg, #14532d, #16a34a);
    padding: 32px; color: #fff; text-align: center;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .sidebar { left: calc(var(--sidebar-w) * -1); }
    .sidebar.mobile-open { left: 0; }
    .topbar { left: 0; }
    .main-content { margin-left: 0; }
    .topbar-search { display: none; }
    .page-header-bar { flex-direction: column; gap: 12px; }
}
