/* ============================================================
   ApiPartidas Design System
   Baseado no CETGEO Empresas — adaptado para Razor Pages
   ============================================================ */

/* ---------- CSS Custom Properties ---------- */
:root {
    --brand-pink: #ED1556;
    --brand-blue: #00AEEF;
    --brand-cyan: #00B4D8;
    --brand-green: #2ECC71;
    --brand-gray: #58595B;
    --brand-dark-gray: #3a3b3c;
    --brand-white: #ffffff;
    --brand-bg-light: #f4f7f9;
    --sidebar-width: 260px;
    --topbar-height: 72px;
    --transition-speed: 0.3s;
}

/* ---------- Reset & Base ---------- */
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: var(--brand-bg-light);
    color: var(--brand-dark-gray);
    overflow: hidden;
}

* {
    box-sizing: border-box;
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(88, 89, 91, 0.2);
    border-radius: 10px;
}

    ::-webkit-scrollbar-thumb:hover {
        background: rgba(88, 89, 91, 0.4);
    }

/* ---------- Page Layout (Sidebar + Main) ---------- */
.page {
    position: relative;
    display: flex;
    flex-direction: row;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    background-color: var(--brand-bg-light);
}

/* ---------- Sidebar ---------- */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--brand-white);
    border-right: 1px solid rgba(88, 89, 91, 0.1);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: left var(--transition-speed) ease;
}

.nav-container {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Logo */
.logo-section {
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0 24px;
    border-bottom: 1px solid rgba(88, 89, 91, 0.05);
}

.logo-text {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.logo-blue {
    color: var(--brand-blue);
}

.logo-pink {
    color: var(--brand-pink);
}

.logo-cyan {
    color: var(--brand-cyan);
}

/* Navigation */
.nav-menu {
    flex: 1;
    padding: 16px 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.nav-item-wrapper {
    position: relative;
    margin: 0 12px;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 11px 16px;
    color: var(--brand-gray);
    text-decoration: none;
    border-radius: 12px;
    transition: all var(--transition-speed) ease;
    font-weight: 500;
    font-size: 0.95rem;
}

    .nav-link i {
        font-size: 1.15rem;
        min-width: 24px;
        text-align: center;
    }

.nav-text {
    margin-left: 12px;
    white-space: nowrap;
}

.nav-link:hover {
    background-color: rgba(0, 174, 239, 0.05);
    color: var(--brand-blue);
}

.nav-item-wrapper.active .nav-link {
    background: linear-gradient(90deg, rgba(0, 174, 239, 0.1) 0%, rgba(0, 174, 239, 0.02) 100%);
    color: var(--brand-blue);
    font-weight: 600;
}

.nav-item-wrapper.active::before {
    content: '';
    position: absolute;
    left: -12px;
    top: 50%;
    transform: translateY(-50%);
    height: 55%;
    width: 4px;
    background-color: var(--brand-pink);
    border-radius: 0 4px 4px 0;
}

/* Sidebar Footer */
.sidebar-footer {
    padding: 16px 24px;
    border-top: 1px solid rgba(88, 89, 91, 0.05);
    text-align: center;
}

.version-badge {
    font-size: 0.75rem;
    color: var(--brand-gray);
    background: rgba(88, 89, 91, 0.08);
    padding: 4px 12px;
    border-radius: 20px;
}

/* ---------- Main Content Area ---------- */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
}

/* ---------- Top Bar (Glass Effect) ---------- */
.top-row {
    position: sticky;
    top: 0;
    z-index: 900;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(88, 89, 91, 0.05);
}

.header-content {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    width: 100%;
}

.btn-toggle-mobile {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--brand-dark-gray);
    cursor: pointer;
    margin-right: auto;
    display: none;
}

.greeting {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--brand-dark-gray);
}

/* ---------- Content ---------- */
.content {
    padding-top: 24px;
    padding-bottom: 16px;
    flex: 1;
}

/* ---------- Footer ---------- */
.footer-text {
    text-align: center;
    font-size: 0.8rem;
    color: var(--brand-gray);
}

/* ============================================================
   Dashboard Components
   ============================================================ */

.dashboard-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
    max-width: 1400px;
    margin: 0 auto;
}

/* Alert Banner */
.bento-alert {
    width: 100%;
}

.alert-card {
    background: linear-gradient(135deg, rgba(0, 174, 239, 0.08) 0%, rgba(0, 174, 239, 0.02) 100%);
    border: 1px solid rgba(0, 174, 239, 0.2);
    border-radius: 16px;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 4px 15px rgba(0, 174, 239, 0.05);
    transition: all 0.3s ease;
}

    .alert-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(0, 174, 239, 0.1);
    }

.alert-icon {
    background-color: var(--brand-blue);
    color: white;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.alert-content {
    flex: 1;
}

.alert-title {
    margin: 0 0 4px 0;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--brand-dark-gray);
}

.alert-text {
    margin: 0;
    color: var(--brand-gray);
    font-size: 0.95rem;
    line-height: 1.5;
}

.btn-action {
    background-color: var(--brand-blue);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    text-decoration: none;
    display: inline-block;
    font-size: 0.9rem;
}

    .btn-action:hover {
        background-color: #0096cc;
        box-shadow: 0 4px 10px rgba(0, 174, 239, 0.3);
        color: white;
        text-decoration: none;
    }

/* Bento Grid */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    grid-auto-flow: dense;
}

.bento-item {
    display: flex;
}

.bento-card {
    background-color: var(--brand-white);
    border-radius: 20px;
    padding: 24px;
    width: 100%;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    border: 1px solid rgba(88, 89, 91, 0.05);
    transition: all 0.3s ease;
}

    .bento-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
    }

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
    color: var(--brand-dark-gray);
}

.card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Icons */
.icon-blue {
    color: var(--brand-blue);
    font-size: 1.5rem;
}

.icon-pink {
    color: var(--brand-pink);
    font-size: 1.5rem;
}

.icon-cyan {
    color: var(--brand-cyan);
    font-size: 1.5rem;
}

.icon-green {
    color: var(--brand-green);
    font-size: 1.5rem;
}

/* Status */
.status-desc {
    color: var(--brand-gray);
    font-size: 0.9rem;
    margin-bottom: 12px;
}

/* Endpoint List */
.endpoint-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
    flex: 1;
}

    .endpoint-list code {
        background: rgba(0, 0, 0, 0.04);
        padding: 6px 10px;
        border-radius: 6px;
        font-size: 0.75rem;
        font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
        color: var(--brand-gray);
        word-break: break-all;
        line-height: 1.4;
    }

/* Code Block */
.code-block {
    background: rgba(0, 0, 0, 0.04);
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
    color: var(--brand-dark-gray);
    margin: 0 0 12px 0;
    overflow-x: auto;
}

/* Badges */
.badge-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: auto;
}

.badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    display: inline-block;
}

.badge-blue {
    background-color: rgba(0, 174, 239, 0.1);
    color: var(--brand-blue);
}

.badge-pink {
    background-color: rgba(237, 21, 86, 0.1);
    color: var(--brand-pink);
}

.badge-cyan {
    background-color: rgba(0, 180, 216, 0.1);
    color: var(--brand-cyan);
}

.badge-green {
    background-color: rgba(46, 204, 113, 0.1);
    color: var(--brand-green);
}

.badge-gray {
    background-color: rgba(88, 89, 91, 0.1);
    color: var(--brand-gray);
}

/* ---------- Stats Row ---------- */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.stat-card {
    background: var(--brand-white);
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    border: 1px solid rgba(88, 89, 91, 0.05);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
    transition: all 0.3s ease;
}

    .stat-card:hover {
        transform: translateY(-3px);
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.08);
    }

.stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--brand-blue);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--brand-gray);
    font-weight: 500;
}

/* ---------- mt-2 utility ---------- */
.mt-2 {
    margin-top: 8px;
}

/* ============================================================
   Blazor Error UI
   ============================================================ */
#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 767.98px) {
    .sidebar {
        position: fixed;
        left: calc(-1 * var(--sidebar-width));
        height: 100vh;
        box-shadow: 4px 0 15px rgba(0,0,0,0.05);
    }

        .sidebar.open {
            left: 0;
        }

    .btn-toggle-mobile {
        display: flex;
    }

    .header-content {
        justify-content: space-between;
    }

    .bento-grid {
        grid-template-columns: 1fr;
    }

    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .alert-card {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .stats-row {
        grid-template-columns: 1fr;
    }
}
