/* ============================================================
   Review Board — Layout
   App chrome: topbar, toolbar, canvas viewport, sidebar
   ============================================================ */

/* ---- App Shell ---- */
#app {
    display: flex;
    flex-direction: column;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background: var(--rb-bg-app);
}

/* ---- Top Bar ---- */
#topbar {
    position: relative;
    z-index: var(--rb-z-topbar);
    display: flex;
    align-items: center;
    height: 48px;
    min-height: 48px;
    padding: 0 16px;
    background: var(--rb-bg-surface);
    border-bottom: 1px solid var(--rb-border-subtle);
    gap: 12px;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

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

.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    justify-content: flex-end;
}

#back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--rb-text-secondary);
    cursor: pointer;
    border-radius: var(--rb-radius-sm);
    transition: background var(--rb-transition), color var(--rb-transition);
    font-size: 18px;
}

#back-btn:hover {
    background: var(--rb-bg-hover);
    color: var(--rb-text-primary);
}

#board-name {
    font-size: var(--rb-font-size-lg);
    font-weight: 600;
    color: var(--rb-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
}

#zoom-display {
    font-size: var(--rb-font-size-sm);
    color: var(--rb-text-secondary);
    font-family: var(--rb-font-mono);
    min-width: 48px;
    text-align: center;
    padding: 4px 8px;
    background: var(--rb-bg-elevated);
    border-radius: var(--rb-radius-sm);
    user-select: none;
}

.topbar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--rb-text-secondary);
    cursor: pointer;
    border-radius: var(--rb-radius-sm);
    transition: background var(--rb-transition), color var(--rb-transition);
    font-size: 16px;
}

.topbar-btn:hover {
    background: var(--rb-bg-hover);
    color: var(--rb-text-primary);
}

/* ---- Main Area ---- */
#main-area {
    display: flex;
    flex: 1;
    min-height: 0;
    position: relative;
}

/* ---- Toolbar ---- */
#toolbar {
    position: relative;
    z-index: var(--rb-z-toolbar);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 48px;
    min-width: 48px;
    padding: 8px 0;
    background: var(--rb-bg-surface);
    border-right: 1px solid var(--rb-border-subtle);
    gap: 4px;
    transition: width 0.2s ease, min-width 0.2s ease;
    overflow: hidden; /* Clips labels when collapsed */
}

#toolbar:not(.expanded) .tool-btn {
    justify-content: center;
}

/* Expanded toolbar — shows labels */
#toolbar.expanded {
    width: 180px;
    min-width: 180px;
    align-items: stretch;
    padding: 8px 4px;
}

/* ---- Canvas Viewport ---- */
#canvas-viewport {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: var(--rb-bg-canvas);
    z-index: var(--rb-z-canvas);
}

/* ---- Sidebar ---- */
#sidebar {
    position: relative;
    z-index: var(--rb-z-sidebar);
    width: 0;
    min-width: 0;
    overflow: hidden;
    background: var(--rb-bg-surface);
    border-left: 1px solid var(--rb-border-subtle);
    transition: width 0.2s ease, min-width 0.2s ease;
}

#sidebar.open {
    width: 280px;
    min-width: 280px;
}

#sidebar-content {
    width: 280px;
    padding: 16px;
}

/* ---- User Menu ---- */
.rb-user-menu {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    padding: 4px 8px;
}
.rb-user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
}
.rb-user-name {
    font-size: 13px;
    color: var(--rb-text-secondary);
}
.rb-user-logout {
    background: none;
    border: none;
    color: var(--rb-text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
}
.rb-user-logout:hover {
    color: var(--rb-text-primary);
    background: var(--rb-bg-hover);
}

/* ---- Board List Page ---- */
#board-list-page {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100vh;
    overflow: auto;
    background: var(--rb-bg-app);
}

.board-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 32px 48px 24px;
    border-bottom: 1px solid var(--rb-border-subtle);
}

.board-list-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--rb-text-primary);
    letter-spacing: -0.5px;
}

.board-list-header .subtitle {
    font-size: var(--rb-font-size-sm);
    color: var(--rb-text-muted);
    margin-top: 4px;
}

.board-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    padding: 32px 48px;
}

.board-card {
    background: var(--rb-bg-surface);
    border: 1px solid var(--rb-border);
    border-radius: var(--rb-radius-md);
    overflow: hidden;
    cursor: pointer;
    transition: border-color var(--rb-transition), box-shadow var(--rb-transition), transform var(--rb-transition);
}

.board-card:hover {
    border-color: var(--rb-accent);
    box-shadow: var(--rb-shadow-md);
    transform: translateY(-2px);
}

.board-card-preview {
    height: 140px;
    background: var(--rb-bg-elevated);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--rb-text-muted);
    font-size: 32px;
    position: relative;
    overflow: hidden;
}

.board-card-preview .dot-grid {
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle, var(--rb-border) 1px, transparent 1px);
    background-size: 20px 20px;
    opacity: 0.5;
}

.board-card-body {
    padding: 16px;
}

.board-card-name {
    font-size: var(--rb-font-size-md);
    font-weight: 600;
    color: var(--rb-text-primary);
    margin-bottom: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.board-card-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: var(--rb-font-size-sm);
    color: var(--rb-text-muted);
}

.board-card-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity var(--rb-transition);
}

.board-card:hover .board-card-actions {
    opacity: 1;
}

.board-card-action {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--rb-text-muted);
    cursor: pointer;
    border-radius: var(--rb-radius-sm);
    transition: background var(--rb-transition), color var(--rb-transition);
    font-size: 14px;
}

.board-card-action:hover {
    background: var(--rb-bg-hover);
    color: var(--rb-text-primary);
}

.board-card-action.danger:hover {
    color: var(--rb-error);
}

/* New board card */
.board-card.new-board {
    border-style: dashed;
    border-color: var(--rb-border);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 220px;
    gap: 12px;
    color: var(--rb-text-muted);
    transition: border-color var(--rb-transition), color var(--rb-transition);
}

.board-card.new-board:hover {
    border-color: var(--rb-accent);
    color: var(--rb-accent);
    transform: translateY(-2px);
}

.board-card.new-board .plus-icon {
    font-size: 36px;
    line-height: 1;
}

.board-card.new-board span {
    font-size: var(--rb-font-size-md);
    font-weight: 500;
}

/* Empty state */
.board-list-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 48px;
    color: var(--rb-text-muted);
    text-align: center;
}

.board-list-empty .icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.board-list-empty p {
    font-size: var(--rb-font-size-md);
    max-width: 400px;
    line-height: 1.6;
}
