/* ========================================
   V2 Design System - Dashboard Layout
   ======================================== */

.v2-dashboard {
    display: flex;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--rd-bg);
}

/* ========================================
   Sidebar
   ======================================== */

.v2-dashboard .dashboard-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--rd-sidebar-width);
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    background: var(--rd-bg-alt);
    border-right: 1px solid var(--rd-border-light);
    z-index: var(--rd-z-sticky);
    transition: transform var(--rd-transition-normal);
}

.v2-dashboard .sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--rd-header-height);
    padding: 0 1rem;
    border-bottom: 1px solid var(--rd-border-light);
}

.v2-dashboard .sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--rd-text);
}

.v2-dashboard .brand-logo {
    height: 38px;
    width: auto;
    filter: drop-shadow(0 0 8px rgba(139, 0, 0, 0.3));
    transition: filter var(--rd-transition-fast);
}

.v2-dashboard .sidebar-brand:hover .brand-logo {
    filter: drop-shadow(0 0 12px rgba(139, 0, 0, 0.5));
}

.v2-dashboard .sidebar-toggle {
    display: none;
    width: 32px;
    height: 32px;
    padding: 4px;
    background: transparent;
    border: none;
    color: var(--rd-text-muted);
    cursor: pointer;
    border-radius: var(--rd-radius-sm);
    transition: all var(--rd-transition-fast);
}

.v2-dashboard .sidebar-toggle:hover {
    background: var(--rd-bg-active);
    color: var(--rd-text);
}

/* ========================================
   Navigation
   ======================================== */

.v2-dashboard .sidebar-nav {
    flex: 1;
    padding: 1rem 0.75rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.v2-dashboard .nav-item {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    padding: 0.75rem 1rem;
    color: var(--rd-text-secondary);
    text-decoration: none;
    border-radius: var(--rd-radius-md);
    transition: all var(--rd-transition-fast);
    font-size: 0.9375rem;
    font-weight: var(--rd-font-weight-medium);
}

.v2-dashboard .nav-item:hover {
    background: var(--rd-bg-hover);
    color: rgba(255, 255, 255, 0.95);
}

.v2-dashboard .nav-item.active {
    background: rgba(139, 0, 0, 0.25);
    color: var(--rd-primary-light);
}

.v2-dashboard .nav-item.active .nav-icon {
    color: var(--rd-primary-light);
}

.v2-dashboard .nav-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.v2-dashboard .nav-text {
    font-size: 0.9375rem;
    font-weight: var(--rd-font-weight-medium);
}

/* ========================================
   Sidebar Footer
   ======================================== */

.v2-dashboard .sidebar-footer {
    padding: 0.75rem;
    border-top: 1px solid var(--rd-border-light);
}

.v2-dashboard .logout-item {
    color: rgba(255, 255, 255, 0.4);
}

.v2-dashboard .logout-item:hover {
    background: rgba(220, 20, 60, 0.1);
    color: var(--rd-danger);
}

.v2-dashboard .logout-item:hover .nav-icon {
    color: var(--rd-danger);
}

/* ========================================
   Overlay for mobile sidebar
   ======================================== */

.v2-dashboard .dashboard-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 150;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--rd-transition-normal);
}

.v2-dashboard .dashboard-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

/* ========================================
   Main Content
   ======================================== */

.v2-dashboard .dashboard-main {
    flex: 1;
    margin-left: var(--rd-sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
}

/* ========================================
   Header
   ======================================== */

.v2-dashboard .dashboard-header {
    position: sticky;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    height: var(--rd-header-height);
    padding: 0 1.5rem;
    background: rgba(13, 13, 13, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--rd-border-light);
    z-index: var(--rd-z-dropdown);
}

.v2-dashboard .header-menu-btn {
    display: none;
    width: 40px;
    height: 40px;
    padding: 8px;
    background: transparent;
    border: none;
    color: var(--rd-text-secondary);
    cursor: pointer;
    border-radius: var(--rd-radius-md);
    transition: all var(--rd-transition-fast);
    margin-right: auto;
}

.v2-dashboard .header-menu-btn:hover {
    background: var(--rd-bg-active);
    color: var(--rd-text);
}

/* ========================================
   User Menu
   ======================================== */

.v2-dashboard .header-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.v2-dashboard .user-menu-wrapper {
    position: relative;
}

.v2-dashboard .user-menu-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--rd-bg-input);
    border: 1px solid var(--rd-border-light);
    border-radius: var(--rd-radius-md);
    color: rgba(255, 255, 255, 0.9);
    font-family: inherit;
    font-size: 0.9375rem;
    font-weight: var(--rd-font-weight-medium);
    cursor: pointer;
    transition: all var(--rd-transition-fast);
}

.v2-dashboard .user-menu-btn:hover {
    background: var(--rd-bg-active);
    border-color: rgba(255, 255, 255, 0.15);
    color: var(--rd-text);
}

.v2-dashboard .user-nickname {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.v2-dashboard .menu-chevron {
    width: 16px;
    height: 16px;
    color: var(--rd-text-muted);
    transition: transform var(--rd-transition-fast);
}

.v2-dashboard .menu-chevron.open {
    transform: rotate(180deg);
}

.v2-dashboard .user-menu-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    padding: 0.5rem;
    background: rgba(30, 30, 30, 0.98);
    border: 1px solid var(--rd-border);
    border-radius: var(--rd-radius-md);
    box-shadow: var(--rd-shadow-dropdown);
    z-index: 1000;
}

.v2-dashboard .menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    border-radius: var(--rd-radius-sm);
    color: var(--rd-text-secondary);
    font-family: inherit;
    font-size: var(--rd-font-size-sm);
    font-weight: var(--rd-font-weight-medium);
    text-decoration: none;
    text-align: left;
    cursor: pointer;
    transition: all var(--rd-transition-fast);
}

.v2-dashboard .menu-item:hover {
    background: var(--rd-bg-hover);
    color: var(--rd-text);
}

.v2-dashboard .menu-item svg {
    width: 18px;
    height: 18px;
    color: var(--rd-text-muted);
}

/* User menu overlay */
.v2-dashboard .user-menu-overlay {
    position: fixed;
    inset: 0;
    z-index: 999;
}

/* ========================================
   Content Area
   ======================================== */

.v2-dashboard .dashboard-content {
    flex: 1;
    padding: 1.5rem;
}

/* ========================================
   Responsive
   ======================================== */

@media (max-width: 768px) {
    .v2-dashboard .dashboard-sidebar {
        transform: translateX(-100%);
    }

    .v2-dashboard .dashboard-sidebar.expanded {
        transform: translateX(0);
    }

    .v2-dashboard .sidebar-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .v2-dashboard .dashboard-overlay {
        display: block;
    }

    .v2-dashboard .dashboard-main {
        margin-left: 0;
    }

    .v2-dashboard .header-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .v2-dashboard .dashboard-content {
        padding: 1rem;
    }
}

@media (max-width: 480px) {
    .v2-dashboard .dashboard-sidebar {
        width: 100%;
    }

    .v2-dashboard .sidebar-header {
        padding: 0 1rem;
    }

    .v2-dashboard .dashboard-content {
        padding: 0.75rem;
    }
}

/* ========================================
   Nickname Change Modal
   ======================================== */

.nickname-modal-backdrop {
    position: fixed;
    inset: 0;
    background: var(--rd-bg-overlay);
    backdrop-filter: blur(4px);
    z-index: 9998;
    animation: fadeIn 0.2s ease;
}

.nickname-modal-container {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    pointer-events: none;
}

.nickname-modal {
    width: 90%;
    max-width: 400px;
    background: var(--rd-bg-card);
    border: 1px solid var(--rd-border);
    border-radius: var(--rd-radius-xl);
    box-shadow: var(--rd-shadow-xl);
    animation: slideIn 0.25s ease;
    pointer-events: auto;
}

.nickname-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--rd-border-light);
}

.nickname-modal-header h3 {
    margin: 0;
    font-size: var(--rd-font-size-lg);
    font-weight: var(--rd-font-weight-semibold);
    color: var(--rd-text);
}

.nickname-modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: var(--rd-radius-sm);
    color: var(--rd-text-muted);
    cursor: pointer;
    transition: all var(--rd-transition-fast);
}

.nickname-modal-close:hover {
    background: var(--rd-bg-active);
    color: var(--rd-text);
}

.nickname-modal-close svg {
    width: 18px;
    height: 18px;
}

.nickname-modal-body {
    padding: 1.5rem;
}

.nickname-modal-hint {
    margin: 0 0 1.25rem;
    font-size: var(--rd-font-size-sm);
    color: var(--rd-text-muted);
    line-height: var(--rd-line-height-normal);
}

.nickname-modal-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nickname-modal-field label {
    font-size: 0.8125rem;
    font-weight: var(--rd-font-weight-medium);
    color: var(--rd-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.nickname-modal-field input {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: var(--rd-font-size-base);
    font-family: inherit;
    color: var(--rd-text);
    background: var(--rd-bg-input);
    border: 1px solid var(--rd-border);
    border-radius: var(--rd-radius-md);
    outline: none;
    transition: all var(--rd-transition-fast);
}

.nickname-modal-field input::placeholder {
    color: var(--rd-text-disabled);
}

.nickname-modal-field input:hover {
    background: var(--rd-bg-hover);
    border-color: rgba(255, 255, 255, 0.15);
}

.nickname-modal-field input:focus {
    background: var(--rd-bg-active);
    border-color: var(--rd-border-focus);
    box-shadow: 0 0 0 3px rgba(139, 0, 0, 0.15);
}

.nickname-modal-error {
    font-size: 0.8125rem;
    color: var(--rd-danger-light);
}

.nickname-modal-footer {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    padding: 1rem 1.5rem 1.5rem;
}

.nickname-modal-cancel {
    padding: 0.75rem 1.25rem;
    font-size: 0.9375rem;
    font-weight: var(--rd-font-weight-medium);
    font-family: inherit;
    color: var(--rd-text-secondary);
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--rd-radius-md);
    cursor: pointer;
    transition: all var(--rd-transition-fast);
}

.nickname-modal-cancel:hover {
    background: var(--rd-bg-input);
    border-color: rgba(255, 255, 255, 0.25);
    color: var(--rd-text);
}

.nickname-modal-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 0.9375rem;
    font-weight: var(--rd-font-weight-semibold);
    font-family: inherit;
    color: var(--rd-text);
    background: linear-gradient(135deg, var(--rd-primary) 0%, var(--rd-primary-hover) 100%);
    border: none;
    border-radius: var(--rd-radius-md);
    cursor: pointer;
    transition: all var(--rd-transition-fast);
}

.nickname-modal-submit:hover:not(:disabled) {
    box-shadow: 0 4px 12px rgba(139, 0, 0, 0.4);
}

.nickname-modal-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========================================
   Team Page
   ======================================== */

.team-page {
    max-width: var(--rd-content-max-width);
    margin: 0 auto;
}

.team-page .page-title {
    color: var(--rd-text);
    font-weight: var(--rd-font-weight-bold);
}

.team-page .loading-state,
.team-page .empty-state,
.team-page .pending-state {
    min-height: 400px;
}

.team-page .empty-icon,
.team-page .pending-icon {
    width: 80px;
    height: 80px;
    background: rgba(139, 0, 0, 0.15);
    border-radius: var(--rd-radius-full);
}

.team-page .empty-icon .rz-icon,
.team-page .pending-icon .rz-icon {
    font-size: 36px;
    color: var(--rd-primary-light);
}

.team-page .empty-title,
.team-page .pending-card h6 {
    color: var(--rd-text);
    font-weight: var(--rd-font-weight-semibold);
}

.team-page .empty-description,
.team-page .pending-description {
    color: var(--rd-text-secondary);
    max-width: 400px;
}

.team-page .empty-actions {
    width: 100%;
    max-width: 300px;
}

.team-page .pending-card {
    max-width: 500px;
    border: 1px solid var(--rd-border);
}

.team-page .pending-team strong {
    color: var(--rd-primary-light);
}

.team-page .team-card {
    border: 1px solid var(--rd-border);
}

.team-page .team-header {
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--rd-border-light);
}

.team-page .team-name {
    color: var(--rd-text);
    font-weight: var(--rd-font-weight-bold);
}

.team-page .team-status {
    padding: 0.25rem 0.75rem;
    border-radius: var(--rd-radius-full);
    font-size: var(--rd-font-size-xs);
    font-weight: var(--rd-font-weight-semibold);
}

.team-page .team-status.commander {
    background: rgba(139, 0, 0, 0.2);
    color: var(--rd-primary-light);
}

.team-page .team-status.player {
    background: rgba(70, 130, 180, 0.2);
    color: #87CEEB;
}

.team-page .team-info {
    padding: 1rem 0;
    border-bottom: 1px solid var(--rd-border-light);
}

.team-page .info-item {
    padding: 0.5rem 0;
}

.team-page .info-label {
    color: var(--rd-text-muted);
    font-size: var(--rd-font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.team-page .info-value {
    color: var(--rd-text);
    font-weight: var(--rd-font-weight-medium);
}

.team-page .members-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.team-page .member-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: var(--rd-bg-alt);
    border: 1px solid var(--rd-border-light);
    border-radius: var(--rd-radius-md);
    transition: all var(--rd-transition-fast);
}

.team-page .member-card:hover {
    background: var(--rd-bg-hover);
}

.team-page .member-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.team-page .member-avatar {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(139, 0, 0, 0.2);
    border-radius: var(--rd-radius-full);
    color: var(--rd-primary-light);
}

.team-page .member-avatar .rz-icon {
    font-size: 20px;
}

.team-page .member-name {
    color: var(--rd-text);
    font-weight: var(--rd-font-weight-medium);
}

.team-page .member-role {
    color: var(--rd-text-muted);
    font-size: var(--rd-font-size-sm);
}

/* ========================================
   Games Page
   ======================================== */

.games-page {
    max-width: var(--rd-content-max-width);
    margin: 0 auto;
}

.games-page .page-title {
    color: var(--rd-text);
    font-weight: var(--rd-font-weight-bold);
}

.games-page .loading-state,
.games-page .empty-state {
    min-height: 400px;
}

.games-page .empty-icon {
    width: 80px;
    height: 80px;
    background: rgba(139, 0, 0, 0.15);
    border-radius: var(--rd-radius-full);
}

.games-page .empty-icon .rz-icon {
    font-size: 36px;
    color: var(--rd-primary-light);
}

.games-page .empty-title {
    color: var(--rd-text);
    font-weight: var(--rd-font-weight-semibold);
}

.games-page .empty-description {
    color: var(--rd-text-secondary);
    max-width: 400px;
}

/* Games Grid */
.games-page .games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.25rem;
}

/* Game Card */
.games-page .game-card {
    border: 1px solid var(--rd-border);
    transition: all var(--rd-transition-fast);
}

.games-page .game-card:hover {
    border-color: rgba(139, 0, 0, 0.3);
    box-shadow: 0 4px 12px rgba(139, 0, 0, 0.15);
}

.games-page .game-card.game-card-gone {
    opacity: 0.7;
    border-color: var(--rd-border-light);
}

.games-page .game-card.game-card-gone:hover {
    opacity: 1;
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.games-page .game-card.game-card-paid {
    border-color: rgba(34, 139, 34, 0.3);
}

.games-page .game-card.game-card-paid:hover {
    border-color: rgba(34, 139, 34, 0.5);
    box-shadow: 0 4px 12px rgba(34, 139, 34, 0.15);
}

.games-page .game-title {
    color: var(--rd-text);
    font-weight: var(--rd-font-weight-bold);
}

.games-page .game-badge {
    flex-shrink: 0;
}

.games-page .game-badge .rz-icon {
    vertical-align: middle;
}

.games-page .game-info {
    padding: 0.75rem 0;
    border-top: 1px solid var(--rd-border-light);
    border-bottom: 1px solid var(--rd-border-light);
}

.games-page .info-text {
    color: var(--rd-text-secondary);
}

.games-page .warning-text {
    color: var(--rd-warning);
}

/* Series Groups */
.games-page .game-series-group {
    margin-bottom: 1.5rem;
}

.games-page .game-series-group:last-child {
    margin-bottom: 0;
}

.games-page .series-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-bottom: 0.75rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--rd-border-light);
}

.games-page .series-name {
    font-size: var(--rd-font-size-base);
    font-weight: var(--rd-font-weight-semibold);
    color: var(--rd-text);
}

.games-page .series-count {
    font-size: var(--rd-font-size-sm);
    color: var(--rd-text-muted);
}

/* Completed Toggle */
.games-page .completed-toggle {
    flex-shrink: 0;
}

.games-page .toggle-label {
    color: var(--rd-text-secondary);
    white-space: nowrap;
}

/* Buy Dialog */
.v2-dialog .game-info-card {
    padding: 1rem;
}

.v2-dialog .game-name {
    color: var(--rd-text);
    font-weight: var(--rd-font-weight-bold);
}

.v2-dialog .info-label {
    color: var(--rd-text-muted);
    font-size: var(--rd-font-size-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Responsive */
@media (max-width: 768px) {
    .games-page .games-grid {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 769px) and (max-width: 1024px) {
    .games-page .games-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
