/* Playmaker Premium Theme - Nano Banana Style */
:root {
    --bg-app: #1a1f2e;
    --bg-panel: #151923;
    --bg-input: #232730;
    --border-subtle: rgba(255, 255, 255, 0.08);
    --accent-blue: #2563eb;
    --accent-green: #2d7a3e;
    --accent-orange: #f97316;
    --accent-red: #ef4444;
    --text-main: #ffffff;
    --text-muted: #9ca3af;
    --font-ui: 'Rajdhani', 'Saira Condensed', system-ui, sans-serif;
    --font-display: 'Saira Condensed', 'Rajdhani', system-ui, sans-serif;
    --radius-md: 12px;
    --radius-sm: 8px;
}

* {
    box-sizing: border-box;
    user-select: none;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-app);
    color: var(--text-main);
    font-family: var(--font-ui);
    overflow: hidden;
}

.pm-container {
    display: grid;
    grid-template-columns: 340px 1fr;
    height: 100vh; /* fallback */
    height: 100dvh; /* dynamic viewport height - accounts for browser chrome */
    width: 100vw;
}

.pm-sidebar-left {
    background: var(--bg-panel);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    padding: 20px;
    gap: 24px;
    overflow-y: auto;
}

.pm-sidebar-header {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn-back {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: var(--font-ui);
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    text-transform: uppercase;
}

.btn-back:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

/* Back Button with Glow Effect - More visible for coaches */
.btn-back-glow {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2) 0%, rgba(59, 130, 246, 0.1) 100%);
    border: 2px solid rgba(59, 130, 246, 0.5);
    color: #93c5fd;
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.3), 0 0 30px rgba(59, 130, 246, 0.15);
    animation: back-btn-pulse 2s ease-in-out infinite;
}

.btn-back-glow:hover {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.3) 0%, rgba(59, 130, 246, 0.2) 100%);
    border-color: rgba(59, 130, 246, 0.8);
    color: white;
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.5), 0 0 40px rgba(59, 130, 246, 0.25);
}

@keyframes back-btn-pulse {
    0%, 100% {
        box-shadow: 0 0 15px rgba(59, 130, 246, 0.3), 0 0 30px rgba(59, 130, 246, 0.15);
    }
    50% {
        box-shadow: 0 0 20px rgba(59, 130, 246, 0.5), 0 0 40px rgba(59, 130, 246, 0.25);
    }
}

.header-buttons-row {
    display: flex;
    gap: 8px;
}

.header-buttons-row .btn-back {
    flex: 1;
    width: 100%;
}

/* AI Actions Row - 50/50 split for AI Import and AI Analyze */
.ai-actions-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.ai-actions-row .btn-ai-import {
    flex: none;
    width: 100%;
}

.ai-actions-row .btn-sidebar-action {
    flex-direction: row;
    padding: 8px 12px;
}

.btn-ai-import {
    flex: 1;
    position: relative;
    background: linear-gradient(135deg, #166534 0%, #22c55e 40%, #86efac 70%, #fbbf24 100%);
    background-size: 200% 200%;
    border: none;
    color: white;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: var(--font-ui);
    font-weight: 700;
    font-size: 14px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    text-transform: uppercase;
    animation: ai-gradient-shift 3s ease infinite;
    box-shadow: 0 0 20px rgba(34, 197, 94, 0.5);
    overflow: hidden;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.btn-ai-import::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 30%,
        rgba(255, 255, 255, 0.4) 50%,
        transparent 70%
    );
    transform: rotate(45deg);
    animation: ai-shimmer 2s infinite;
}

.btn-ai-import:hover {
    transform: scale(1.02);
    box-shadow: 0 0 30px rgba(34, 197, 94, 0.7), 0 0 60px rgba(134, 239, 172, 0.4);
}

.btn-ai-import i {
    width: 16px;
    height: 16px;
    animation: ai-sparkle 1.5s ease-in-out infinite;
}

@keyframes ai-gradient-shift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

@keyframes ai-shimmer {
    0% { transform: translateX(-100%) rotate(45deg); }
    100% { transform: translateX(100%) rotate(45deg); }
}

@keyframes ai-sparkle {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.1); }
}

.logo-text {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 20px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sidebar-logo {
    width: 100%;
    height: auto;
    padding: 15px;
    box-sizing: border-box;
}

.game-mode-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.game-mode-row .pm-section-title {
    margin-bottom: 0;
    white-space: nowrap;
}

.game-mode-row .mode-chips {
    display: flex;
    gap: 6px;
}

.pm-section-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.mode-chips {
    display: flex;
    gap: 8px;
}

.chip-mode {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
}

.chip-mode:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    color: white;
}

.chip-mode.active {
    background: var(--gc-accent-primary);
    border-color: var(--gc-accent-primary);
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.4);
}

.player-tokens-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.player-token {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 18px;
    cursor: grab;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    user-select: none;
    transition: transform 0.1s;
    border: 2px solid rgba(255, 255, 255, 0.2);
    font-family: var(--font-display);
}

.player-token:active {
    cursor: grabbing;
    transform: scale(1.1);
}

.player-token:hover {
    transform: scale(1.1);
}

.route-tools-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.btn-tool {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-subtle);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
    font-family: var(--font-ui);
}

.btn-tool:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
}

.btn-tool.active {
    background: rgba(37, 99, 235, 0.15);
    border-color: var(--accent-blue);
    color: white;
}

/* Edit tool buttons (route/select) - same styling as btn-tool */
.btn-edit-tool {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-subtle);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s;
    font-family: var(--font-ui);
}

.btn-edit-tool:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
}

.btn-edit-tool.active {
    background: rgba(37, 99, 235, 0.15);
    border-color: var(--accent-blue);
    color: white;
}

.edit-tools-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}

.route-color-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.btn-color {
    padding: 10px 8px;
    border-radius: var(--radius-sm);
    border: 2px solid transparent;
    font-weight: 700;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    font-family: var(--font-ui);
}

.btn-color:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.btn-color.active {
    border-color: #fff;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
}

.pm-center-panel {
    display: flex;
    flex-direction: column;
    height: 100vh; /* fallback */
    height: 100dvh; /* dynamic viewport height */
    overflow: hidden;
}

.pm-controls-bar {
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border-subtle);
    padding: 12px 20px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 20px;
    min-height: 80px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.controls-divider {
    width: 1px;
    height: 40px;
    background: var(--border-subtle);
    flex-shrink: 0;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.control-group label {
    font-size: 14px;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.8px;
}

.control-group input {
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    color: white;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-family: var(--font-ui);
    font-size: 14px;
    width: 200px;
}

.formation-chips,
.situation-chips,
.qb-position-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip-neutral {
    background: #4b5563;
    border: 1px solid transparent;
    color: white;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.5px;
}

.chip-neutral:hover {
    background: #6b7280;
}

.chip-neutral.active {
    background: #f3f4f6;
    color: #111827;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* Formation chips - green selected state */
.formation-chips-inline .chip-neutral.active,
.formation-chips .chip-neutral.active,
#formationChipsInline .chip-neutral.active {
    background: #22c55e;
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.4);
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.4);
}

/* Situation chips - gold selected state */
.situation-chips-inline .chip-neutral.active,
.situation-chips .chip-neutral.active,
#situationChipsInline .chip-neutral.active {
    background: #f59e0b;
    color: #111827;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
}

/* QB Position keeps default white/neutral - no override needed */

.chip-add {
    background: rgba(255, 255, 255, 0.05);
    border: 1px dashed var(--border-subtle);
    color: var(--text-muted);
    padding: 8px 12px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    height: 34px;
}

.chip-add:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-color: white;
}

.btn-icon {
    background: #4b5563;
    border: 1px solid transparent;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: #6b7280;
    transform: translateY(-1px);
}

.pm-canvas-area {
    background-color: #1a1f2e;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    flex-grow: 1;
    height: 0;
    padding: 20px;
}

.pm-canvas-area::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60%;
    height: 60%;
    background-image: url('../assets/img/gridiron-command-logo.webp');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.1;
    pointer-events: none;
    z-index: 0;
}

.canvas-wrapper {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: calc((100vh - 220px) * 16 / 10); /* fallback */
    max-width: calc((100dvh - 220px) * 16 / 10); /* 16:10 ratio based on available height */
    aspect-ratio: 16 / 10;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    border-radius: 8px;
    overflow: visible; /* Allow save bar to show below */
}

/* Save bar fixed at bottom of canvas */
.canvas-save-bar {
    position: absolute;
    bottom: -80px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    background: #1a1f2e;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    z-index: 100;
}

.canvas-save-bar .btn-save-play,
.canvas-save-bar .btn-save-new,
.canvas-save-bar .btn-save-formation,
.canvas-save-bar .btn-export {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 28px;
    border: none;
    border-radius: 10px;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    font-size: 15px;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

/* Compact flip button */
.canvas-save-bar .btn-flip {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 14px 16px;
    border: none;
    border-radius: 10px;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    background: #f59e0b;
    color: white;
}

.canvas-save-bar .btn-flip:hover {
    background: #d97706;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

.canvas-save-bar .btn-flip i,
.canvas-save-bar .btn-flip svg {
    width: 16px;
    height: 16px;
}

.canvas-save-bar .btn-save-play {
    background: #22c55e;
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.4);
}

.canvas-save-bar .btn-save-play:hover {
    background: #16a34a;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
}

.canvas-save-bar .btn-save-new {
    background: #3b82f6;
    color: white;
}

.canvas-save-bar .btn-save-new:hover {
    background: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.canvas-save-bar .btn-save-formation {
    background: #8b5cf6;
    color: white;
}

.canvas-save-bar .btn-save-formation:hover {
    background: #7c3aed;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.4);
}

.canvas-save-bar .btn-export {
    background: #2d3548;
    color: #94a3b8;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.canvas-save-bar .btn-export:hover {
    background: #3d4558;
    color: white;
    transform: translateY(-2px);
}

.canvas-save-bar i,
.canvas-save-bar svg {
    width: 18px;
    height: 18px;
}

canvas {
    width: 100%;
    height: 100%;
    background: transparent;
    cursor: crosshair;
    display: block;
}

.canvas-overlay-label {
    position: absolute;
    top: 60%;
    left: 10px;
    color: rgba(59, 130, 246, 1);
    font-weight: bold;
    font-size: 14px;
    pointer-events: none;
}

.pm-bottom-bar {
    background: var(--bg-panel);
    border-top: 1px solid var(--border-subtle);
    padding: 16px 20px;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 20px;
    height: 140px;
    flex-shrink: 0;
}

.notes-input-container {
    flex-grow: 1;
}

.notes-input-container textarea {
    width: 100%;
    height: 100px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    color: white;
    padding: 12px;
    border-radius: var(--radius-sm);
    font-family: var(--font-ui);
    font-size: 14px;
    resize: none;
}

.action-buttons {
    display: flex;
    gap: 10px;
}

.btn-action {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    border: none;
    font-weight: 700;
    cursor: pointer;
    text-transform: uppercase;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
    font-family: var(--font-display);
}

.btn-action.primary {
    background: var(--accent-green);
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.4);
}

.btn-action.secondary {
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
}

.btn-action.danger {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-action:hover {
    transform: translateY(-2px);
}

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal-backdrop.active {
    display: flex;
}

.nano-modal {
    width: 500px;
    background: #1e2229;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-subtle);
}

.modal-top-bar {
    background: #2a2e36;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 18px;
    font-weight: 700;
    color: white;
}

.modal-close {
    cursor: pointer;
    font-size: 18px;
    color: var(--text-muted);
}

.modal-close:hover {
    color: white;
}

.modal-body {
    padding: 20px;
}

.modal-input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    color: white;
    padding: 12px;
    border-radius: var(--radius-sm);
    font-family: var(--font-ui);
    font-size: 16px;
}

.modal-footer {
    padding: 0 20px 20px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.btn-primary {
    background: var(--accent-green);
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.4);
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    border: none;
    font-weight: 700;
    cursor: pointer;
    text-transform: uppercase;
}

.btn-secondary {
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    text-transform: uppercase;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.spin {
    animation: spin 1s linear infinite;
    display: inline-block;
}

/* Route Toggle Buttons */
.route-toggles {
    display: flex;
    gap: 8px;
}

.btn-toggle {
    flex: 1;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-subtle);
    padding: 10px 8px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.2s;
    font-family: var(--font-ui);
}

.btn-toggle:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
}

.btn-toggle.active {
    background: rgba(37, 99, 235, 0.15);
    border-color: var(--accent-blue);
    color: white;
}

.btn-toggle i,
.btn-toggle svg {
    width: 20px;
    height: 20px;
}

.btn-toggle.field-toggle {
    flex: none;
    width: 100%;
}

.btn-toggle.field-toggle.active {
    background: rgba(34, 197, 94, 0.15);
    border-color: #22c55e;
    color: #22c55e;
}

/* Play Animation Button */
.btn-action.play {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.4);
    border: none;
}

.btn-action.play:hover {
    background: linear-gradient(135deg, #16a34a, #15803d);
}

.btn-action.play:disabled {
    background: #4b5563;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Animation Progress Bar */
.animation-progress-container {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 24px;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    z-index: 10;
}

.animation-progress-container.active {
    display: flex;
}

.animation-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #22c55e, #16a34a);
    transition: width 0.05s linear;
}

.animation-progress-label {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 14px;
    font-weight: 700;
    color: white;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* ========================================
   NEW REDESIGN STYLES
   ======================================== */

/* Field Style Buttons */
.field-style-buttons {
    display: flex;
    gap: 8px;
}

.field-style-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 8px;
    background: var(--bg-input);
    border: 2px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.field-style-btn:hover {
    border-color: var(--text-muted);
}

.field-style-btn.active {
    border-color: var(--accent-green);
    background: rgba(34, 197, 94, 0.1);
}

.field-style-btn span {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.field-style-btn.active span {
    color: var(--accent-green);
}

/* Field Preview Mini Canvas */
.field-preview {
    width: 100%;
    height: 40px;
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

.field-preview .preview-lines {
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 7px,
        rgba(255,255,255,0.3) 7px,
        rgba(255,255,255,0.3) 8px
    );
}

/* Turf Preview - Green grass */
.turf-preview {
    background: linear-gradient(to bottom, #2d5a27 0%, #3d7a37 50%, #2d5a27 100%);
}

/* Gridiron Preview - Dark mode */
.gridiron-preview {
    background: linear-gradient(to bottom, #1a1f2e 0%, #252b3d 50%, #1a1f2e 100%);
}

.gridiron-preview .preview-lines {
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 7px,
        rgba(255,255,255,0.15) 7px,
        rgba(255,255,255,0.15) 8px
    );
}

/* Print Preview - White for printing */
.print-preview {
    background: #ffffff;
    border: 1px solid #ddd;
}

.print-preview .preview-lines {
    background: repeating-linear-gradient(
        to bottom,
        transparent 0px,
        transparent 7px,
        rgba(0,0,0,0.2) 7px,
        rgba(0,0,0,0.2) 8px
    );
}

/* Player Display Buttons */
.player-display-buttons {
    display: flex;
    gap: 8px;
}

.player-display-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 4px;
    background: var(--bg-input);
    border: 2px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--text-muted);
}

.player-display-btn:hover {
    border-color: var(--text-muted);
}

.player-display-btn.active {
    border-color: var(--accent-green);
    background: rgba(34, 197, 94, 0.1);
    color: var(--accent-green);
}

.player-display-btn span {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Sidebar Input */
.sidebar-input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    color: white;
    padding: 12px;
    border-radius: var(--radius-sm);
    font-family: var(--font-ui);
    font-size: 14px;
    font-weight: 500;
}

.sidebar-input:focus {
    outline: none;
    border-color: var(--accent-green);
}

/* Sidebar Select Dropdown */
.sidebar-select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    cursor: pointer;
}

.sidebar-select:hover {
    border-color: var(--accent-green);
}

.sidebar-select option {
    background: var(--bg-panel);
    color: white;
    padding: 8px;
}

.sidebar-select option:disabled {
    color: var(--text-muted);
}

/* Playbook Multi-Select Dropdown */
.playbook-multiselect {
    position: relative;
}

.playbook-multiselect-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    color: white;
    padding: 12px;
    border-radius: var(--radius-sm);
    font-family: var(--font-ui);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: border-color 0.15s ease;
}

.playbook-multiselect-trigger:hover {
    border-color: var(--accent-green);
}

.playbook-multiselect.open .playbook-multiselect-trigger {
    border-color: var(--accent-green);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
}

.playbook-multiselect-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.playbook-chevron {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.playbook-multiselect.open .playbook-chevron {
    transform: rotate(180deg);
}

.playbook-multiselect-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-panel);
    border: 1px solid var(--accent-green);
    border-top: none;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    z-index: 100;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.playbook-multiselect.open .playbook-multiselect-dropdown {
    display: block;
}

.playbook-checkbox-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 200px;
    overflow-y: auto;
    padding: 6px;
}

/* Legacy container - keep for backwards compat */
.playbook-checkbox-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 160px;
    overflow-y: auto;
    padding: 8px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
}

/* Playbook Selector (legacy - keep for reference) */
.playbook-selector {
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 140px;
    overflow-y: auto;
    padding: 8px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
}

.playbook-loading {
    color: var(--text-muted);
    font-size: 14px;
    padding: 8px;
    text-align: center;
}

.playbook-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
}

.playbook-option:hover {
    background: rgba(255, 255, 255, 0.05);
}

.playbook-option.selected {
    background: rgba(34, 197, 94, 0.15);
    border-color: var(--accent-green);
}

.playbook-option input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent-green);
    cursor: pointer;
}

.playbook-option .playbook-name {
    flex: 1;
    font-size: 14px;
    color: var(--text-main);
}

.playbook-create-new {
    border-top: 1px solid var(--border-subtle);
    margin-top: 4px;
    padding-top: 10px;
    padding-bottom: 10px;
    justify-content: center;
    background: rgba(34, 197, 94, 0.1);
}

.playbook-create-new:hover {
    background: rgba(34, 197, 94, 0.2);
}

.playbook-create-new span {
    font-weight: 600;
    color: white;
}

.playbook-option-label {
    flex: 1;
    font-size: 14px;
    color: var(--text-main);
}

.playbook-option-badge {
    font-size: 14px;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
    font-weight: 600;
}

.playbook-option-badge.system {
    background: rgba(168, 85, 247, 0.2);
    color: #a855f7;
}

/* Sidebar Reads & Keys */
.sidebar-reads-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sidebar-read-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-read-label {
    display: flex;
    align-items: center;
}

.read-badge {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 10px;
    border-radius: 4px;
    font-family: var(--font-display);
}

.read-badge.primary {
    background: #22c55e;
    color: #0a2610;
}

.read-badge.check {
    background: #3b82f6;
    color: #0a1628;
}

.read-badge.bestvs {
    background: #f59e0b;
    color: #2a1a02;
}

.sidebar-read-field .sidebar-input {
    font-size: 14px;
    padding: 10px 12px;
    outline: none;
}

.sidebar-read-field .sidebar-input:focus {
    border-color: rgba(34, 197, 94, 0.5);
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.15);
}

/* Sidebar Notes */
.sidebar-notes-container {
    min-height: 60px;
    margin-bottom: 20px;
    padding-bottom: 20px;
}

.sidebar-notes-container textarea {
    width: 100%;
    min-height: 160px;
    max-height: none; /* No limit - notes is at bottom of sidebar */
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    color: white;
    padding: 12px;
    border-radius: var(--radius-sm);
    font-family: var(--font-ui);
    font-size: 14px;
    resize: vertical;
    box-sizing: border-box;
    outline: none;
}

.sidebar-notes-container textarea:focus {
    border-color: rgba(34, 197, 94, 0.5);
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.15);
}

/* Sidebar Actions */
.sidebar-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
}

.btn-sidebar-action {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-subtle);
    padding: 8px 4px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    transition: all 0.2s;
    font-family: var(--font-ui);
}

.btn-sidebar-action:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
    transform: translateY(-2px);
}

.btn-sidebar-action i,
.btn-sidebar-action svg {
    width: 18px;
    height: 18px;
}

/* AI Analyze Button - Special Styling */
.btn-ai-analyze {
    position: relative;
    background: linear-gradient(135deg, #0d4a4a 0%, #0d9488 40%, #5eead4 70%, #a5f3fc 100%) !important;
    background-size: 200% 200%;
    border: none !important;
    color: white !important;
    animation: ai-gradient-shift 3s ease infinite;
    box-shadow: 0 0 15px rgba(13, 148, 136, 0.4);
    overflow: hidden;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.btn-ai-analyze::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(
        45deg,
        transparent 30%,
        rgba(255, 255, 255, 0.3) 50%,
        transparent 70%
    );
    transform: rotate(45deg);
    animation: ai-shimmer 2s infinite;
}

.btn-ai-analyze:hover {
    transform: translateY(-2px) scale(1.02) !important;
    box-shadow: 0 0 25px rgba(13, 148, 136, 0.6), 0 0 50px rgba(94, 234, 212, 0.3);
}

.btn-ai-analyze i,
.btn-ai-analyze svg {
    animation: ai-sparkle 1.5s ease-in-out infinite;
}

/* Sticky Save Button */
.sidebar-save-container {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-subtle);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.sidebar-save-container button {
    white-space: nowrap;
}

.sidebar-save-container .btn-export {
    grid-column: 1 / -1;
}

.btn-save-play {
    flex: 1;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    border: none;
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.4);
    padding: 14px 8px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s;
    font-family: var(--font-display);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-save-play:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(34, 197, 94, 0.3);
}

.btn-save-play i,
.btn-save-play svg {
    width: 16px;
    height: 16px;
}

.btn-save-new {
    flex: 1;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    border: none;
    color: white;
    padding: 14px 8px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s;
    font-family: var(--font-display);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-save-new:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.3);
}

.btn-save-new i,
.btn-save-new svg {
    width: 16px;
    height: 16px;
}

.btn-export {
    flex: 1;
    background: linear-gradient(135deg, #6b7280, #4b5563);
    border: none;
    color: white;
    padding: 14px 8px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s;
    font-family: var(--font-display);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-export:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(107, 114, 128, 0.3);
}

.btn-export i,
.btn-export svg {
    width: 16px;
    height: 16px;
}

/* Chips with More Button */
.chips-with-more {
    display: flex;
    align-items: center;
    gap: 8px;
}

.formation-chips-inline,
.situation-chips-inline,
.alignment-chips-inline,
.defense-situation-chips-inline {
    display: flex;
    gap: 6px;
    flex-wrap: nowrap;
}

.btn-more {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
}

.btn-more:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.btn-more i,
.btn-more svg {
    width: 16px;
    height: 16px;
}

/* Play Animation Button (on canvas) */
.btn-play-animation {
    position: absolute;
    top: 12px;
    right: 12px;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    border: none;
    color: white;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 5;
}

.btn-play-animation:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(34, 197, 94, 0.4);
}

.btn-play-animation i,
.btn-play-animation svg {
    width: 24px;
    height: 24px;
}

/* Floating Tool Palette */
.floating-tool-palette {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    background: rgba(30, 34, 41, 0.95);
    backdrop-filter: blur(8px);
    padding: 0;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    z-index: 100;
    user-select: none;
    touch-action: none;
    overflow: hidden;
}

.floating-tool-palette:active {
    cursor: grabbing;
}

.floating-tool-palette.dragging {
    cursor: grabbing;
    opacity: 0.9;
}

/* Drag handle - prominent touch target */
.palette-drag-handle {
    width: 100%;
    padding: 10px 0 6px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: grab;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    touch-action: none;
}

.palette-drag-handle:active {
    cursor: grabbing;
    background: rgba(255, 255, 255, 0.06);
}

/* Grip dots pattern */
.palette-drag-handle::before {
    content: '';
    width: 44px;
    height: 5px;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.25) 10%,
        rgba(255, 255, 255, 0.25) 15%,
        transparent 15%,
        transparent 25%,
        rgba(255, 255, 255, 0.25) 25%,
        rgba(255, 255, 255, 0.25) 30%,
        transparent 30%,
        transparent 40%,
        rgba(255, 255, 255, 0.25) 40%,
        rgba(255, 255, 255, 0.25) 45%,
        transparent 45%,
        transparent 55%,
        rgba(255, 255, 255, 0.25) 55%,
        rgba(255, 255, 255, 0.25) 60%,
        transparent 60%,
        transparent 70%,
        rgba(255, 255, 255, 0.25) 70%,
        rgba(255, 255, 255, 0.25) 75%,
        transparent 75%,
        transparent 85%,
        rgba(255, 255, 255, 0.25) 85%,
        rgba(255, 255, 255, 0.25) 90%,
        transparent 90%
    );
    border-radius: 3px;
}

/* Tools container */
.palette-tools-row {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 10px 14px 12px 14px;
}

.tool-section {
    display: flex;
    gap: 5px;
}

.tool-section.colors {
    gap: 7px;
}

.tool-divider {
    width: 1px;
    height: 42px;
    background: rgba(255, 255, 255, 0.15);
    margin: 0 7px;
}

.palette-tool {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    padding: 7px 12px;
    border-radius: 9px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    transition: all 0.2s;
    font-family: var(--font-ui);
}

.palette-tool:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
}

.palette-tool.active {
    background: rgba(34, 197, 94, 0.2);
    border-color: rgba(34, 197, 94, 0.4);
    color: #22c55e;
}

.palette-tool.danger:hover {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.palette-tool i,
.palette-tool svg {
    width: 21px;
    height: 21px;
}

.palette-color {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.palette-color:hover {
    transform: scale(1.15);
}

.palette-color.active {
    border-color: white;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.3);
}

/* Color button wrappers with labels */
.palette-color-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.color-label {
    font-size: 0.65rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Chip Selection Modals */
.chip-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.chip-modal-backdrop.active {
    display: flex;
}

.chip-modal {
    width: 500px;
    max-width: 90vw;
    background: #1e2229;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-subtle);
    animation: modalSlideIn 0.2s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chip-modal-header {
    background: #2a2e36;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 16px;
    font-weight: 700;
    color: white;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.chip-modal-body {
    padding: 20px;
}

.modal-hint {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 16px;
    text-align: center;
}

.add-item-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 16px;
    margin-bottom: 16px;
    background: transparent;
    border: 2px dashed var(--accent-green);
    color: var(--accent-green);
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.add-item-btn:hover {
    background: rgba(34, 197, 94, 0.1);
    border-style: solid;
}

.add-item-btn i {
    width: 18px;
    height: 18px;
}

.chip-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.chip-option {
    background: #4b5563;
    border: 1px solid transparent;
    color: white;
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.chip-option:hover {
    background: #6b7280;
}

.chip-option.active {
    background: #f3f4f6;
    color: #111827;
}

.chip-option .chip-star {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: all 0.2s;
}

.chip-option .chip-star:hover {
    color: #fbbf24;
    transform: scale(1.2);
}

.chip-option .chip-star.active,
.chip-option .chip-star.favorited {
    color: #fbbf24;
}

.chip-option.active .chip-star {
    color: rgba(0, 0, 0, 0.3);
}

.chip-option.active .chip-star.active,
.chip-option.active .chip-star.favorited {
    color: #f59e0b;
}

/* AI Analyzing Modal */
.ai-modal {
    width: 400px;
    background: #1e2229;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border-subtle);
}

.ai-modal-content {
    padding: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

/* ============================================
   AI ANALYZING MODAL - Enhanced Effects
   ============================================ */

.ai-logo-container {
    position: relative;
    width: 100px;
    height: 100px;
    margin: 0 auto 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-logo {
    width: 70px;
    height: 70px;
    object-fit: contain;
    animation: logoPulse 2s ease-in-out infinite;
    position: relative;
    z-index: 2;
    filter: drop-shadow(0 0 10px rgba(34, 197, 94, 0.5));
}

/* Scanning Line Effect */
.ai-scan-line {
    position: absolute;
    left: 10%;
    right: 10%;
    height: 2px;
    background: linear-gradient(90deg,
        transparent 0%,
        rgba(34, 197, 94, 0.3) 20%,
        rgba(34, 197, 94, 0.8) 50%,
        rgba(34, 197, 94, 0.3) 80%,
        transparent 100%
    );
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.8),
                0 0 20px rgba(34, 197, 94, 0.4);
    animation: scanLine 2s ease-in-out infinite;
    z-index: 3;
    transition: opacity 0.3s ease;
}

/* Hide scan line and radar rings when complete */
.ai-logo-container.complete .ai-scan-line,
.ai-logo-container.complete .ai-radar-ring {
    animation: none;
    opacity: 0 !important;
}

@keyframes scanLine {
    0%, 100% {
        top: 10%;
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    50% {
        top: 90%;
    }
}

/* Radar Pulse Rings */
.ai-radar-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 1px solid rgba(34, 197, 94, 0.6);
    opacity: 0;
    z-index: 1;
}

.ai-radar-ring-1 {
    width: 70px;
    height: 70px;
    animation: radarPulse 2s ease-out infinite;
}

.ai-radar-ring-2 {
    width: 70px;
    height: 70px;
    animation: radarPulse 2s ease-out infinite 0.5s;
}

.ai-radar-ring-3 {
    width: 70px;
    height: 70px;
    animation: radarPulse 2s ease-out infinite 1s;
}

@keyframes radarPulse {
    0% {
        width: 70px;
        height: 70px;
        opacity: 0.8;
        border-width: 2px;
    }
    100% {
        width: 140px;
        height: 140px;
        opacity: 0;
        border-width: 1px;
    }
}

.ai-glow-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    border-radius: 50%;
    opacity: 0;
}

.ai-glow-ring.celebrating {
    animation: glowPulse 1.5s ease-out infinite;
}

@keyframes logoPulse {
    0%, 100% { transform: scale(1); filter: drop-shadow(0 0 10px rgba(34, 197, 94, 0.5)); }
    50% { transform: scale(1.05); filter: drop-shadow(0 0 20px rgba(34, 197, 94, 0.8)); }
}

@keyframes glowPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
        opacity: 1;
    }
    70% {
        box-shadow: 0 0 0 40px rgba(34, 197, 94, 0);
        opacity: 0;
    }
    100% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
        opacity: 0;
    }
}

/* Progress Bar Wrapper with Percentage */
.ai-progress-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    max-width: 280px;
    margin: 0 auto 16px;
}

.ai-progress-container {
    flex: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: visible;
    position: relative;
}

.ai-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #0d9488, #14b8a6, #22c55e, #14b8a6, #0d9488);
    background-size: 200% 100%;
    animation: progressShimmer 1.5s linear infinite;
    transition: width 0.3s ease;
    border-radius: 4px;
    position: relative;
}

/* Glowing tip on progress bar */
.ai-progress-bar::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    background: #22c55e;
    border-radius: 50%;
    box-shadow: 0 0 10px #22c55e, 0 0 20px #22c55e, 0 0 30px rgba(34, 197, 94, 0.5);
    animation: glowTip 1s ease-in-out infinite;
}

@keyframes glowTip {
    0%, 100% { box-shadow: 0 0 10px #22c55e, 0 0 20px #22c55e; }
    50% { box-shadow: 0 0 15px #22c55e, 0 0 30px #22c55e, 0 0 40px rgba(34, 197, 94, 0.5); }
}

@keyframes progressShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Percentage display */
.ai-progress-percent {
    font-family: 'Rajdhani', monospace;
    font-size: 16px;
    font-weight: 700;
    color: #22c55e;
    min-width: 40px;
    text-align: right;
    text-shadow: 0 0 10px rgba(34, 197, 94, 0.5);
}

/* Status text with subtle animation */
.ai-status-text {
    font-size: 14px;
    color: var(--text-muted);
    margin: 0;
    min-height: 20px;
    font-family: 'Inter', sans-serif;
}

.ai-status-text::after {
    content: '';
    animation: statusDots 1.5s steps(4, end) infinite;
}

@keyframes statusDots {
    0% { content: ''; }
    25% { content: '.'; }
    50% { content: '..'; }
    75% { content: '...'; }
    100% { content: ''; }
}

.ai-status {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.ai-result {
    width: 100%;
}

.ai-witty-message {
    font-size: 18px;
    font-weight: 700;
    color: white;
    margin-bottom: 24px;
    line-height: 1.4;
}

.ai-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.btn-ai-action {
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.2s;
    font-family: var(--font-display);
}

.btn-ai-action.primary {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    border: none;
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.4);
}

.btn-ai-action.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(34, 197, 94, 0.3);
}

.btn-ai-action.secondary {
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
}

.btn-ai-action.secondary:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

/* ============================================
   AI ANALYZE MODAL V2 - VIDEO VERSION
   ============================================ */

/* Ensure modal backdrop centers content */
#aiAnalyzeModal.gc-modal-backdrop {
    display: none;
    align-items: center;
    justify-content: center;
}

#aiAnalyzeModal.gc-modal-backdrop.active {
    display: flex;
}

/* AI Analyze Modal V3 - 16:9 Video Background */
.ai-analyze-modal-v3 {
    position: relative;
    width: 90vw;
    max-width: 600px;
    aspect-ratio: 16 / 9;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.6),
                0 0 40px rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

/* Video Background - fills entire modal */
.ai-video-bg {
    position: absolute;
    inset: -5px; /* Zoom in 5px on each side */
    z-index: 1;
    opacity: 1;
    transition: opacity 0.6s ease-out;
}

.ai-video-bg.fade-out {
    opacity: 0;
}

.ai-video-bg iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* Completion Background Image */
.ai-complete-bg {
    position: absolute;
    inset: 0;
    z-index: 1;
    opacity: 0;
    transform: scale(1.05);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.ai-complete-bg.fade-in {
    opacity: 1;
    transform: scale(1);
}

.ai-complete-bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Overlay Content - sits on top of video */
.ai-overlay-content {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 24px;
}

/* Progress section at bottom */
.ai-progress-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

/* Result section V3 - positioned in bottom third */
.ai-result-v3 {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    text-align: center;
    height: 100%;
    padding-bottom: 4px;
    animation: fadeInUp 0.4s ease;
}

.ai-result-v3 .ai-witty-message {
    font-family: 'Rajdhani', sans-serif;
    font-size: 20px;
    font-weight: 600;
    color: white;
    margin-bottom: 24px;
    line-height: 1.4;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.ai-result-v3 .ai-result-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* Hide video when complete */
.ai-video-bg.complete {
    display: none;
}

/* Progress bar V2 */
.ai-progress-wrapper-v2 {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
    max-width: 320px;
    margin-bottom: 16px;
}

.ai-progress-wrapper-v2 .ai-progress-container {
    flex: 1;
}

.ai-progress-wrapper-v2 .ai-progress-percent {
    font-family: 'Orbitron', 'Rajdhani', monospace;
    font-size: 18px;
    font-weight: 700;
    color: #22c55e;
    min-width: 50px;
    text-align: right;
    text-shadow: 0 0 10px rgba(34, 197, 94, 0.5);
}

/* Status text V2 */
.ai-status-text-v2 {
    font-family: 'Rajdhani', sans-serif;
    font-size: 16px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
    text-align: center;
    min-height: 24px;
    margin: 0;
}

/* Result section V2 */
.ai-result-v2 {
    width: 100%;
    text-align: center;
    animation: fadeInUp 0.4s ease;
}

.ai-result-v2 .ai-witty-message {
    font-family: 'Rajdhani', sans-serif;
    font-size: 20px;
    font-weight: 600;
    color: white;
    margin-bottom: 24px;
    line-height: 1.4;
}

.ai-result-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Success state - logo with checkmark overlay */
.ai-success-logo {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto 24px;
    animation: scaleIn 0.4s ease;
}

.ai-success-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 0 20px rgba(34, 197, 94, 0.4));
}

.ai-success-check {
    position: absolute;
    bottom: -8px;
    right: -8px;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.4);
    animation: popIn 0.3s ease 0.2s both;
}

.ai-success-check svg {
    width: 24px;
    height: 24px;
    color: white;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Update sidebar to use flex properly */
.pm-sidebar-left {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 20px;
    overflow-y: auto;
}

/* Toast notification animations */
@keyframes toastFadeIn {
    from { opacity: 0; transform: translateX(-50%) translateY(20px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes toastFadeOut {
    from { opacity: 1; transform: translateX(-50%) translateY(0); }
    to { opacity: 0; transform: translateX(-50%) translateY(20px); }
}

/* ========================================
   LIGHT MODE OVERRIDES
   ======================================== */

html[data-theme="light"] .chip-mode {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.15);
    color: var(--text-muted);
}

html[data-theme="light"] .chip-mode:hover {
    background: rgba(0, 0, 0, 0.1);
    border-color: rgba(0, 0, 0, 0.2);
    color: var(--text-main);
}

html[data-theme="light"] .chip-mode.active {
    background: var(--gc-accent-primary);
    border-color: var(--gc-accent-primary);
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.4);
}

/* ========================================
   OFFENSE/DEFENSE MODE TOGGLE
   ======================================== */

.play-type-toggle {
    display: flex;
    gap: 8px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    margin-bottom: 8px;
}

.play-type-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background: transparent;
    border: 2px solid transparent;
    border-radius: 8px;
    color: var(--text-muted);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.play-type-btn i,
.play-type-btn svg {
    width: 20px;
    height: 20px;
}

.play-type-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
}

/* Offense mode active - Green */
.play-type-btn.active[id="btnOffenseMode"] {
    background: rgba(34, 197, 94, 0.2);
    border-color: #22c55e;
    color: #22c55e;
}

/* Defense mode active - Red */
.play-type-btn.active[id="btnDefenseMode"] {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
    color: #ef4444;
}

/* Defense player tokens - distinct red border */
.player-token.defense-token {
    border: 2px solid rgba(239, 68, 68, 0.4);
}

/* Coverage type chips - special styling */
.coverage-type-chips {
    display: flex;
    gap: 6px;
}

.coverage-type-chips .chip-neutral.active {
    background: #ef4444;
    color: white;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
}

/* Alignment chips - red selected state for defense */
.alignment-chips-inline .chip-neutral.active,
#alignmentChipsInline .chip-neutral.active {
    background: #ef4444;
    color: white;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
}

/* Offense/Defense controls containers */
.offense-controls,
.defense-controls {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

/* Defense situation chips */
.defense-situation-chips-inline .chip-neutral.active {
    background: #f59e0b;
    color: #111827;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
}

/* Zone coverage visualization - semi-transparent zones */
.zone-overlay {
    position: absolute;
    border-radius: 8px;
    pointer-events: none;
}

.zone-deep {
    background: rgba(59, 130, 246, 0.25);
    border: 2px dashed rgba(59, 130, 246, 0.5);
}

.zone-hook {
    background: rgba(34, 197, 94, 0.25);
    border: 2px dashed rgba(34, 197, 94, 0.5);
}

.zone-flat {
    background: rgba(249, 115, 22, 0.25);
    border: 2px dashed rgba(249, 115, 22, 0.5);
}

.zone-middle {
    background: rgba(168, 85, 247, 0.25);
    border: 2px dashed rgba(168, 85, 247, 0.5);
}

/* Man coverage link lines - dashed line from defender to receiver */
.man-link-line {
    stroke: rgba(239, 68, 68, 0.7);
    stroke-width: 2;
    stroke-dasharray: 6 4;
}

/* ========================================
   LIGHT MODE - Defense Toggle
   ======================================== */

html[data-theme="light"] .play-type-toggle {
    background: rgba(0, 0, 0, 0.05);
}

html[data-theme="light"] .play-type-btn {
    color: var(--text-muted);
}

html[data-theme="light"] .play-type-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--text-main);
}

html[data-theme="light"] .play-type-btn.active[id="btnOffenseMode"] {
    background: rgba(34, 197, 94, 0.15);
    border-color: #22c55e;
    color: #16a34a;
}

html[data-theme="light"] .play-type-btn.active[id="btnDefenseMode"] {
    background: rgba(239, 68, 68, 0.15);
    border-color: #ef4444;
    color: #dc2626;
}