/* =========================================================
   AMERI DESIGN SYSTEM — LAYOUT & DOCK
   Layout, Sidebar Navigation, Breadcrumbs & Profile Pill
   ========================================================= */

.app-container {
    display: flex;
    min-height: 100vh;
    background: radial-gradient(ellipse at bottom, #0e090b 0%, #080808 100%) fixed;
}

/* --- SIDEBAR / DOCK --- */
.sidebar {
    width: 220px;
    background-color: #0a0a0a;
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 0;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 100;
}

.brand-section {
    height: 70px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 16px;
    border-bottom: 1px solid var(--border-subtle);
    text-decoration: none;
    color: #ffffff;
    transition: opacity 0.15s;
    flex-shrink: 0;
}

.brand-section:hover {
    opacity: 0.8;
}

.brand-logo-icon {
    width: 20px;
    height: 20px;
    background: transparent;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    flex-shrink: 0;
}

.brand-logo-svg {
    display: block;
    width: 100%;
    height: 100%;
}

.brand-logo-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.brand-name {
    font-size: 14.5px;
    font-weight: 600;
    color: #ffffff;
    letter-spacing: -0.01em;
}

.sidebar-scrollable {
    flex: 1;
    padding: 20px 12px 14px 12px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.sidebar-scrollable::-webkit-scrollbar {
    width: 4px;
}

.sidebar-scrollable::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
}

/* Nav links & Category Groups */
.nav-menu {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 18px;
    flex: 1;
}

.nav-active-indicator {
    position: absolute;
    left: 0;
    width: 100%;
    border-radius: 6px;
    background-color: rgba(255, 255, 255, 0.05);
    pointer-events: none;
    z-index: 0;
    opacity: 0;
}

.nav-active-indicator.is-ready {
    transition: top 0.28s cubic-bezier(0.4, 0, 0.2, 1), height 0.28s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.15s ease;
}

.nav-active-indicator::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    border-radius: 999px;
    background: var(--accent-pink);
}

.nav-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-section-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.28);
    padding: 0 10px 6px 10px;
    user-select: none;
}

.nav-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.04);
    margin: 8px 8px;
}

.nav-item {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 10px;
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.52);
    text-decoration: none;
    font-size: 13px;
    font-weight: 450;
    transition: color 0.12s ease;
}

.nav-item i {
    font-size: 13px;
    width: 16px;
    text-align: center;
    opacity: 0.5;
    transition: opacity 0.12s, color 0.12s;
}

.nav-item > span:not(.nav-badge) {
    flex: 1;
}

.nav-badge {
    display: none;
    align-items: center;
    justify-content: center;
    min-width: 17px;
    height: 17px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--accent-pink);
    color: #111111;
    font-size: 10px;
    font-weight: 700;
    flex-shrink: 0;
}

.nav-item:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.04);
}

.nav-item:hover i {
    opacity: 1;
    color: #ffffff;
}

.nav-item.active {
    color: #ffffff;
    font-weight: 500;
}

.nav-item.active i {
    opacity: 1;
    color: var(--accent-pink);
}

/* Sidebar Footer / User Profile */
.sidebar-footer {
    padding: 14px 12px 18px 12px;
    border-top: 1px solid var(--border-subtle);
    background-color: #0a0a0a;
    flex-shrink: 0;
}

.user-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 6px;
    border-radius: 8px;
}

.user-row-profile-link {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
    padding: 10px 8px;
    margin: -10px -8px;
    border-radius: 8px;
    text-decoration: none;
    transition: background-color 0.12s ease;
}

.user-row-profile-link:hover {
    background-color: rgba(255, 255, 255, 0.04);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    color: #ffffff;
    flex-shrink: 0;
    overflow: hidden;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 50%;
}

.user-avatar-ring {
    box-shadow: 0 0 0 2px #0a0a0a, 0 0 0 4px var(--accent-pink);
}

.user-name-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
}

.user-name-text {
    font-size: 13.5px;
    font-weight: 550;
    color: rgba(255, 255, 255, 0.85);
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
    min-width: 0;
}

.user-role-icon {
    font-size: 13px;
    top: -1px;
}

.btn-logout {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.35);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    text-decoration: none;
    flex-shrink: 0;
}

.btn-logout:hover {
    color: #f87171;
    background-color: rgba(239, 68, 68, 0.1);
}

/* --- MAIN CONTENT WRAPPER --- */
.main-wrapper {
    margin-left: 220px;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Topbar Header */
.topbar {
    height: 70px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 36px;
    border-bottom: 1px solid var(--border-subtle);
    background-color: rgba(10, 10, 10, 0.8);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-title {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 14px;
}

/* Page Content View */
.content-area {
    padding: 36px;
    max-width: 1300px;
    width: 100%;
    margin: 0 auto;
}

/* Grid Layouts */
.grid-2 {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-bottom: 24px;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

/* Fullscreen Auth Layout (Login / Register) */
.auth-page {
    min-height: calc(100vh - 110px);
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at bottom, #0e090b 0%, #080808 100%) fixed;
    padding: 24px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: linear-gradient(180deg, rgba(244, 114, 182, 0.05) 0%, rgba(244, 114, 182, 0) 220px), #0d0a0c;
    border: 1px solid rgba(244, 114, 182, 0.14);
    border-radius: var(--radius-lg);
    padding: 36px;
    position: relative;
    overflow: hidden;
}

.auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--accent-pink) 0%, #f7a8c4 50%, var(--accent-pink) 100%);
}

.auth-header {
    text-align: center;
    margin-bottom: 28px;
}

.auth-logo-badge img {
    width: 56px;
    height: 56px;
    object-fit: contain;
    display: inline-block;
    margin-bottom: 16px;
}

.auth-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.auth-desc {
    font-size: 13px;
    color: #a99aa0;
}

.auth-divider {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 20px 0;
    color: #a99aa0;
    font-size: 12px;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border-subtle);
}

.auth-divider:not(:empty)::before {
    margin-right: .75em;
}

.auth-divider:not(:empty)::after {
    margin-left: .75em;
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 13px;
    color: #a99aa0;
}

.auth-footer a {
    color: #ffffff;
    text-decoration: none;
    font-weight: 600;
}
.auth-footer a:hover {
    text-decoration: underline;
}

/* --- RESPONSIVE: tablet, el sidebar colapsa a una barra de solo íconos --- */
@media (max-width: 960px) {
    .sidebar {
        width: 72px;
        padding: 0;
    }

    .brand-section {
        justify-content: center;
        padding: 0;
    }

    .brand-name {
        display: none;
    }

    .sidebar-scrollable {
        padding: 16px 8px;
        align-items: center;
    }

    .nav-menu {
        width: 100%;
    }

    .nav-section-label {
        display: none;
    }

    .nav-item {
        justify-content: center;
        padding: 10px;
    }

    .nav-item > span:not(.nav-badge) {
        display: none;
    }

    .nav-badge {
        position: absolute;
        top: 2px;
        right: 2px;
    }

    .sidebar-footer {
        padding: 12px 8px;
    }

    .user-row {
        flex-direction: column;
        gap: 10px;
        padding: 0;
    }

    .user-row-profile-link {
        padding: 0;
        margin: 0;
        justify-content: center;
    }

    .user-name-row {
        display: none;
    }

    .main-wrapper {
        margin-left: 72px;
    }

    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }

    .content-area {
        padding: 24px;
    }
}

/* --- RESPONSIVE: celular --- */
@media (max-width: 640px) {
    .sidebar {
        width: 60px;
    }

    .main-wrapper {
        margin-left: 60px;
    }

    .topbar {
        height: auto;
        min-height: 60px;
        padding: 10px 16px;
        flex-wrap: wrap;
        gap: 10px;
        row-gap: 10px;
    }

    .topbar-title {
        font-size: 15px;
    }

    .topbar-actions {
        width: 100%;
        flex-wrap: wrap;
    }

    .admin-search-wrapper {
        width: 100%;
    }

    .content-area {
        padding: 16px;
    }
}
