:root {
    --primary: #6366f1;
    /* Indigo 500 */
    --primary-hover: #4f46e5;
    /* Indigo 600 */
    --bg-app: #f8fafc;
    /* Slate 50 */
    --bg-surface: #ffffff;
    --border: #e2e8f0;
    /* Slate 200 */
    --text-main: #0f172a;
    /* Slate 900 */
    --text-muted: #64748b;
    /* Slate 500 */
    --danger: #ef4444;
    --success: #22c55e;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-app);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Top Bar */
.top-bar {
    height: 60px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
    justify-content: space-between;
    box-shadow: var(--shadow-sm);
    z-index: 10;
}

.brand {
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.beta-tag {
    font-size: 0.7rem;
    background: var(--primary);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
}

.play-info input {
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text-main);
    text-align: center;
    width: 300px;
}

.play-info input:focus {
    border-bottom: 2px solid var(--primary);
}

.actions {
    display: flex;
    gap: 0.75rem;
}

.btn-primary {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid transparent;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
}

.btn-ghost:hover {
    background: #f1f5f9;
    color: var(--text-main);
}

/* Workspace */
.workspace {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Left Sidebar */
.sidebar-left {
    width: 240px;
    background: var(--bg-surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border);
}

.play-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.play-item {
    padding: 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.play-item:hover {
    background: #f1f5f9;
    color: var(--text-main);
}

.play-item.active {
    background: #e0e7ff;
    color: var(--primary);
    font-weight: 600;
}

/* Canvas Area */
.canvas-area {
    flex: 1;
    background: #f1f5f9;
    /* Darker slate for contrast */
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    padding-bottom: 100px;
    /* Space for bottom toolbar */
    overflow: auto;
}

.canvas-wrapper {
    background: white;
    box-shadow: var(--shadow-lg);
    border-radius: 8px;
    overflow: visible;
}

#play-canvas {
    display: block;
    cursor: crosshair;
}

/* Bottom Toolbar */
.bottom-toolbar {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.5rem;
    display: flex;
    gap: 1rem;
    box-shadow: var(--shadow-lg);
    z-index: 20;
}

.tool-group {
    display: flex;
    gap: 0.5rem;
}

.separator-vertical {
    width: 1px;
    background: var(--border);
    margin: 0 0.5rem;
}

.tool-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 70px;
    height: 60px;
    border: none;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    color: var(--text-muted);
    gap: 4px;
    transition: all 0.2s;
}

.tool-btn span {
    font-size: 0.75rem;
    font-weight: 500;
}

.tool-btn:hover {
    background: #f1f5f9;
    color: var(--text-main);
}

.tool-btn.active {
    background: #e0e7ff;
    color: var(--primary);
}

.tool-btn.danger:hover {
    background: #fef2f2;
    color: var(--danger);
}

/* Icons */
.icon-circle {
    width: 20px;
    height: 20px;
    border: 2px solid currentColor;
    border-radius: 50%;
}

.icon-cross {
    font-size: 1.5rem;
    line-height: 1;
    font-weight: bold;
}

.icon-ball {
    width: 14px;
    height: 20px;
    background: currentColor;
    border-radius: 50%;
}

.icon-text {
    font-size: 1.2rem;
}

/* SVG Elements */
.draggable {
    cursor: grab;
}

.draggable:active {
    cursor: grabbing;
}

.route-path {
    fill: none;
    stroke: #334155;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-linejoin: round;
}

.player-circle {
    /* fill and stroke controlled by JS */
    stroke-width: 3;
}

.player-cross {
    stroke: var(--danger);
    stroke-width: 4;
    stroke-linecap: round;
}

.ball {
    fill: #92400e;
    stroke: #78350f;
    stroke-width: 1;
}

/* Properties Panel */
.properties-panel {
    position: absolute;
    top: 80px;
    right: 20px;
    width: 220px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    z-index: 30;
    animation: slideIn 0.2s ease-out;
}

.properties-panel.hidden {
    display: none;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.panel-header {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 0.9rem;
}

.btn-icon {
    background: transparent;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-muted);
}

.panel-body {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.color-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.color-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 0 0 1px var(--border);
    cursor: pointer;
    transition: transform 0.1s;
}

.color-btn:hover {
    transform: scale(1.1);
}

.btn-danger-outline {
    background: transparent;
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
}

.btn-danger-outline:hover {
    background: #fef2f2;
}

/* Print Styles */
@media print {

    .top-bar,
    .sidebar-left,
    .bottom-toolbar,
    .properties-panel {
        display: none !important;
    }

    .canvas-area {
        padding: 0;
        background: white;
    }

    .canvas-wrapper {
        box-shadow: none;
    }
}

/* Playbook Views */
.view-section {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.view-section.hidden {
    display: none !important;
}

/* Dark Overlay for Create View */
.dark-overlay {
    background-color: rgba(15, 23, 42, 0.4);
    /* Slate 900, lower opacity */
    backdrop-filter: blur(2px);
    /* Optional: adds nice blur effect */
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 50;
}

.modal-container {
    width: 500px;
    background: #ffffff;
    /* White */
    border: 1px solid #e2e8f0;
    /* Slate 200 */
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    color: var(--text-main);
    padding: 2rem;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e2e8f0;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e2e8f0;
    margin-top: auto;
}

.modal-header h2 {
    font-size: 1.2rem;
    letter-spacing: 0.05em;
    font-weight: 700;
}

.btn-icon-light {
    background: transparent;
    border: 1px solid #e2e8f0;
    color: var(--text-muted);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-icon-light:hover {
    background: #f1f5f9;
    color: var(--text-main);
    border-color: #cbd5e1;
}

/** Success Checkmark Button **/
.btn-icon-success {
    background: transparent;
    border: 2px solid var(--success);
    color: var(--success);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-icon-success:hover {
    background: var(--success);
    color: white;
}

.modal-body {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.modal-field {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.modal-field label {
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    text-transform: uppercase;
}

.dark-input {
    background: #ffffff;
    border: 1px solid #cbd5e1;
    color: var(--text-main);
    padding: 0.75rem 1rem;
    border-radius: 6px;
    width: 100%;
    max-width: 400px;
    text-align: left;
    outline: none;
    font-size: 1rem;
}

.dark-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.1);
}

.dark-input::placeholder {
    color: #94a3b8;
}

/* Team Size Selector (Buttons) */
.team-size-selector {
    display: flex;
    background: #f1f5f9;
    /* Light slate bg */
    border-radius: 6px;
    /* Slight rounded or sharp as per mock */
    padding: 4px;
    /* Added padding for pill grouping look */
    overflow: hidden;
    gap: 4px;
}

.size-btn {
    border: none;
    background: transparent;
    color: var(--text-muted);
    padding: 0.5rem 1.25rem;
    cursor: pointer;
    font-weight: 600;
    border-radius: 4px;
    /* Individual rounded buttons */
    border-right: none;
    /* Remove separator lines */
    transition: all 0.2s;
}

.size-btn:last-child {
    border-right: none;
}

.size-btn:hover {
    background: white;
    color: var(--text-main);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.size-btn.active {
    background: white;
    color: var(--primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.field-preview-box {
    width: 100%;
    max-width: 400px;
    height: 180px;
    background: #334155;
    border-radius: 6px;
    border: 1px solid #475569;
}

/* View Section - Full Screen Overlay */
.view-section {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-app);
}

/* Sidebar Styles (Modern) */
.modern-sidebar {
    background: white;
    width: 260px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    padding: 1.5rem;
    gap: 2rem;
}

.app-brand-area {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.app-icon {
    width: 36px;
    height: 36px;
    background: black;
    color: white;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.app-name {
    font-weight: 700;
    font-size: 1rem;
    line-height: 1.2;
}

.app-name .subtitle {
    font-size: 0.7rem;
    font-weight: 400;
    color: var(--text-muted);
}

.playbook-dropdown-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    background: #f1f5f9;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-main);
    transition: background 0.2s;
    font-size: 0.9rem;
}

.playbook-dropdown-btn:hover {
    background: #e2e8f0;
}

.dot-indicator {
    color: var(--primary);
    font-size: 0.8rem;
    margin-right: 0.5rem;
}

.current-playbook-selector {
    position: relative;
    width: 100%;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    margin-top: 0.5rem;
    padding: 0.5rem;
    z-index: 50;
    animation: slideDown 0.1s ease-out;
}

.dropdown-menu.hidden {
    display: none;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    color: var(--text-main);
    text-align: left;
}

.dropdown-item:hover {
    background: #f1f5f9;
}

.dropdown-item.active {
    background: #e0e7ff;
    color: var(--primary);
    font-weight: 600;
}

.dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 0.5rem 0;
}

.dropdown-item.create-new {
    color: var(--text-muted);
}

.dropdown-item.create-new:hover {
    color: var(--primary);
}

.menu-label {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.menu-item {
    text-align: left;
    background: transparent;
    border: none;
    padding: 0.6rem 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-main);
    border-radius: 6px;
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.menu-item:hover:not(.disabled) {
    background: #f8fafc;
    color: var(--primary);
}

.menu-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Main Content Area */
.light-bg {
    background-color: white;
    /* As per mock likely white or very light grey */
    flex: 1;
    display: flex;
    flex-direction: column;
}

.header-title-area h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
}

.header-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.btn-dark {
    background: #0f172a;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
}

.btn-dark:hover {
    background: #1e293b;
}

.filter-bar {
    padding: 0 2rem 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

.search-wrapper {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 400px;
}

.search-wrapper input {
    border: none;
    background: transparent;
    outline: none;
    width: 100%;
}

.filter-actions {
    display: flex;
    gap: 0.75rem;
}

.pill-select {
    padding: 0.5rem 1rem;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
}

/* Playbook Overview View */
#view-playbook-overview {
    display: flex;
    width: 100vw;
    height: 100vh;
    flex-direction: row;
    overflow: hidden;
}

/* Sidebar Extensions */
.sidebar-left .btn-text {
    background: transparent;
    border: none;
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-main);
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar-nav {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.nav-item {
    text-align: left;
    background: transparent;
    border: none;
    padding: 0.75rem;
    border-radius: 6px;
    color: var(--text-muted);
    font-weight: 600;
    cursor: pointer;
}

.nav-item:hover {
    background: #f1f5f9;
    color: var(--text-main);
}

.nav-item.active {
    background: #e0e7ff;
    color: var(--primary);
}

.main-content-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--bg-app);
    overflow: auto;
}

.overview-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-surface);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.search-bar input {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: 20px;
    width: 250px;
    outline: none;
}

.plays-grid {
    padding: 2rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    /* Increased from 200px for wider cards */
    gap: 1.5rem;
    overflow-y: auto;
}

.play-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    min-height: 250px;
}

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

.play-card-preview {
    aspect-ratio: 100 / 70;
    /* Match field viewBox proportions */
    width: 100%;
    background: transparent;
    /* Was #f1f5f9 */
    display: flex;
    align-items: center;
    justify-content: center;
}

.play-card-icon {
    font-size: 3rem;
    opacity: 0.5;
}

.play-card-info {
    padding: 0.5rem;
    background: #64748b;
    color: white;
}

.play-name {
    font-weight: 600;
    color: inherit;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.play-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.badge {
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: #e2e8f0;
    color: var(--text-muted);
    margin-left: 1rem;
}

.badge-warning {
    background: #fef9c3;
    color: #a16207;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: var(--text-muted);
}



.btn-small {
    padding: 0.25rem 0.5rem;
    font-size: 0.8rem;
}

.action-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

/* Sidebar Footer (User Profile) */
.sidebar-footer {
    margin-top: auto;
    /* Push to bottom */
    padding-top: 15px;
    border-top: 1px solid var(--border);
    position: relative;
    /* For popover positioning */
}

/* Drag and Drop Styles */
.play-card.dragging {
    opacity: 0.5;
    border: 2px dashed var(--primary);
    transform: scale(1.02);
}

.play-card.drag-over {
    border-left: 4px solid var(--primary);
    background: #f1f5f9;
}

.play-number {
    font-weight: 700;
    color: rgba(255, 255, 255, 0.7);
    margin-right: 0.5rem;
}

.user-profile {
    display: flex;
    align-items: center;
    padding: 10px;
    cursor: pointer;
    border-radius: 8px;
    transition: background-color 0.2s;
}

.user-profile:hover {
    background-color: #f1f5f9;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background-color: #e2e8f0;
    /* Fallback */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-main);
    margin-right: 12px;
    border: 1px solid var(--border);
}

.user-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-email {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* User Menu Popover */
.user-menu {
    position: absolute;
    bottom: 100%;
    /* Above footer */
    left: 0;
    width: 100%;
    background-color: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    padding: 5px;
    margin-bottom: 8px;
    z-index: 50;
    animation: fadeIn 0.15s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.menu-item.danger {
    color: var(--danger);
    width: 100%;
    justify-content: flex-start;
}

.menu-item.danger:hover {
    background-color: #fef2f2;
}

/* Utility Class for Hidden Elements */
.hidden {
    display: none !important;
}

/* Light Theme Auth & Modals */
.auth-overlay {
    background-color: #f1f5f9;
    /* Light grey background */
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 50;
}

.auth-card {
    background: white;
    width: 400px;
    padding: 2.5rem;
    border-radius: 16px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.auth-card.large {
    width: 500px;
}

.auth-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.auth-header h1 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.025em;
}

.auth-form-container h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 1.5rem;
    text-align: center;
}

/* Light Forms */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-main);
}

.light-input {
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    color: var(--text-main);
    width: 100%;
    transition: all 0.2s;
}

.light-input:focus {
    border-color: var(--primary);
    background: white;
    outline: none;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.light-select {
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    color: var(--text-main);
    width: 100%;
    margin-bottom: 0.5rem;
}

/* Auth Toggle */
.auth-toggle {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.auth-toggle a {
    color: var(--primary);
    font-weight: 600;
    text-decoration: none;
}

.auth-toggle a:hover {
    text-decoration: underline;
}

/* Email Confirmation Pending View */
.confirm-email-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 1rem 0;
}

.confirm-email-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #6366f1 0%, #06b6d4 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
    animation: bounceIn 0.5s ease-out;
}

.confirm-email-icon svg {
    stroke: white;
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }

    60% {
        transform: scale(1.1);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.confirm-email-content h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 1rem;
    text-align: center;
}

.confirm-email-message {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
    text-align: center;
}

.confirm-email-address {
    font-weight: 600;
    color: var(--primary);
    font-size: 1rem;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(6, 182, 212, 0.1) 100%);
    padding: 0.75rem 1.25rem;
    border-radius: 8px;
    margin-bottom: 1.25rem;
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.confirm-email-instructions {
    color: var(--text-muted);
    font-size: 0.875rem;
    max-width: 280px;
    line-height: 1.6;
    margin-bottom: 1.5rem;
    text-align: center;
}

.confirm-email-actions {
    width: 100%;
    max-width: 280px;
}

.confirm-email-actions .btn-secondary-outline {
    padding: 0.75rem 1.5rem;
    width: 100%;
}

/* Resend button success state */
.btn-resend-success {
    background: var(--success) !important;
    border-color: var(--success) !important;
    color: white !important;
}

/* New Modal Header Light */
.modal-header-light {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-header-light h2 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
}

.btn-icon-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    line-height: 1;
}

.btn-icon-close:hover {
    color: var(--text-main);
}

/* Light Theme Team Selector */
.team-size-selector.light-theme {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
}

.team-size-selector.light-theme .size-btn {
    color: var(--text-muted);
    border-right: 1px solid #e2e8f0;
}

.team-size-selector.light-theme .size-btn:last-child {
    border-right: none;
}

.team-size-selector.light-theme .size-btn.active {
    background: white;
    color: var(--primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Field Preview Light */
.field-preview-box.light-theme {
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
}

.full-width {
    width: 100%;
}

/* Playbook Settings Modal Specifics */
.settings-modal {
    background: white;
    color: var(--text-main);
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    overflow: hidden;
}

.settings-modal .modal-header {
    border-bottom: 1px solid var(--border);
    padding: 1.5rem;
    color: var(--text-main);
}

.settings-modal .modal-header h2 {
    font-size: 1.25rem;
}

.settings-modal .btn-icon-light {
    color: var(--text-muted);
    border: none;
}

.settings-modal .btn-icon-light:hover {
    background: #f1f5f9;
    color: var(--text-main);
}

.settings-modal .modal-body {
    padding: 1.5rem;
    gap: 1.5rem;
}

.settings-modal .modal-section h3 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.btn-primary-prof {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.5rem 1.5rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary-prof:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-outline-prof {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid #cbd5e1;
    padding: 0.5rem 1.5rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-outline-prof:hover {
    background: #f1f5f9;
    color: var(--text-main);
    border-color: #94a3b8;
}

.settings-modal label.text-dark {
    color: var(--text-main);
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    display: block;
    text-transform: none;
    /* Override uppercase if needed */
}

.light-input-bg {
    background: #f1f5f9;
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.75rem;
    border-radius: 6px;
    width: 100%;
    font-size: 1rem;
    outline: none;
}

.light-input-bg:focus {
    border-color: var(--primary);
    background: white;
}

.preview-field-green {
    /* Corrected to be neutral/clean for SVG */
    background-color: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    width: 100%;
    height: 160px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    overflow: hidden;
}

.preview-field-green:hover .edit-overlay {
    opacity: 1;
}

.edit-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.2s;
}

.edit-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.btn-danger-block {
    width: 100%;
    background: #ef4444;
    color: white;
    border: none;
    padding: 0.75rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-danger-block:hover {
    background: #dc2626;
}

.modal-footer {
    border-top: 1px solid var(--border);
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    background: #fafafa;
}

.btn-outline-prof {
    background: white;
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
}

.btn-icon-light {
    background: white;
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    /* Ensure icon and text are spaced */
    font-size: 0.9rem;
}

.btn-outline-prof:hover {
    background: #f1f5f9;
}

.btn-primary-prof {
    background: #0f172a;
    /* Slate 900 */
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
}

.btn-primary-prof:hover {
    background: #1e293b;
}

/* Header Actions */
.header-actions-right {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.btn-icon-dark {
    background: transparent;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    /* Space between icon and text */
}

/* Ensure text is visible */
.btn-icon-light .lock-text {
    display: inline-block;
    font-weight: 500;
}

.btn-icon-dark:hover {
    background: #f1f5f9;
    color: var(--text-main);
}

#playbook-settings-btn {
    font-size: 1.5rem;
    /* Larger icon */
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    /* Optional: add border to match button style if desired, or keep clean */
    background: white;
}

#playbook-settings-btn:hover {
    background: #f1f5f9;
    border-color: var(--text-muted);
}

/* Snackbar */
.snackbar {
    visibility: hidden;
    min-width: 250px;
    margin-left: -125px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 4px;
    padding: 16px;
    position: fixed;
    z-index: 2000;
    /* Ensure it's above everything */
    left: 50%;
    bottom: 30px;
    font-size: 16px;
    opacity: 0;
    transition: opacity 0.3s, bottom 0.3s;
}

.snackbar.show {
    visibility: visible;
    opacity: 1;
    bottom: 50px;
}

/* Lock Icon Button */
.btn-icon-light .lock-icon {
    font-size: 1.2rem;
}

.btn-warning {
    background-color: #f59e0b;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
}

.btn-warning:hover {
    background-color: #d97706;
}

.btn-ghost-danger {
    background: transparent;
    border: 1px solid transparent;
    /* Ensure no border initially */
    color: #ef4444 !important;
    /* Force red */
    cursor: pointer;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: all 0.2s;
    font-size: 0.9rem;
}

.btn-ghost-danger:hover {
    background: #fef2f2;
    border-color: #ef4444;
}

/* --- Editor Modernization --- */

.workspace-flex {
    display: flex;
    flex: 1;
    height: calc(100vh - 60px);
    /* Adjust based on top bar height */
    overflow: hidden;
    position: relative;
}

.editor-sidebar {
    width: 300px;
    background: white;
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 1rem;
    gap: 1.5rem;
}

.color-grid-large {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}

.color-btn-lg {
    width: 100%;
    aspect-ratio: 1;
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.1s;
}

.color-btn-lg:hover {
    transform: scale(1.05);
}

.color-btn-lg.active {
    border-color: var(--text-main);
    transform: scale(0.95);
}

.canvas-area-expanded {
    flex: 1;
    background: #f1f5f9;
    padding: 2rem;
    overflow: auto;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    /* or center if we want vertical centering */
}

/* Sidebar */
.editor-sidebar {
    width: 300px;
    background: #1e293b;
    border-left: 1px solid #334155;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    /* Ensure visibility logic is handled by scripts, but default hidden */
}

.editor-sidebar.hidden {
    display: none;
}

/* Empty State */
.sidebar-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    height: 100%;
    color: #94a3b8;
    padding: 2rem;
}

.sidebar-empty.hidden {
    display: none;
}

.empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Primary Button */
.btn-icon-outline {
    background: transparent;
    border: 1px solid #475569;
    border-radius: 6px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon-outline:hover {
    background: #334155;
    color: #ffffff;
}

.btn-icon-outline.active {
    background: #eab308;
    border-color: #eab308;
    color: #000000;
}

.btn-icon-outline.active svg {
    fill: #000000;
}

/* simple toggle for now, or use transform: translateX(100%) */

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

.sidebar-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-main);
}

.sidebar-content {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.sidebar-section label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.75rem;
}

/* Player Preview */
.player-preview-section {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-light);
}

.player-circle-large {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary);
    /* dynamic */
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.25rem;
}

.player-info {
    display: flex;
    flex-direction: column;
}

.player-info .label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.player-info strong {
    font-size: 1rem;
    color: var(--text-main);
}

.player-label-input {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    border: 1px solid var(--border);
    border-radius: 4px;
    width: 60px;
    padding: 2px 6px;
    text-transform: uppercase;
    text-align: center;
}

.player-label-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

/* Action Buttons */
.action-buttons-row {
    display: flex;
    gap: 0.75rem;
}

.full-width {
    width: 100%;
    justify-content: center;
}

.btn-secondary-outline {
    background: white;
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-secondary-outline:hover {
    background: #f8fafc;
    border-color: #cbd5e1;
}

.btn-danger-outline {
    background: white;
    border: 1px solid #fee2e2;
    color: #ef4444;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-danger-outline:hover {
    background: #fef2f2;
    border-color: #fca5a5;
}

/* Color Grid Large */
.color-grid-large {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}

.color-btn-lg {
    width: 100%;
    aspect-ratio: 1;
    /* Square */
    border-radius: 8px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
}

.color-btn-lg:hover {
    transform: scale(1.05);
}

.color-btn-lg.active {
    border-color: var(--text-main);
    /* or black ring */
    box-shadow: 0 0 0 2px white, 0 0 0 4px var(--text-main);
}

/* Segmented Control */
.segmented-control {
    display: flex;
    background: #f1f5f9;
    padding: 4px;
    border-radius: 8px;
    gap: 4px;
}

.segment-btn {
    flex: 1;
    background: transparent;
    border: none;
    padding: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.segment-btn.active {
    background: white;
    color: var(--text-main);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    font-weight: 600;
}

.line-solid {
    width: 20px;
    height: 2px;
    background: currentColor;
    display: inline-block;
}

.line-dashed {
    width: 20px;
    height: 2px;
    border-bottom: 2px dashed currentColor;
    display: inline-block;
}

.hidden {
    display: none !important;
}

/* Active State for Primary Button */
#make-primary-btn.active {
    color: #EAB308 !important;
    border-color: #EAB308 !important;
    background-color: #FEF9C3 !important;
}

/* =========================================
   PRINT STYLES
   ========================================= */

@media print {

    /* Hide everything in the app by default */
    body * {
        visibility: hidden;
    }

    .app-container,
    .modal-overlay,
    .dark-overlay,
    .snackbar {
        display: none !important;
    }

    /* Only show the print container */
    #print-container,
    #print-container * {
        visibility: visible;
    }

    #print-container {
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
        margin: 0;
        padding: 0;
        background: white;
    }

    /* Print Layout Utilities */
    .print-page {
        width: 100vw;
        height: 100vh;
        page-break-after: always;
        break-after: page;
        display: flex;
        flex-wrap: wrap;
        align-content: flex-start;
        align-items: flex-start;
        justify-content: center;
        box-sizing: border-box;
        padding: 0.5in;
    }

    .print-page:last-child {
        page-break-after: avoid;
        break-after: auto;
    }

    /* Wristband Container */
    .wristband-container {
        /* Size and grid set via inline styles in JS */
        box-sizing: border-box;
    }

    /* Grid Items */
    .print-item {
        box-sizing: border-box;
        display: flex;
        flex-direction: column;
        padding: 1px;
        position: relative;
        overflow: visible;
        /* Changed from hidden to prevent cutoff */
        page-break-inside: avoid;
        background: white;
    }

    /* Ensure svg fits */
    .print-item svg {
        width: 100%;
        height: 100%;
        display: block;
    }

    .print-item-header {
        font-size: 10pt;
        font-weight: bold;
        text-align: left;
        background: #4b5563 !important;
        /* Dark gray background - force override */
        color: white !important;
        /* White text - force override */
        padding: 1px 0;
        flex-shrink: 0;
        display: flex;
        justify-content: flex-start;
        gap: 2px;
        padding-left: 4px;
        padding-right: 4px;
        border-bottom: 1px solid #374151;
        /* Slightly darker border */
        -webkit-print-color-adjust: exact !important;
        /* Force background colors in print */
        print-color-adjust: exact !important;
        /* Force background colors in print */
        color-adjust: exact !important;
        /* Force background colors in print */
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Ensure wristband containers have minimal padding */
    .wristband-container .print-item {
        padding: 1px !important;
        overflow: hidden !important;
        /* Clip content that extends beyond bounds */
    }
}

/* ============================================
   MOBILE RESPONSIVE LAYOUT
   ============================================ */

/* Top Bar - Shown on all screen sizes (unified mobile-style layout) */
.mobile-top-bar {
    display: flex;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
    padding: 0.5rem 1rem;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

/* Left section of top bar - contains logo and playbook title */
.top-bar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Logo in top bar */
.top-bar-logo {
    display: block;
    height: 56px;
    width: auto;
}

/* Playbook title selector - like in the example */
.playbook-title-selector {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    cursor: pointer;
}

.playbook-title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
    white-space: nowrap;
}

.playbook-dropdown-chevron {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 4px;
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.15s;
}

.playbook-dropdown-chevron:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: var(--text-main);
}

/* Hide the overview header completely since we merged it into top bar */
.overview-header {
    display: none !important;
}

.mobile-playbook-selector {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: #f1f5f9;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.9rem;
    min-height: 44px;
}

.mobile-playbook-selector:active {
    background: #e2e8f0;
}

.mobile-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.mobile-icon-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    width: 44px;
    height: 44px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-icon-btn:active {
    background: #f1f5f9;
}

/* Help Icon Tooltip */
.help-icon-btn {
    position: relative;
}

.help-icon-btn .help-tooltip {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: #1f2937;
    color: white;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
    line-height: 1.4;
    white-space: normal;
    width: 280px;
    max-width: 90vw;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
}

.help-icon-btn:hover .help-tooltip,
.help-icon-btn:focus .help-tooltip {
    display: block;
}

.mobile-user-button {
    background: transparent;
    border: 1px solid var(--border);
    padding: 4px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    min-width: 44px;
}

.mobile-user-button:active {
    background: #f1f5f9;
}

.user-avatar-small {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
}

/* Hide sidebar on all screen sizes - unified mobile-style layout */
.sidebar-left.modern-sidebar {
    display: none !important;
}

/* Mobile Media Query - 768px and below */
@media (max-width: 768px) {

    /* Main content takes full width */
    .main-content-area {
        width: 100%;
    }

    /* Adjust overview header for mobile */
    .overview-header {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }

    .header-title-area h1 {
        font-size: 1.25rem;
    }

    .header-actions-right {
        display: flex;
        gap: 0.5rem;
        width: 100%;
        justify-content: flex-end;
    }

    /* Adjust grid for tablets */
    .plays-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        padding: 1rem;
        gap: 1rem;
    }
}

/* Extra small screens - phones */
@media (max-width: 480px) {

    /* Single column layout for phones */
    .plays-grid {
        grid-template-columns: 1fr;
        padding: 0.75rem;
    }

    /* Smaller header on phones */
    .overview-header {
        padding: 1rem;
    }

    .header-title-area h1 {
        font-size: 1.1rem;
    }

    /* Hide "New Play" button text on very small screens */
    #header-new-play-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.85rem;
    }

    /* Adjust play card for better mobile viewing */
    .play-card {
        min-height: 220px;
    }

    /* Mobile top bar adjustments */
    .mobile-top-bar {
        padding: 0.5rem 0.75rem;
    }

    .mobile-playbook-selector {
        font-size: 0.85rem;
        padding: 0.5rem 0.75rem;
    }
}

/* Shared Dropdown Menus - Position relative to top bar */
#playbook-dropdown-menu {
    position: fixed;
    z-index: 100;
    top: 65px;
    left: 10px;
    right: 10px;
    width: auto;
    max-width: 300px;
}

/* User button wrapper for dropdown positioning */
.user-button-wrapper {
    position: relative;
}

#user-menu {
    position: absolute !important;
    z-index: 1000 !important;
    top: 100% !important;
    bottom: auto !important;
    left: auto !important;
    right: 0 !important;
    margin-top: 8px;
    min-width: 260px !important;
    width: max-content !important;
    height: auto !important;
    background: white !important;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 0.75rem !important;
    animation: none !important;
}

#user-menu .user-menu-info {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 0.75rem;
    padding: 0.75rem;
}

#user-menu .user-menu-info .user-avatar {
    width: 40px !important;
    height: 40px !important;
    min-width: 40px;
    flex-shrink: 0;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    display: flex !important;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
}

#user-menu .user-menu-info .user-details {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.125rem;
    min-width: 0;
}

#user-menu .user-menu-info .user-name {
    font-weight: 600;
    color: var(--text-main);
    font-size: 0.9rem;
    white-space: nowrap;
}

#user-menu .user-menu-info .user-email {
    color: var(--text-muted);
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#user-menu .menu-divider {
    height: 1px;
    background: var(--border);
    margin: 0.5rem 0;
}

#user-menu .menu-item.danger {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    font-weight: 500;
    width: 100%;
    border: none;
    background: transparent;
    cursor: pointer;
    color: var(--danger);
    font-size: 0.9rem;
}

#user-menu .menu-item.danger:hover {
    background: #fef2f2;
}

/* Mobile adjustments */
@media (max-width: 768px) {

    /* Hide desktop header on mobile */
    .overview-header {
        display: none;
    }

    /* Mobile new play button styling */
    .mobile-new-play {
        white-space: nowrap;
    }
}

/* Fix view container flex direction - apply to all sizes now that sidebar is gone */
#view-playbook-overview {
    flex-direction: column !important;
}