/**
 * Basketball Court Styles
 *
 * Court markings, tokens, and layout specific to basketball.
 * Reuses tokens.css and base.css for consistent theme.
 */

/* ================================ */
/* PAGE LAYOUT                      */
/* ================================ */
.bball-app {
    display: grid;
    grid-template-rows: auto auto 1fr;
    grid-template-areas:
        "header"
        "nav"
        "court";
    height: 100%;
    width: 100%;
}

/* ================================ */
/* HEADER                           */
/* ================================ */
.bball-header {
    grid-area: header;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-6);
    padding: var(--space-3);
    background: var(--color-bg-header);
    border-bottom: var(--border-width) solid var(--color-border);
}

.bball-score-team {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-1);
}

.bball-team-label {
    font-size: var(--text-sm);
    font-weight: 600;
    text-transform: uppercase;
}

.bball-team-label.home {
    color: var(--color-home);
}

.bball-team-label.away {
    color: var(--color-away);
}

.bball-score-controls {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.bball-score-btn {
    width: 28px;
    height: 28px;
    font-size: var(--text-lg);
    font-weight: 600;
    background: var(--color-bg-header);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bball-score-btn:hover {
    background: var(--alpha-hover);
}

.bball-score-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.bball-score-display {
    font-size: var(--text-2xl);
    font-weight: 700;
    min-width: 32px;
    text-align: center;
}

.bball-score-divider {
    font-size: var(--text-2xl);
    font-weight: 700;
    color: var(--color-text-muted);
}

/* ================================ */
/* NAVIGATION BAR                   */
/* ================================ */
.bball-nav {
    grid-area: nav;
    background: var(--color-bg-primary);
    border-bottom: var(--border-width) solid var(--color-border);
    padding: var(--space-2) var(--space-4);
}

.bball-nav ul {
    display: flex;
    gap: var(--space-4);
    list-style: none;
    margin: 0;
    padding: 0;
    justify-content: center;
}

.bball-nav a {
    color: var(--color-text-muted);
    text-decoration: none;
    font-size: var(--text-sm);
    font-weight: 500;
    padding: var(--space-1) 0;
    transition: var(--transition-fast);
}

.bball-nav a:hover,
.bball-nav a:focus-visible {
    color: var(--color-text);
}

.bball-nav a.active {
    color: var(--color-text);
}

/* ================================ */
/* COURT WRAPPER                    */
/* ================================ */
.court-wrapper {
    grid-area: court;
    background: #111;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-2);
    overflow: hidden;
}

/* ================================ */
/* COURT                            */
/* ================================ */
.court {
    position: relative;
    width: 100%;
    max-width: 940px;
    aspect-ratio: 94 / 50;
    background: #bf6a2e;
    border: 3px solid #e0a060;
    border-radius: var(--radius-md);
    overflow: hidden;
}

/* ================================ */
/* COURT MARKINGS                   */
/* ================================ */
.court-marking {
    position: absolute;
    pointer-events: none;
}

/* Center circle */
.court-center-circle {
    width: 12.8%;
    height: 24%;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 50%;
}

/* Center line */
.court-center-line {
    width: 2px;
    height: 100%;
    left: 50%;
    top: 0;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.5);
}

/* Key / paint area (left) */
.court-key.left {
    width: 19.1%;
    height: 40%;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-left: none;
    background: rgba(229, 57, 53, 0.15);
}

/* Key / paint area (right) */
.court-key.right {
    width: 19.1%;
    height: 40%;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-right: none;
    background: rgba(25, 118, 210, 0.15);
}

/* Free throw circle — left */
.court-ft-circle.left {
    width: 12.8%;
    height: 24%;
    left: 19.1%;
    top: 50%;
    transform: translate(-50%, -50%);
    border: 2px dashed rgba(255, 255, 255, 0.35);
    border-radius: 50%;
}

/* Free throw circle — right */
.court-ft-circle.right {
    width: 12.8%;
    height: 24%;
    right: 19.1%;
    top: 50%;
    transform: translate(50%, -50%);
    border: 2px dashed rgba(255, 255, 255, 0.35);
    border-radius: 50%;
}

/* Three-point arc — left */
.court-three-pt.left {
    width: 28.7%;
    height: 72%;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-left: none;
    border-radius: 0 50% 50% 0;
}

/* Three-point arc — right */
.court-three-pt.right {
    width: 28.7%;
    height: 72%;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-right: none;
    border-radius: 50% 0 0 50%;
}

/* Backboard & rim — left */
.court-rim.left {
    width: 0.8%;
    height: 8%;
    left: 5.3%;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.6);
    border-radius: 0 2px 2px 0;
}

/* Backboard & rim — right */
.court-rim.right {
    width: 0.8%;
    height: 8%;
    right: 5.3%;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.6);
    border-radius: 2px 0 0 2px;
}

/* ================================ */
/* TOKENS                           */
/* ================================ */
.bball-token {
    position: absolute;
    width: var(--token-size);
    height: var(--token-size);
    transform: translate(-50%, -50%);
    border-radius: 50%;
    cursor: grab;
    user-select: none;
    touch-action: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--token-font-size);
    font-weight: 700;
    color: white;
    box-shadow: var(--shadow-token);
    transition: box-shadow var(--transition-fast), transform var(--transition-fast);
    z-index: var(--z-token);
}

.bball-token.home {
    background: var(--color-home);
    border: 3px solid rgba(255, 255, 255, 0.3);
}

.bball-token.away {
    background: var(--color-away);
    border: 3px solid rgba(255, 255, 255, 0.3);
}

.bball-token.ball {
    background: #ff8c00;
    font-size: 20px;
    border: 2px solid #a05500;
}

.bball-token.selected {
    box-shadow: var(--shadow-token-focus);
    transform: translate(-50%, -50%) scale(1.1);
    z-index: var(--z-token-dragging);
}

.bball-token.dragging {
    cursor: grabbing;
    box-shadow: var(--shadow-token-drag);
    z-index: var(--z-token-dragging);
}

/* ================================ */
/* CONTROLS BAR                     */
/* ================================ */
.bball-controls {
    position: absolute;
    bottom: var(--space-2);
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: var(--space-1);
    z-index: 20;
}

.bball-ctrl-btn {
    padding: var(--space-1) var(--space-2);
    font-size: var(--text-xs);
    font-weight: 600;
    background: rgba(0, 0, 0, 0.6);
    color: var(--color-text);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-sm);
    cursor: pointer;
    backdrop-filter: blur(4px);
    transition: var(--transition-fast);
}

.bball-ctrl-btn:hover {
    background: rgba(0, 0, 0, 0.8);
    border-color: rgba(255, 255, 255, 0.4);
}

/* ================================ */
/* RESPONSIVE                       */
/* ================================ */
@media (max-width: 768px) {
    .bball-header {
        padding: var(--space-2);
        gap: var(--space-4);
    }

    .bball-nav {
        padding: var(--space-1) var(--space-3);
    }

    .court-wrapper {
        padding: var(--space-1);
    }
}

@media (max-width: 480px) {
    .bball-score-display {
        font-size: var(--text-lg);
    }

    .bball-team-label {
        font-size: var(--text-xs);
    }

    .bball-controls {
        bottom: var(--space-1);
    }
}
