/* CajaChica App — Design System */

/* ── Base ── */
*, *::before, *::after { box-sizing: border-box; }
body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    color: #1A2332;
    background: #F4F6F9;
}

/* ── Cards ── */
.cc-card {
    background: #ffffff;
    border: 1px solid #E8ECF0;
    border-radius: 12px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
.cc-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #E8ECF0;
}

/* ── KPIs ── */
.cc-kpi { display: flex; flex-direction: column; gap: 4px; }
.cc-kpi-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--color-primary);
    line-height: 1;
}
.cc-kpi-label {
    font-size: 12px;
    color: #6B7A8D;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 500;
}

/* ── KPI Card (con hover y sombra 3D) ── */
.cc-kpi-card {
    padding: 20px 24px;
    border: 1px solid #E2E8F0;
    border-left: 2px solid #6B7280;
    box-shadow: 2px 3px 0 #CBD5E1;
    transition: border-color 0.18s ease, border-left-color 0.18s ease,
                box-shadow 0.18s ease, transform 0.15s ease;
    cursor: default;
}
.cc-kpi-card:hover {
    border-color: var(--color-primary);
    border-left-color: var(--color-primary);
    box-shadow: 2px 3px 0 var(--color-primary), 0 6px 16px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}

/* ── Tables ── */
.cc-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.cc-table thead th {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    font-weight: 600;
    color: #6B7A8D;
    padding: 0 16px 10px;
    text-align: left;
    border-bottom: 1px solid #E8ECF0;
}
.cc-table tbody tr { border-bottom: 1px solid #F0F3F6; transition: background 0.12s; }
.cc-table tbody tr:last-child { border-bottom: none; }
.cc-table tbody tr:hover { background: #F8FAFC; }
.cc-table tbody td { padding: 12px 16px; color: #2D3A4A; }

/* ── Badges ── */
.cc-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 99px;
    font-size: 11.5px;
    font-weight: 600;
}
.cc-badge::before {
    content: '';
    width: 6px; height: 6px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.7;
}
.cc-badge-green  { background: #E7F9EF; color: #1A7A40; }
.cc-badge-yellow { background: #FFF8E1; color: #A07800; }
.cc-badge-red    { background: #FFE9E9; color: #C0392B; }
.cc-badge-blue   { background: #E8F0FE; color: #1A56B0; }
.cc-badge-gray   { background: #F0F3F6; color: #6B7A8D; }

/* ── Buttons ── */
.cc-btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    background: var(--color-primary, #005691);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s;
}
.cc-btn-primary:hover { opacity: 0.88; }
.cc-btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.cc-btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    background: #fff;
    color: #4A5568;
    border: 1px solid #D1D9E0;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.cc-btn-secondary:hover { background: #F4F6F9; border-color: #B8C4CE; }

.cc-btn-danger {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    background: #fff;
    color: #C0392B;
    border: 1px solid #F5C6C2;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
}
.cc-btn-danger:hover { background: #FFF0EE; }

/* ── Toolbar fields ── */
.cc-field {
    height: 36px;
    padding: 0 12px;
    border: 1px solid #D1D9E0;
    border-radius: 8px;
    font-size: 13.5px;
    color: #2D3A4A;
    background: #fff;
    outline: none;
    transition: border-color 0.15s;
}
.cc-field:focus { border-color: var(--color-primary, #005691); }

/* ── Form fields (modales) ── */
.cc-form-field {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    border: 1px solid #D1D9E0;
    border-radius: 10px;
    font-size: 14px;
    color: #2D3A4A;
    background: #fff;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.cc-form-field:focus {
    border-color: var(--color-primary, #005691);
    box-shadow: 0 0 0 3px rgba(0,86,145,0.12);
}
textarea.cc-form-field { height: auto; padding: 10px 12px; resize: vertical; }

/* ── Modales ── */
.cc-fmodal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(3px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.cc-fmodal {
    background: #fff;
    border-radius: 1.5rem;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.18);
}
.cc-fmodal.sm  { max-width: 26rem; }
.cc-fmodal.md  { max-width: 32rem; }
.cc-fmodal.lg  { max-width: 46rem; }
.cc-fmodal.xl  { max-width: 58rem; }

.cc-fmodal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 20px 24px;
    background: var(--color-primary, #005691);
    border-radius: 1.5rem 1.5rem 0 0;
    flex-shrink: 0;
}
.cc-fmodal-title  { font-size: 16px; font-weight: 700; color: #fff; margin: 0 0 2px; }
.cc-fmodal-sub    { font-size: 12.5px; color: rgba(255,255,255,0.72); margin: 0; }
.cc-fmodal-close {
    background: rgba(255,255,255,0.15);
    border: none;
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    padding: 5px;
    transition: background 0.15s;
    flex-shrink: 0;
}
.cc-fmodal-close:hover { background: rgba(255,255,255,0.25); }

.cc-fmodal-body   { padding: 20px 24px; overflow-y: auto; flex: 1; }
.cc-fmodal-footer {
    padding: 16px 24px;
    border-top: 1px solid #E8ECF0;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-shrink: 0;
}

.cc-fmodal-label {
    display: block;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    color: #6B7A8D;
    margin-bottom: 6px;
}
.cc-fmodal-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #D1D9E0;
    border-radius: 0.75rem;
    font-size: 14px;
    color: #2D3A4A;
    background: #fff;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.cc-fmodal-input:focus {
    border-color: var(--color-primary, #005691);
    box-shadow: 0 0 0 3px rgba(0,86,145,0.12);
}
select.cc-fmodal-input { appearance: auto; }
textarea.cc-fmodal-input { height: auto; padding: 10px 14px; resize: vertical; }

.cc-fmodal-hint   { font-size: 11.5px; color: #8E9BAA; margin-top: 4px; }
.cc-fmodal-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.cc-fmodal-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ── Sidebar ── */
.cc-sidebar {
    width: 240px;
    min-height: 100vh;
    background: var(--color-primary, #005691);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0; top: 0; bottom: 0;
    z-index: 100;
}
.cc-sidebar-logo {
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.12);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
}
.cc-sidebar-logo img {
    width: 160px; height: 70px;
    object-fit: contain;
}
.cc-sidebar-logo-text {
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
}
.cc-sidebar-logo-sub { font-size: 10px; color: rgba(255,255,255,0.6); font-weight: 400; }

.cc-nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.cc-nav-section {
    font-size: 9.5px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255,255,255,0.45);
    font-weight: 700;
    padding: 12px 10px 4px;
}
.cc-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    transition: background 0.12s, color 0.12s;
    margin-bottom: 1px;
}
.cc-nav-item:hover  { background: rgba(255,255,255,0.1); color: #fff; }
.cc-nav-item.active { background: rgba(255,255,255,0.18); color: #fff; font-weight: 600; }
.cc-nav-item svg    { flex-shrink: 0; opacity: 0.85; }
.cc-nav-item.active svg { opacity: 1; }

.cc-sidebar-footer {
    padding: 12px 10px;
    border-top: 1px solid rgba(255,255,255,0.12);
}
.cc-user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.12s;
}
.cc-user-card:hover { background: rgba(255,255,255,0.1); }
.cc-user-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}
.cc-user-name {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.cc-user-role { font-size: 10.5px; color: rgba(255,255,255,0.55); }

/* ── Main content ── */
.cc-main { margin-left: 240px; min-height: 100vh; display: flex; flex-direction: column; }
.cc-topbar {
    height: 56px;
    background: #fff;
    border-bottom: 1px solid #E8ECF0;
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 50;
}
.cc-topbar-title { font-size: 16px; font-weight: 700; color: #1A2332; flex: 1; }
.cc-page { padding: 24px; flex: 1; }

/* ── Alerts ── */
.cc-alert {
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 13.5px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.cc-alert-error   { background: #FFF0EE; color: #C0392B; border: 1px solid #F5C6C2; }
.cc-alert-success { background: #E7F9EF; color: #1A7A40; border: 1px solid #A3E4B7; }
.cc-alert-warning { background: #FFF8E1; color: #A07800; border: 1px solid #FFE082; }
.cc-alert-info    { background: #E8F0FE; color: #1A56B0; border: 1px solid #A3C0F5; }

/* ── Empty state ── */
.cc-empty { text-align: center; padding: 48px 24px; color: #6B7A8D; }
.cc-empty-icon { font-size: 40px; margin-bottom: 12px; opacity: 0.4; }
.cc-empty-text { font-size: 14px; }

/* ── Pagination ── */
.cc-pagination {
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: flex-end;
    padding: 12px 16px;
    border-top: 1px solid #E8ECF0;
}
.cc-page-btn {
    min-width: 32px; height: 32px;
    padding: 0 8px;
    border: 1px solid #D1D9E0;
    border-radius: 6px;
    background: #fff;
    font-size: 13px;
    color: #4A5568;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.12s;
}
.cc-page-btn:hover   { background: #F4F6F9; }
.cc-page-btn.active  { background: var(--color-primary, #005691); color: #fff; border-color: var(--color-primary, #005691); }
.cc-page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Login page ── */
.cc-login-bg {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--color-primary, #005691) 0%, #003a62 100%);
    padding: 16px;
}
.cc-login-card {
    background: #fff;
    border-radius: 20px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 24px 64px rgba(0,0,0,0.22);
    overflow: hidden;
}
.cc-login-header {
    background: var(--color-primary, #005691);
    padding: 32px 36px 28px;
    text-align: center;
}
.cc-login-logo {
    width: 60px; height: 60px;
    margin: 0 auto 12px;
    border-radius: 14px;
    object-fit: contain;
    background: rgba(255,255,255,0.15);
    padding: 8px;
    display: block;
}
.cc-login-company { font-size: 18px; font-weight: 800; color: #fff; margin: 0 0 2px; }
.cc-login-tagline { font-size: 12px; color: rgba(255,255,255,0.65); margin: 0; }
.cc-login-body    { padding: 32px 36px; }

/* ── Spinner ── */
.cc-spinner {
    display: inline-block;
    width: 16px; height: 16px;
    border: 2px solid rgba(255,255,255,0.35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: cc-spin 0.7s linear infinite;
    vertical-align: middle;
}
@keyframes cc-spin { to { transform: rotate(360deg); } }

/* ── Tabs ── */
.cc-tab {
    padding: 8px 18px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #6B7280;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    margin-bottom: -2px;
    transition: color .15s, border-color .15s;
}
.cc-tab:hover { color: var(--color-primary); }
.cc-tab.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }

/* ── Responsive ── */
@media (max-width: 767px) {
    .cc-sidebar { transform: translateX(-100%); transition: transform 0.25s; }
    .cc-sidebar.open { transform: translateX(0); }
    .cc-main { margin-left: 0; }
}
