/* ==========================================
   SIDEBAR NAVIGATION
   ========================================== */

.app-container {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 260px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-header {
    padding: var(--spacing-xl) var(--spacing-lg);
    border-bottom: 1px solid var(--border-color);
}

.sidebar-logo {
    font-size: var(--font-size-xl);
    font-weight: 700;
    margin: 0;
    line-height: 1;
}

.sidebar-logo-link {
    display: inline-flex;
    align-items: center;
    gap: 0;
    text-decoration: none;
    width: 100%;
}

.sidebar-logo-mark {
    width: 196px;
    max-width: 100%;
    height: auto;
    object-fit: contain;
    flex-shrink: 0;
    border-radius: 0;
    display: block;
}

.sidebar-logo-wordmark {
    display: flex;
    flex-direction: column;
    line-height: 0.9;
}

.sidebar-logo-word {
    font-family: var(--font-family);
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.2px;
    color: var(--text-primary);
}

.sidebar-logo-img {
    max-width: 100%;
    height: auto;
    display: block;
}

.sidebar-logo-text {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-nav {
    flex: 1;
    padding: var(--spacing-lg) 0;
}

.sidebar-section-title {
    padding: var(--spacing-md) var(--spacing-lg);
    font-size: var(--font-size-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-top: var(--spacing-lg);
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    padding: var(--spacing-md) var(--spacing-lg);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: var(--font-size-sm);
    font-weight: 500;
    transition: all var(--transition-base);
    cursor: pointer;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    font-family: var(--font-family);
    position: relative;
}

.sidebar-nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--accent-primary);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.sidebar-nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.sidebar-nav-item.active {
    color: var(--text-primary);
    background: rgba(99, 102, 241, 0.1);
}

.sidebar-nav-item.active::before {
    opacity: 1;
}

.sidebar-icon {
    flex-shrink: 0;
    stroke-width: 2;
}

.sidebar-game-icon {
    width: 23px;
    height: 23px;
    border-radius: 4px;
    object-fit: cover;
    flex-shrink: 0;
}

/* User Profile in Sidebar */
.sidebar-user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    width: calc(100% - 8px);
    margin: 0 4px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    transition: all var(--transition-base);
    cursor: pointer;
    text-decoration: none;
    min-height: 48px;
}

.sidebar-user-profile:hover {
    background: rgba(255, 255, 255, 0.06);
}

.sidebar-user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 2px solid rgba(99, 102, 241, 0.3);
}

.sidebar-user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Divider */
.sidebar-divider {
    height: 1px;
    background: var(--border-color);
    margin: 16px 16px 12px 16px;
}

/* Sidebar Search */
#sidebar-search {
    position: relative;
    padding: 0 8px var(--spacing-md);
    padding-top: var(--spacing-lg);
    padding-bottom: var(--spacing-lg);
}

#sidebar-search::before,
#sidebar-search::after {
    content: '';
    position: absolute;
    left: 16px;
    right: 16px;
    height: 1px;
    background: var(--border-color);
}

#sidebar-search::before {
    left: 16px;
    right: 16px;
    top: 0;
}

#sidebar-search::after {
    bottom: 0;
}

.sidebar-search-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.sidebar-search-bar {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    width: 195px;
    height: 48px;
    gap: 10px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 8px 8px 8px 14px;
    min-height: 48px;
    overflow: hidden;
    transition: border-color 0.22s ease, background 0.22s ease, box-shadow 0.22s ease;
}

.sidebar-search-bar:focus-within {
    border-color: var(--accent-primary);
    background: var(--bg-tertiary);
    box-shadow: none;
}

.sidebar-search-bar.is-loading .sidebar-search-btn {
    animation: none;
}

.sidebar-search-bar.is-loading .sidebar-search-btn::after {
    opacity: 0;
    animation: none;
}

.sidebar-search-bar.is-loading .sidebar-search-icon {
    animation: none;
}

.sidebar-search-icon {
    width: 14px;
    height: 14px;
    color: currentColor;
    flex-shrink: 0;
}

.sidebar-search-input {
    flex: 1 1 auto;
    width: 0;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 12px;
    font-family: var(--font-family);
    min-width: 0;
    line-height: 1.2;
}

.sidebar-search-input::placeholder {
    color: rgba(170, 188, 218, 0.75);
    opacity: 1;
}

.sidebar-search-btn {
    position: relative;
    flex: 0 0 30px;
    align-self: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
    flex-shrink: 0;
}

.sidebar-search-btn:hover {
    border-color: var(--border-color-hover);
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.sidebar-search-btn:active {
    transform: none;
}

.sidebar-search-btn:focus-visible {
    outline: 0;
    box-shadow: 0 0 0 1px rgba(3, 202, 252, 0.25);
}

.sidebar-search-btn:disabled {
    opacity: 0.95;
    cursor: default;
}

.sidebar-search-btn::after {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    border: 1px solid transparent;
    opacity: 0;
    pointer-events: none;
}

.sidebar-search-error {
    font-size: 11px;
    color: #ef4444;
    padding: 2px 4px;
    display: none;
}

.sidebar-search-error.show {
    display: block;
}

@keyframes sidebar-search-btn-pulse {
    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(112, 186, 255, 0), 0 4px 10px rgba(10, 24, 54, 0.28);
        border-color: rgba(84, 150, 235, 0.45);
    }
    50% {
        box-shadow: 0 0 0 2px rgba(112, 186, 255, 0.18), 0 6px 16px rgba(18, 46, 92, 0.45);
        border-color: rgba(122, 198, 255, 0.75);
    }
}

@keyframes sidebar-search-btn-wave {
    0% {
        transform: scale(0.95);
        opacity: 0.45;
    }
    70% {
        transform: scale(1.1);
        opacity: 0;
    }
    100% {
        transform: scale(1.1);
        opacity: 0;
    }
}

@keyframes sidebar-search-icon-breathe {
    0%,
    100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(0.88);
        opacity: 0.7;
    }
}

.sidebar-footer {
    padding: var(--spacing-lg);
    border-top: none;
    margin-top: auto;
}

/* Main Content Area */
.main-content {
    margin-left: 260px;
    flex: 1;
    min-height: 100vh;
    width: calc(100% - 260px);
}

#page-container {
    padding: var(--spacing-2xl);
}

/* ==========================================
   PAGE HEADER
   ========================================== */

.page-header {
    margin-bottom: var(--spacing-2xl);
}

.page-title {
    font-size: var(--font-size-3xl);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
}

.page-subtitle {
    font-size: var(--font-size-base);
    color: var(--text-muted);
}

/* ==========================================
   RESPONSIVE
   ========================================== */

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        transition: transform var(--transition-base);
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        width: 100%;
    }

    #page-container {
        padding: var(--spacing-lg);
    }
}

/* Sidebar Toggle Button (Mobile) */
@media (max-width: 768px) {
    .sidebar-toggle {
        position: fixed;
        top: var(--spacing-lg);
        left: var(--spacing-lg);
        z-index: 101;
        background: var(--accent-primary);
        color: white;
        border: none;
        width: 40px;
        height: 40px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        box-shadow: var(--shadow-lg);
    }
}

@media (min-width: 769px) {
    .sidebar-toggle {
        display: none;
    }
}
