/**
 * Mistake Tracker Styles
 * Form overlay and mistake display styling
 */

/* ENABLE TEXT SELECTION IN MISTAKE TRACKER */
.mistake-form-overlay *,
.mistake-form-overlay *::before,
.mistake-form-overlay *::after {
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
    user-select: text !important;
}

/* ===========================
   Form Overlay
   =========================== */

.mistake-form-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    overflow-y: auto;
    padding: 0;
}

.mistake-form-overlay.active {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    animation: fadeIn 0.2s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.mistake-form-wrapper {
    display: flex;
    flex-direction: column;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    background: #1e2730;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    max-height: 100vh;
    overflow: hidden;
    animation: slideDown 0.3s ease-out;
}

.mistake-form-draft {
    background: #252d36;
    padding: 8px 16px;
    border-bottom: 1px solid #2d3842;
}



.mistake-tab-contents {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

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

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

.mistake-form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #2d3842;
    background: #1e2730;
}

.mistake-form-header h2 {
    margin: 0;
    color: #e0e0e0;
    font-size: 24px;
    font-weight: 600;
}

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

.mistake-tabs {
    display: flex;
    border-bottom: 2px solid #2d3842;
    background: #252d36;
    padding: 0 20px;
}

.mistake-tab {
    padding: 8px 20px;
    background: transparent;
    border: none;
    color: rgba(224, 224, 224, 0.6);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    font-family: inherit;
}

.mistake-tab.active {
    color: #4caf50;
    border-bottom-color: #4caf50;
    background: rgba(76, 175, 80, 0.1);
}

.mistake-tab:hover {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(224, 224, 224, 0.9);
}

/* ===========================
   Tab Content
   =========================== */

.mistake-tab-content {
    display: none;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
}

.mistake-tab-content.active {
    display: flex;
    flex-direction: column;
}

/* Navigation bar for Previous/Next Game buttons - always sticky */
.mistake-nav-bar {
    position: -webkit-sticky !important;
    position: sticky !important;
    top: 0 !important;
    z-index: 1001 !important;
    background-color: #1e2730 !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3) !important;
    width: 100%;
    padding: 10px 12px;
    border-bottom: 1px solid #2d3842;
    display: flex;
    gap: 12px;
    align-items: center;
    box-sizing: border-box;
}

.mistake-action-bar {
    position: -webkit-sticky !important;
    position: sticky !important;
    top: 48px !important;
    z-index: 1000 !important;
    background-color: #1e2730 !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.2) !important;
    width: 100%;
    padding: 12px;
    border-bottom: 1px solid #2d3842;
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    box-sizing: border-box;
}

/* Two-column layout for Active tab */
.active-two-column {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.categories-sidebar {
    width: 280px;
    background: #252d36;
    border-right: 1px solid #2d3842;
    overflow-y: auto;
    padding: 12px;
}

.instances-main {
    flex: 1;
    background: #1e2730;
    overflow-y: auto;
    padding: 20px;
}

/* Category Items in Sidebar */
.category-item {
    padding: 12px 14px;
    margin-bottom: 6px;
    background: #1e2730;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.category-item:hover {
    background: #2d3842;
}

.category-item.selected {
    background: rgba(76, 175, 80, 0.1);
    border-left-color: #4caf50;
}

.category-item-name {
    font-weight: 600;
    font-size: 14px;
    color: #e0e0e0;
    margin-bottom: 4px;
}

.category-item-count {
    font-size: 12px;
    color: #4caf50;
}

/* Player Sections in Main Area */
.player-section {
    margin-bottom: 24px;
}

.player-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #2d3842;
}

.player-name-big {
    font-weight: 700;
    font-size: 18px;
    color: #4a9eff;
}

.player-section-header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.player-instance-count {
    font-size: 13px;
    color: #808080;
}

.add-instance-btn {
    padding: 6px 12px;
    background: #10b981;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: background 0.2s;
}

.add-instance-btn:hover {
    background: #059669;
}

.instances-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.mistakes-list-container {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
}

/* ===========================
   Category → Player → Instance Structure
   =========================== */

.category-section {
    margin-bottom: 16px;
    background: #252d36;
    border-radius: 8px;
    overflow: hidden;
}

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background: #2d3842;
    cursor: pointer;
    transition: background 0.2s;
}

.category-header:hover {
    background: #353f4c;
}

.category-title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.category-icon {
    color: #4caf50;
    font-size: 12px;
    transition: transform 0.2s;
    width: 12px;
}

.category-name {
    font-weight: 600;
    font-size: 15px;
    color: #e0e0e0;
}

.category-count {
    background: rgba(76, 175, 80, 0.2);
    color: #4caf50;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.category-content {
    padding: 12px;
}

/* Player Subsection */
.player-subsection {
    margin-bottom: 16px;
    background: #1e2730;
    border-radius: 6px;
    padding: 12px;
}

.player-subsection:last-child {
    margin-bottom: 0;
}

.player-subsection-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #2d3842;
}

.player-name {
    font-weight: 600;
    font-size: 14px;
    color: #4a9eff;
}

.instance-count {
    font-size: 12px;
    color: #808080;
}

/* Instance Cards */
.instances-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.instance-card {
    background: #252d36;
    border-radius: 4px;
    padding: 12px;
    transition: box-shadow 0.2s;
    border-left: none;
}

.instance-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.instance-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.instance-meta {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.instance-time {
    color: #4caf50;
    font-weight: 600;
    font-size: 13px;
    font-family: 'Courier New', monospace;
}

.instance-time-input {
    color: #4caf50;
    font-weight: 600;
    font-size: 13px;
    font-family: 'Courier New', monospace;
    background: transparent;
    border: none;
    border-bottom: 1px solid transparent;
    width: 44px;
    padding: 0;
    outline: none;
    cursor: pointer;
    text-align: left;
}
.instance-time-input:hover {
    border-bottom-color: #4caf50;
    cursor: text;
}
.instance-time-input:focus {
    border-bottom-color: #4caf50;
    background: rgba(76, 175, 80, 0.12);
    border-radius: 3px;
    cursor: text;
}

.instance-impact {
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.instance-impact.critical {
    background: rgba(244, 67, 54, 0.2);
    color: #ff6b6b;
}

.instance-impact.high {
    background: rgba(255, 152, 0, 0.2);
    color: #ffb74d;
}

.instance-impact.medium {
    background: rgba(255, 235, 59, 0.2);
    color: #fff176;
}

.instance-impact.low {
    background: rgba(76, 175, 80, 0.2);
    color: #81c784;
}

.instance-phase {
    font-size: 11px;
    color: #808080;
    font-style: italic;
}

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

.instance-edit-btn,
.instance-delete-btn,
.instance-duplicate-btn {
    background: transparent;
    border: 1px solid #3d4852;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.instance-edit-btn:hover {
    background: rgba(74, 158, 255, 0.1);
    border-color: #4a9eff;
}

.instance-duplicate-btn:hover {
    background: rgba(156, 39, 176, 0.1);
    border-color: #9c27b0;
}

.instance-delete-btn:hover {
    background: rgba(244, 67, 54, 0.1);
    border-color: #f44336;
}

.instance-description {
    color: #e0e0e0;
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 6px;
}

.instance-coach-notes {
    background: #1e2730;
    border-left: 3px solid #4caf50;
    padding: 8px 10px;
    border-radius: 4px;
    font-size: 12px;
    color: #b0b0b0;
    line-height: 1.4;
}

.instance-coach-notes strong {
    color: #4caf50;
}

.instance-screenshots {
    margin-top: 12px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(450px, 1fr));
    gap: 16px;
}

.instance-screenshot-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background: #1e2730;
    border: 1px solid #2d3842;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.instance-screenshot-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.instance-screenshot-item img,
.instance-screenshot-item video {
    width: 100%;
    height: 400px;
    object-fit: contain;
    background: #000;
    display: block;
}

/* Video play overlay for thumbnails */
.video-play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.35);
    pointer-events: none;
    transition: background 0.2s;
}

.instance-screenshot-item:hover .video-play-overlay,
.screenshot-preview-item:hover .video-play-overlay,
.issues-screenshot:hover .video-play-overlay {
    background: rgba(0, 0, 0, 0.2);
}

.video-play-icon {
    font-size: 40px;
    color: white;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.7);
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
}

/* Issues screenshot grid - video wrapper */
.issues-screenshot.is-video {
    position: relative;
    display: inline-block;
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #374151;
    transition: transform 0.2s, box-shadow 0.2s;
}

.issues-screenshot.is-video:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* Form preview - video in thumbnail */
.screenshot-preview-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.screenshot-preview-item .video-play-overlay {
    pointer-events: none;
}

.screenshot-preview-item .video-play-icon {
    font-size: 22px;
}

.instance-screenshot-item .delete-screenshot-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(239, 68, 68, 0.95);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: background 0.2s;
}

.instance-screenshot-item:hover .delete-screenshot-btn {
    display: flex;
}

.instance-screenshot-item .delete-screenshot-btn:hover {
    background: rgba(220, 38, 38, 1);
}

.instance-footer {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #2d3842;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.instance-add-photos-btn {
    background: transparent;
    border: 1px solid #4caf50;
    color: #4caf50;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.instance-add-photos-btn:hover {
    background: rgba(76, 175, 80, 0.1);
    border-color: #66bb6a;
    color: #66bb6a;
}

.instance-status-controls {
    display: flex;
    align-items: center;
    gap: 0;
}

.instance-status-controls label {
    font-size: 13px;
    color: #9e9e9e;
    font-weight: 500;
    display: none;
}

.instance-status-select {
    padding: 4px 8px;
    background: #2d3842;
    border: 1px solid #3d4852;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 12px;
    cursor: pointer;
    transition: border-color 0.2s;
    min-width: 120px;
}

.instance-status-select:hover {
    border-color: #4a9eff;
}

.instance-status-select:focus {
    outline: none;
    border-color: #4a9eff;
}

.close-btn {
    background: none;
    border: none;
    font-size: 32px;
    color: #9e9e9e;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    line-height: 1;
    transition: color 0.2s;
}

.close-btn:hover {
    color: #e0e0e0;
}

/* ===========================
   Form Styles
   =========================== */

.mistake-form {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.form-section {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid #2d3842;
}

.form-section:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
}

.form-section h3 {
    margin: 0 0 16px 0;
    color: #b0b0b0;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

.form-row:last-child {
    margin-bottom: 0;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    margin-bottom: 6px;
    color: #b0b0b0;
    font-size: 13px;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    background: #2d3842;
    border: 1px solid #3d4852;
    border-radius: 4px;
    padding: 10px 12px;
    color: #e0e0e0;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #4a9eff;
}

.form-group input:read-only {
    background: #252d36;
    color: #808080;
    cursor: not-allowed;
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-group small {
    margin-top: 4px;
    color: #808080;
    font-size: 12px;
}

.btn-link {
    background: none;
    border: none;
    color: #4a9eff;
    font-size: 12px;
    cursor: pointer;
    padding: 4px 0;
    margin-top: 4px;
    text-align: left;
    transition: color 0.2s;
}

.btn-link:hover {
    color: #6bb0ff;
    text-decoration: underline;
}

/* ===========================
   Screenshot Preview
   =========================== */

.screenshot-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 12px;
}

.screenshot-preview-item {
    position: relative;
    width: 120px;
    height: 90px;
    border-radius: 4px;
    overflow: hidden;
    background: #2d3842;
}

.screenshot-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.screenshot-preview-item .remove-preview,
.screenshot-preview-item .remove-existing {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(244, 67, 54, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.screenshot-preview-item .remove-preview:hover,
.screenshot-preview-item .remove-existing:hover {
    background: rgba(244, 67, 54, 1);
}

/* Drag-and-drop visual feedback */
#screenshots.drag-over,
.screenshot-preview.drag-over {
    border: 2px dashed #4caf50 !important;
    background-color: rgba(76, 175, 80, 0.1) !important;
    transition: all 0.2s ease;
}

#screenshots {
    transition: all 0.2s ease;
}

.screenshot-preview {
    min-height: 50px;
    border: 2px dashed transparent;
    border-radius: 4px;
    padding: 8px;
    transition: all 0.2s ease;
}

/* ===========================
   Form Actions
   =========================== */

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid #2d3842;
}

.btn-primary,
.btn-secondary {
    padding: 10px 24px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.btn-primary {
    background: #4a9eff;
    color: white;
}

.btn-primary:hover {
    background: #3a8eef;
}

.btn-primary:disabled {
    background: #3d4852;
    color: #808080;
    cursor: not-allowed;
}

.btn-secondary {
    background: transparent;
    color: #b0b0b0;
    border: 1px solid #3d4852;
}

.btn-secondary:hover {
    background: #2d3842;
    border-color: #4d5862;
}

/* ===========================
   Mistakes Display Section
   =========================== */

.mistakes-section {
    margin-top: 24px;
    background: #1e2730;
    border-radius: 8px;
    padding: 20px;
}

.mistakes-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.mistakes-section-header h3 {
    margin: 0;
    color: #e0e0e0;
    font-size: 18px;
}

.btn-add-mistake {
    background: #4a9eff;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-add-mistake:hover {
    background: #3a8eef;
}

.player-mistakes {
    margin-bottom: 16px;
}

.player-mistakes:last-child {
    margin-bottom: 0;
}

.player-header {
    background: #2d3842;
    padding: 12px 16px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.2s;
}

.player-header:hover {
    background: #353f4c;
}

.player-header span:first-child {
    color: #e0e0e0;
    font-weight: 600;
    font-size: 14px;
}

.player-header .arrow {
    color: #808080;
    transition: transform 0.2s;
}

.player-header.collapsed .arrow {
    transform: rotate(-90deg);
}

.player-mistakes-list {
    padding: 12px 0;
    display: block;
}

.player-mistakes-list.collapsed {
    display: none;
}

/* ===========================
   Mistake Instance Card
   =========================== */

.mistake-instance {
    background: #252d36;
    border-left: 4px solid #4a9eff;
    border-radius: 6px;
    padding: 16px;
    margin: 8px 0;
    transition: box-shadow 0.2s;
}

.mistake-instance:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.mistake-instance.impact-critical {
    border-left-color: #f44336;
}

.mistake-instance.impact-high {
    border-left-color: #ff9800;
}

.mistake-instance.impact-medium {
    border-left-color: #ffeb3b;
}

.mistake-instance.impact-low {
    border-left-color: #4caf50;
}

.mistake-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
}

.mistake-meta {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.mistake-category {
    color: #4a9eff;
    font-weight: 600;
    font-size: 14px;
}

.mistake-time {
    color: #b0b0b0;
    font-size: 13px;
    font-family: 'Courier New', monospace;
}

.mistake-impact {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mistake-impact.critical {
    background: rgba(244, 67, 54, 0.2);
    color: #ff6b6b;
}

.mistake-impact.high {
    background: rgba(255, 152, 0, 0.2);
    color: #ffb74d;
}

.mistake-impact.medium {
    background: rgba(255, 235, 59, 0.2);
    color: #fff176;
}

.mistake-impact.low {
    background: rgba(76, 175, 80, 0.2);
    color: #81c784;
}

.mistake-status {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(158, 158, 158, 0.2);
    color: #9e9e9e;
}

.mistake-status.acknowledged {
    background: rgba(33, 150, 243, 0.2);
    color: #64b5f6;
}

.mistake-status.addressed {
    background: rgba(255, 193, 7, 0.2);
    color: #ffd54f;
}

.mistake-status.resolved {
    background: rgba(76, 175, 80, 0.2);
    color: #81c784;
}

.mistake-description {
    color: #e0e0e0;
    font-size: 14px;
    line-height: 1.6;
    margin: 12px 0;
}

.mistake-phase {
    color: #808080;
    font-size: 12px;
    font-style: italic;
    margin-bottom: 8px;
}

.mistake-coach-notes {
    background: #1e2730;
    border-left: 3px solid #4a9eff;
    padding: 10px 12px;
    margin: 12px 0;
    border-radius: 4px;
}

.mistake-coach-notes-label {
    color: #4a9eff;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 4px;
}

.mistake-coach-notes-text {
    color: #b0b0b0;
    font-size: 13px;
    line-height: 1.5;
}

.mistake-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.btn-edit,
.btn-delete,
.btn-add-photos {
    padding: 6px 14px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.btn-edit {
    background: transparent;
    color: #4a9eff;
    border: 1px solid #4a9eff;
}

.btn-edit:hover {
    background: rgba(74, 158, 255, 0.1);
}

.btn-delete {
    background: transparent;
    color: #f44336;
    border: 1px solid #f44336;
}

.btn-delete:hover {
    background: rgba(244, 67, 54, 0.1);
}

.btn-add-photos {
    background: transparent;
    color: #4caf50;
    border: 1px solid #4caf50;
}

.btn-add-photos:hover {
    background: rgba(76, 175, 80, 0.1);
}

.mistake-screenshots {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.mistake-screenshot-item {
    position: relative;
    width: 100px;
    height: 75px;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s;
}

.mistake-screenshot-item:hover {
    transform: scale(1.05);
}

.mistake-screenshot-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.delete-screenshot-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(244, 67, 54, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
}

.mistake-screenshot-item:hover .delete-screenshot-btn {
    display: flex;
}

.delete-screenshot-btn:hover {
    background: rgba(244, 67, 54, 1);
}

/* ===========================
   Empty State
   =========================== */

.no-mistakes {
    text-align: center;
    padding: 40px 20px;
    color: #808080;
}

.no-mistakes p {
    margin: 8px 0;
    font-size: 14px;
}

.no-mistakes p:first-child {
    font-size: 16px;
    font-weight: 600;
}

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

@media (max-width: 768px) {
    .mistake-form-overlay {
        padding: 0;
    }

    .mistake-form-container {
        margin: 0;
        border-radius: 0;
        min-height: 100vh;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .mistake-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .form-actions {
        flex-direction: column-reverse;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
    }

    .mistake-actions {
        flex-direction: column;
    }

    .btn-edit,
    .btn-delete,
    .btn-add-photos {
        width: 100%;
    }
}

/* Screenshot Lightbox */
.screenshot-lightbox {
    display: none;
}

/* ===========================
   Draft Display - Force Mobile Card Styles
   =========================== */

/* Make mobile card styles apply inside mistake-form-draft regardless of screen size */
.mistake-form-draft .match-mobile-card,
.mistake-form-draft .mistake-draft-card {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 32px;
    background: var(--bg-light);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    border-left: 4px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    cursor: default;
}

.mistake-form-draft .match-mobile-card:hover {
    transform: none;
}

.mistake-form-draft .match-mobile-card.win {
    border-left-color: var(--accent-green);
}

.mistake-form-draft .match-mobile-card.loss {
    border-left-color: var(--accent-red);
}

.mistake-form-draft .match-mobile-info,
.mistake-form-draft .mistake-draft-info {
    margin-bottom: 0px;
    flex: 0 0 auto;
    min-width: 250px;
}

.mistake-form-draft .match-mobile-league {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 4px;
}

.mistake-form-draft .match-mobile-date {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.mistake-form-draft .match-mobile-teams,
.mistake-form-draft .mistake-draft-teams {
    display: flex;
    flex-direction: row;
    gap: 20px;
    flex: 1;
}

.mistake-form-draft .match-mobile-team {
    background: transparent;
    border: none;
    padding: 12px 0;
}

.mistake-form-draft .match-mobile-team.winning-team {
    background: rgba(76, 175, 80, 0.1);
    border: 1px solid var(--accent-green);
    border-radius: 8px;
    padding: 8px;
}

.mistake-form-draft .match-mobile-team-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.mistake-form-draft .match-mobile-team-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.mistake-form-draft .match-mobile-team-info {
    display: flex;
    gap: 8px;
    align-items: center;
}

.mistake-form-draft .match-mobile-team-side {
    font-size: 0.8rem;
    padding: 3px 8px;
    border-radius: 4px;
    background: var(--bg-light);
}

.mistake-form-draft .match-mobile-pick-order {
    font-size: 0.8rem;
    padding: 3px 8px;
    border-radius: 4px;
    background: var(--bg-light);
    color: var(--text-secondary);
}

.mistake-form-draft .match-mobile-team-side.radiant {
    color: var(--accent-green);
    background: rgba(76, 175, 80, 0.15);
}

.mistake-form-draft .match-mobile-team-side.dire {
    color: var(--accent-red);
    background: rgba(244, 67, 54, 0.15);
}

/* Responsive adjustment for mistake form draft */
@media (max-width: 1200px) {

    .mistake-form-draft .match-mobile-card,
    .mistake-form-draft .mistake-draft-card {
        flex-direction: column;
        gap: 16px;
    }

    .mistake-form-draft .match-mobile-info,
    .mistake-form-draft .mistake-draft-info {
        min-width: 0;
        margin-bottom: 0;
    }

    .mistake-form-draft .match-mobile-teams,
    .mistake-form-draft .mistake-draft-teams {
        flex-direction: column;
        gap: 12px;
    }
}

.mistake-form-draft .match-mobile-picks {
    display: flex !important;
    gap: 4px !important;
    flex-wrap: wrap !important;
    margin-bottom: 6px !important;
}

.mistake-form-draft .match-mobile-bans {
    display: flex !important;
    gap: 3px !important;
    flex-wrap: wrap !important;
}

/* Additional specificity to ensure flex layout works */
#mistakeFormDraft .match-mobile-picks,
#mistakeFormDraft .match-mobile-bans {
    display: flex !important;
    flex-wrap: wrap !important;
}

#mistakeFormDraft .match-mobile-picks {
    gap: 4px !important;
    margin-bottom: 6px !important;
}

#mistakeFormDraft .match-mobile-bans {
    gap: 3px !important;
}

.mistake-form-draft .match-mobile-hero {
    width: 43px !important;
    height: 32px !important;
    border-radius: 4px !important;
    overflow: hidden !important;
    position: relative !important;
    border: 1px solid var(--border-color) !important;
}

.mistake-form-draft .match-mobile-picks .match-mobile-hero {
    width: 58px !important;
    height: 32px !important;
}

.mistake-form-draft .match-mobile-hero img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

/* Extra specificity with ID selector */
#mistakeFormDraft .match-mobile-hero {
    width: 43px !important;
    height: 32px !important;
}

#mistakeFormDraft .match-mobile-picks .match-mobile-hero {
    width: 58px !important;
    height: 32px !important;
}

#mistakeFormDraft .match-mobile-hero img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

.mistake-form-draft .match-mobile-hero.ban img,
#mistakeFormDraft .match-mobile-hero.ban img {
    filter: grayscale(95%) brightness(1) !important;
}

.mistake-form-draft .match-mobile-hero .pick-number,
#mistakeFormDraft .match-mobile-hero .pick-number {
    position: absolute !important;
    bottom: 0 !important;
    left: 0 !important;
    background: rgba(0, 0, 0, 0.8) !important;
    color: white !important;
    font-size: 0.65rem !important;
    padding: 1px 3px !important;
    font-weight: 500 !important;
}

.mistake-form-draft .match-mobile-picks .match-mobile-hero .pick-number,
#mistakeFormDraft .match-mobile-picks .match-mobile-hero .pick-number {
    color: #10b981 !important;
}

.mistake-form-draft .match-mobile-bans .match-mobile-hero .pick-number,
#mistakeFormDraft .match-mobile-bans .match-mobile-hero .pick-number {
    color: #ff0000 !important;
}

/* Category management buttons */
.category-actions {
    display: flex;
    gap: 12px;
    margin-top: 4px;
}

.category-actions .btn-link {
    margin-top: 0;
    padding: 0;
}

/* Mobile responsiveness for draft + form */
@media (max-width: 1200px) {
    .mistake-form-wrapper {
        flex-direction: column;
    }

    .mistake-form-draft {
        flex: 0 0 auto;
        max-height: 400px;
    }

    .mistake-form-container {
        max-height: calc(100vh - 540px);
    }
}

/* ===========================
   Match View Modal
   =========================== */

.match-view-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #1a1d24;
    z-index: 99999;
}

.match-view-overlay.active {
    display: block;
}

.match-view-wrapper {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

.match-view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: #1e2730;
    border-bottom: 1px solid var(--border-color);
}

.match-view-header h2 {
    margin: 0;
    color: #ffffff;
    font-size: 1.5rem;
}

.match-view-close {
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 2rem;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.match-view-close:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Main Content */
.match-view-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #151820;
}

.match-view-draft {
    margin-bottom: 24px;
}

.match-view-mistake-list {
    background: #1e2730;
    border-radius: 8px;
    padding: 20px;
}

/* Main Tabs */
.match-view-main-tabs {
    display: flex;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 20px;
    background: #1e2730;
    border-radius: 8px 8px 0 0;
}

.main-tab {
    flex: 1;
    padding: 14px 20px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
}

.main-tab.active {
    color: var(--accent-green);
    border-bottom-color: var(--accent-green);
    background: rgba(76, 175, 80, 0.1);
}

.main-tab:hover {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.9);
}

/* Tab Content */
.match-view-tab-content {
    background: #1e2730;
    border-radius: 0 0 8px 8px;
    padding: 20px;
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
}

/* Player Section Headers (Non-collapsible) */
.player-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: rgba(76, 175, 80, 0.1);
    border-radius: 6px;
    margin-bottom: 12px;
}

.player-name-label {
    font-weight: 600;
    color: var(--accent-green);
    font-size: 1.1rem;
}

.player-mistake-count {
    background: rgba(76, 175, 80, 0.2);
    color: var(--accent-green);
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* Flat list container */
.mistakes-flat-list {
    display: flex;
    flex-direction: column;
}

/* Dividers */
.mistake-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 12px 0;
}

.player-section-divider {
    height: 24px;
}

/* Individual Mistake Cards */
.mistake-card {
    padding: 16px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 6px;
    transition: background 0.2s;
}

.mistake-card:hover {
    background: rgba(255, 255, 255, 0.05);
}

.mistake-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.mistake-meta {
    display: flex;
    gap: 12px;
    align-items: center;
}

.mistake-time {
    color: var(--accent-green);
    font-weight: 600;
    font-size: 0.95rem;
}

.mistake-category {
    background: rgba(76, 175, 80, 0.2);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.85rem;
    color: #ffffff;
}

.mistake-impact {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
}

.mistake-impact.critical {
    background: rgba(244, 67, 54, 0.3);
    color: #ff6b6b;
}

.mistake-impact.high {
    background: rgba(255, 152, 0, 0.3);
    color: #ffa726;
}

.mistake-impact.medium {
    background: rgba(255, 235, 59, 0.3);
    color: #ffeb3b;
}

.mistake-impact.low {
    background: rgba(76, 175, 80, 0.3);
    color: #81c784;
}

.mistake-actions {
    display: flex;
    gap: 8px;
}

.mistake-edit-btn,
.mistake-delete-btn {
    padding: 6px 12px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.mistake-edit-btn {
    background: rgba(33, 150, 243, 0.2);
    color: #42a5f5;
}

.mistake-edit-btn:hover {
    background: rgba(33, 150, 243, 0.3);
}

.mistake-delete-btn {
    background: rgba(244, 67, 54, 0.2);
    color: #ef5350;
}

.mistake-delete-btn:hover {
    background: rgba(244, 67, 54, 0.3);
}

.mistake-description {
    color: rgba(255, 255, 255, 0.9);
    line-height: 1.6;
    margin-bottom: 8px;
}

.mistake-coach-notes {
    color: rgba(255, 255, 255, 0.7);
    font-style: italic;
    font-size: 0.9rem;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-left: 3px solid var(--accent-green);
    border-radius: 4px;
}

.no-mistakes-message {
    text-align: center;
    padding: 40px;
    color: rgba(255, 255, 255, 0.5);
    font-size: 1.1rem;
}

@media (max-width: 1024px) {
    .match-view-wrapper {
        flex-direction: column;
    }

    .match-view-draft {
        flex: 0 0 auto;
        max-height: 400px;
    }

    .match-view-mistakes {
        max-height: calc(100vh - 540px);
    }
}

/* ===========================
   Issues Tab Styles
   =========================== */

/* Issues Filters */
.issues-filters {
    display: flex;
    gap: 10px;
    padding: 16px 20px;
    background: #252d36;
    border-bottom: 1px solid #2d3842;
    flex-wrap: wrap;
}

.issues-filter-select {
    flex: 1;
    min-width: 150px;
    padding: 8px 12px;
    background: #2d3842;
    border: 1px solid #3d4852;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 13px;
    cursor: pointer;
}

.issues-filter-select:hover,
.issues-filter-select:focus {
    border-color: #4a9eff;
    outline: none;
}

.issues-refresh-btn {
    padding: 8px 16px;
    background: #4a9eff;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.issues-refresh-btn:hover {
    background: #3a8eef;
}

/* Issues Container */
.issues-container {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

/* Tournament Sections */
.issues-tournament {
    margin-bottom: 24px;
    background: #252d36;
    border-radius: 8px;
    overflow: hidden;
}

.issues-tournament-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: #2d3842;
    cursor: pointer;
    transition: background 0.2s;
}

.issues-tournament-header:hover {
    background: #343e4a;
}

.issues-expand-icon {
    font-size: 14px;
    color: #9e9e9e;
    transition: transform 0.2s;
}

.issues-tournament-name {
    font-size: 18px;
    font-weight: 700;
    color: #4a9eff;
    flex: 1;
}

.issues-tournament-stats {
    font-size: 13px;
    color: #9e9e9e;
}

.issues-tournament-content {
    padding: 16px;
}

/* Match Cards */
.issues-match-card {
    margin-bottom: 20px;
    background: #1e2730;
    border-radius: 6px;
    border: 1px solid #2d3842;
    overflow: hidden;
}

.issues-match-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #252d36;
    border-bottom: 1px solid #2d3842;
}

.issues-match-id {
    font-size: 16px;
    font-weight: 700;
    color: #e0e0e0;
}

.issues-match-count {
    font-size: 13px;
    color: #9e9e9e;
}

/* Draft Display in Issues */
.issues-match-draft {
    padding: 16px;
    background: #1a1f28;
    border-bottom: 1px solid #2d3842;
}

.issues-draft-info {
    display: flex;
    gap: 16px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid #2d3842;
}

.issues-match-date {
    font-size: 13px;
    color: #9e9e9e;
}

.issues-match-result {
    font-size: 13px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 3px;
}

.issues-match-result.win {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.issues-match-result.loss {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.issues-draft-teams {
    display: flex;
    gap: 16px;
}

.issues-draft-team {
    flex: 1;
    background: #252d36;
    border-radius: 4px;
    padding: 12px;
}

.issues-draft-team-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid #2d3842;
}

.issues-draft-team-header .team-name {
    font-size: 14px;
    font-weight: 700;
    color: #e0e0e0;
    flex: 1;
}

.issues-draft-team-header .team-side {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 3px;
}

.issues-draft-team-header .team-side.radiant {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.issues-draft-team-header .team-side.dire {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.issues-draft-team-header .team-pick-order {
    font-size: 11px;
    color: #9e9e9e;
}

.issues-draft-heroes,
.issues-draft-bans {
    margin-bottom: 6px;
}

/* Issues Instances */
.issues-mistakes-section {
    padding: 16px;
}

.issues-category-section {
    margin-bottom: 16px;
}

.issues-category-header {
    font-size: 15px;
    font-weight: 700;
    color: #4a9eff;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 2px solid #2d3842;
}

.issues-instances {
    display: grid;
    gap: 12px;
}

.issues-instance {
    background: #252d36;
    border-radius: 4px;
    padding: 12px;
    border-left: 3px solid #3d4852;
}

.issues-instance-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    gap: 12px;
}

.issues-instance-meta {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    flex: 1;
}

.issues-instance-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.issues-player {
    font-weight: 700;
    font-size: 14px;
    color: #4a9eff;
}

.issues-time {
    font-size: 13px;
    color: #10b981;
    font-weight: 600;
}

.issues-impact {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 3px;
}

.issues-impact.critical {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.issues-impact.high {
    background: rgba(249, 115, 22, 0.2);
    color: #f97316;
}

.issues-impact.medium {
    background: rgba(234, 179, 8, 0.2);
    color: #eab308;
}

.issues-impact.low {
    background: rgba(156, 163, 175, 0.2);
    color: #9ca3af;
}

.issues-phase {
    font-size: 11px;
    color: #9e9e9e;
    background: rgba(255, 255, 255, 0.05);
    padding: 3px 8px;
    border-radius: 3px;
}

.issues-status {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 3px;
    margin-left: auto;
}

.issues-status.status-active {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}

.issues-status.status-acknowledged {
    background: rgba(234, 179, 8, 0.2);
    color: #eab308;
}

.issues-status.status-addressed {
    background: rgba(168, 85, 247, 0.2);
    color: #a855f7;
}

.issues-status.status-resolved {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.issues-description {
    font-size: 13px;
    color: #e0e0e0;
    line-height: 1.5;
    margin-bottom: 6px;
}

.issues-coach-notes {
    font-size: 12px;
    color: #9e9e9e;
    font-style: italic;
    margin-bottom: 8px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 3px;
}

.issues-screenshots {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 8px;
    margin-top: 10px;
}

.issues-screenshot {
    width: 100%;
    height: auto;
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    border: 1px solid #3d4852;
}

.issues-screenshot:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

/* ===========================
   All Issues Tab Styles
   =========================== */

/* Main container for All Issues tab */
.all-issues-container {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

/* Container for all issues list */
.all-issues-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Category badge (for inline display in All Issues) - matches Issues page styling */
.all-issues-category {
    background: #374151;
    color: #10b981;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 600;
    font-size: 13px;
}

/* Player name badge (for inline display in All Issues) - matches Issues page styling */
.all-issues-player {
    font-weight: 600;
    color: #60a5fa;
    font-size: 14px;
}

/* ===========================
   By Category & By Player Tab Styles
   =========================== */

/* Main containers for By Category and By Player tabs */
.by-category-container,
.by-player-container {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

/* List container for grouped sections */
.by-view-list {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Individual section (category or player) */
.by-view-section {
    background: #252d36;
    border-radius: 8px;
    padding: 16px;
}

/* Section header (category name or player name) */
.by-view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #2d3842;
}

/* Header title - styled differently for category vs player */
.by-view-header-title {
    font-size: 18px;
    font-weight: 700;
}

/* Category header - green */
.by-category-container .by-view-header-title {
    color: #10b981;
}

/* Player header - blue */
.by-player-container .by-view-header-title {
    color: #60a5fa;
}

/* Count badge */
.by-view-count {
    background: rgba(158, 158, 158, 0.2);
    color: #9e9e9e;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
}

/* Green count for category sections */
.by-category-container .by-view-count {
    background: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

/* Blue count for player sections */
.by-player-container .by-view-count {
    background: rgba(96, 165, 250, 0.2);
    color: #60a5fa;
}

/* Instances grid */
.by-view-instances {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

/* ===========================
   Analytics Tab Styles
   =========================== */

.analytics-container {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.analytics-summary {
    background: #252d36;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 24px;
}

.analytics-summary h3 {
    color: #e0e0e0;
    font-size: 18px;
    margin-bottom: 16px;
}

.analytics-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.analytics-stats .stat-card {
    background: #1e2730;
    border-radius: 6px;
    padding: 16px;
    text-align: center;
}

.analytics-stats .stat-value {
    font-size: 32px;
    font-weight: 700;
    color: #4a9eff;
    margin-bottom: 8px;
}

.analytics-stats .stat-label {
    font-size: 13px;
    color: #9e9e9e;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Pivot Table */
.analytics-pivot-table {
    background: #252d36;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 24px;
    overflow-x: auto;
}

.analytics-pivot-table h3 {
    color: #e0e0e0;
    font-size: 18px;
    margin-bottom: 16px;
}

.pivot-table {
    width: 100%;
    border-collapse: collapse;
    color: #e0e0e0;
}

.pivot-table th,
.pivot-table td {
    padding: 12px;
    text-align: center;
    vertical-align: middle;
    border: 1px solid #2d3842;
}

.pivot-table thead th {
    background: #2d3842;
    font-weight: 600;
    font-size: 13px;
}

.pivot-header-player {
    text-align: left;
    min-width: 120px;
}

.pivot-header-category {
    min-width: 140px;
    max-width: 160px;
    font-size: 12px;
    vertical-align: middle;
    padding: 8px;
}

.pivot-player-name {
    background: #2d3842;
    text-align: left;
    font-weight: 600;
    color: #60a5fa;
}

.pivot-cell {
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
    font-size: 14px;
}

.pivot-cell:hover {
    transform: scale(1.1);
    box-shadow: 0 0 10px rgba(74, 158, 255, 0.5);
}

.pivot-cell-selected {
    outline: 3px solid #4a9eff !important;
    outline-offset: -3px;
    box-shadow: 0 0 15px rgba(74, 158, 255, 0.8) !important;
    position: relative;
    z-index: 10;
}

.severity-critical {
    background: rgba(244, 67, 54, 0.3);
    color: #ff6b6b;
}

.severity-high {
    background: rgba(255, 152, 0, 0.3);
    color: #ffb74d;
}

.severity-medium {
    background: rgba(255, 235, 59, 0.3);
    color: #fff176;
}

.severity-low {
    background: rgba(76, 175, 80, 0.3);
    color: #81c784;
}

.severity-none {
    background: transparent;
    color: #3d4852;
}

.pivot-total {
    background: #2d3842;
    font-weight: 700;
}

.pivot-table tfoot th {
    background: #2d3842;
    font-weight: 700;
}

/* Pivot Cell Details */
.pivot-cell-details {
    margin-top: 16px;
}

/* Timeline */
.analytics-timeline {
    background: #252d36;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 24px;
}

.analytics-timeline h3 {
    color: #e0e0e0;
    font-size: 18px;
    margin-bottom: 16px;
}

.timeline-container {
    position: relative;
    height: 100px;
    background: #1e2730;
    border-radius: 4px;
    margin-top: 16px;
}

.timeline-point {
    position: absolute;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    transition: all 0.2s;
    z-index: 1;
}

.timeline-point:hover {
    transform: translateY(-50%) scale(1.5);
    z-index: 2;
}

.timeline-point.critical {
    background: #ff6b6b;
    box-shadow: 0 0 8px rgba(255, 107, 107, 0.6);
}

.timeline-point.high {
    background: #ffb74d;
    box-shadow: 0 0 8px rgba(255, 183, 77, 0.6);
}

.timeline-point.medium {
    background: #fff176;
    box-shadow: 0 0 8px rgba(255, 241, 118, 0.6);
}

.timeline-point.low {
    background: #81c784;
    box-shadow: 0 0 8px rgba(129, 199, 132, 0.6);
}

/* Charts */
.analytics-charts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.analytics-phase-breakdown,
.analytics-severity-breakdown {
    background: #252d36;
    border-radius: 8px;
    padding: 20px;
}

.analytics-charts h3 {
    color: #e0e0e0;
    font-size: 16px;
    margin-bottom: 16px;
}

.phase-breakdown-list,
.severity-breakdown-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.breakdown-item {
    display: grid;
    grid-template-columns: 100px 1fr 100px;
    gap: 12px;
    align-items: center;
}

.breakdown-label {
    font-size: 13px;
    font-weight: 600;
    color: #e0e0e0;
}

.breakdown-label.critical {
    color: #ff6b6b;
}

.breakdown-label.high {
    color: #ffb74d;
}

.breakdown-label.medium {
    color: #fff176;
}

.breakdown-label.low {
    color: #81c784;
}

.breakdown-bar-container {
    background: #1e2730;
    border-radius: 4px;
    height: 24px;
    overflow: hidden;
}

.breakdown-bar {
    height: 100%;
    background: #4a9eff;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.breakdown-bar-critical {
    background: #ff6b6b;
}

.breakdown-bar-high {
    background: #ffb74d;
}

.breakdown-bar-medium {
    background: #fff176;
}

.breakdown-bar-low {
    background: #81c784;
}

.breakdown-value {
    font-size: 13px;
    color: #9e9e9e;
    text-align: right;
}

.no-data {
    text-align: center;
    padding: 20px;
    color: #9e9e9e;
    font-style: italic;
}

/* Responsive adjustments for Analytics tab */
@media (max-width: 768px) {
    .analytics-stats {
        grid-template-columns: 1fr 1fr;
    }

    .analytics-charts {
        grid-template-columns: 1fr;
    }

    .pivot-table {
        font-size: 12px;
    }

    .pivot-table th,
    .pivot-table td {
        padding: 8px 4px;
    }

    .breakdown-item {
        grid-template-columns: 80px 1fr 80px;
        gap: 8px;
    }
}

/* ========================================
   Drill-Down Issue Gallery Styles
   ======================================== */

/* Gallery Overlay - Use specific naming to avoid conflicts */
.mistake-issue-gallery-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    /* Match existing gallery z-index */
    display: flex;
    flex-direction: column;
}

/* Header Section */
.mistake-issue-gallery-header {
    padding: 20px;
    background: rgba(30, 39, 48, 0.9);
    border-bottom: 1px solid #2d3842;
    position: relative;
}

.mistake-issue-gallery-header .close-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #f44336;
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 20px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.mistake-issue-gallery-header .close-btn:hover {
    background: #d32f2f;
}

.mistake-issue-gallery-header .issue-info {
    display: flex;
    gap: 15px;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    padding-right: 50px;
    /* Space for close button */
}

.mistake-issue-gallery-header .issue-time {
    color: #4caf50;
    font-weight: bold;
    font-size: 16px;
}

.mistake-issue-gallery-header .issue-player {
    color: #60a5fa;
    font-weight: 600;
    font-size: 14px;
}

.mistake-issue-gallery-header .issue-category {
    color: #10b981;
    font-size: 14px;
    font-weight: 600;
}

.mistake-issue-gallery-header .issue-impact {
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: bold;
    font-size: 12px;
}

.mistake-issue-gallery-header .issue-impact.critical {
    background: #f44336;
    color: white;
}

.mistake-issue-gallery-header .issue-impact.high {
    background: #ff9800;
    color: white;
}

.mistake-issue-gallery-header .issue-impact.medium {
    background: #ffc107;
    color: black;
}

.mistake-issue-gallery-header .issue-impact.low {
    background: #4caf50;
    color: white;
}

.mistake-issue-gallery-header .issue-team,
.mistake-issue-gallery-header .issue-tournament {
    color: #e0e0e0;
    font-size: 14px;
}

.mistake-issue-gallery-header .issue-match {
    color: #9ca3af;
    font-size: 13px;
}

/* Main Image Section */
.mistake-issue-gallery-main {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: 20px;
}

.mistake-issue-gallery-main .issue-nav-btn {
    width: 60px;
    height: 100px;
    background: rgba(74, 158, 255, 0.8);
    color: white;
    border: none;
    cursor: pointer;
    font-size: 14px;
    border-radius: 4px;
    transition: background 0.2s;
    flex-shrink: 0;
}

.mistake-issue-gallery-main .issue-nav-btn:hover {
    background: rgba(74, 158, 255, 1);
}

.mistake-issue-gallery-main .issue-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.mistake-issue-gallery-main .issue-image-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mistake-issue-gallery-main .issue-image-container img {
    max-width: 100%;
    max-height: calc(100vh - 250px);
    object-fit: contain;
    border-radius: 4px;
}

/* Bottom Bar with photo navigation */
.mistake-issue-gallery-bottom {
    flex-shrink: 0;
    padding: 16px 20px;
    background: rgba(15, 20, 25, 0.95);
    border-top: 2px solid #2d3842;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.mistake-issue-gallery-bottom .photo-nav-btn {
    background: #4a9eff;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
}

.mistake-issue-gallery-bottom .photo-nav-btn:hover {
    background: #3a8eef;
}

.mistake-issue-gallery-bottom .photo-counter {
    color: white;
    font-size: 14px;
    min-width: 100px;
    text-align: center;
    font-weight: 600;
}

.mistake-issue-gallery-bottom .issue-counter {
    color: #9ca3af;
    font-size: 13px;
    padding-left: 20px;
    border-left: 1px solid #4b5563;
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    .mistake-issue-gallery-header {
        padding: 10px;
        padding-right: 50px;
    }

    .mistake-issue-gallery-header .close-btn {
        top: 8px;
        right: 8px;
        width: 32px;
        height: 32px;
        font-size: 18px;
    }

    .mistake-issue-gallery-header .issue-stats-vertical {
        flex: 0 0 150px;
        font-size: 10px;
        gap: 4px;
    }

    .mistake-issue-gallery-main {
        padding: 10px;
        gap: 10px;
    }

    .mistake-issue-gallery-main .issue-nav-btn {
        width: 40px;
        height: 80px;
        font-size: 12px;
    }

    .mistake-issue-gallery-main .issue-image-container img {
        max-height: calc(100vh - 320px);
    }

    .mistake-issue-gallery-bottom {
        padding: 12px;
        flex-wrap: wrap;
        justify-content: center;
        gap: 12px;
    }

    .mistake-issue-gallery-bottom .photo-nav-btn {
        padding: 8px 14px;
        font-size: 12px;
    }

    .mistake-issue-gallery-bottom .photo-counter {
        min-width: 80px;
        font-size: 13px;
    }

    .mistake-issue-gallery-bottom .issue-counter {
        font-size: 12px;
        padding-left: 12px;
    }
}

/* ========================================
   Mistake Form Draft Card Styles
   ======================================== */

/* Desktop: horizontal layout */
.mistake-draft-card {
    display: flex;
    flex-direction: row;
    gap: 15px;
    align-items: stretch;
}

.mistake-draft-info {
    flex: 0 0 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.mistake-draft-teams {
    display: flex;
    flex-direction: row;
    gap: 15px;
    flex: 1;
}

.mistake-draft-teams .match-mobile-team {
    flex: 1;
}

/* Gallery Draft Styles */
.gallery-draft-container {
    display: flex;
    flex-direction: row;
    gap: 12px;
    font-size: 11px;
    justify-content: center;
}

.gallery-draft-team {
    background: #1f2937;
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid #374151;
    min-width: 280px;
}

.gallery-draft-team-name {
    margin-bottom: 4px;
    font-weight: 700;
    font-size: 12px;
}

.gallery-draft-picks,
.gallery-draft-bans {
    display: flex;
    gap: 3px;
    margin-bottom: 4px;
}

.gallery-draft-bans {
    gap: 2px;
}

/* ========================================
   Mobile Mistake Form Improvements
   ======================================== */

@media (max-width: 768px) {

    /* 1. Stack draft boards vertically on mobile */
    .mistake-draft-card {
        flex-direction: column !important;
        gap: 12px !important;
    }

    .mistake-draft-info {
        flex: none !important;
    }

    .mistake-draft-teams {
        flex-direction: column !important;
        gap: 12px !important;
    }

    .mistake-draft-teams .match-mobile-team {
        flex: none !important;
    }

    /* 2. Nav bar stays sticky, action bar scrolls */
    .mistake-nav-bar {
        position: sticky !important;
        top: 0 !important;
        z-index: 1001 !important;
        flex-wrap: wrap;
        justify-content: center;
    }

    /* Mistake form tabs: horizontal scroll instead of wrapping/overflowing */
    .mistake-tabs {
        flex-wrap: nowrap !important;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        padding: 0 8px;
        scrollbar-width: thin;
    }
    .mistake-tabs::-webkit-scrollbar { height: 3px; }
    .mistake-tabs::-webkit-scrollbar-thumb {
        background: #4a5568;
        border-radius: 2px;
    }
    .mistake-tab {
        flex-shrink: 0;
        white-space: nowrap;
        padding: 6px 12px;
        font-size: 12px;
    }

    .mistake-action-bar {
        position: relative !important;
        top: auto !important;
        flex-direction: column;
        gap: 8px;
        box-shadow: none !important;
    }

    .mistake-action-bar .btn-primary {
        width: 100%;
    }

    /* 3. Active tab: Hide action buttons, show only categories */
    #tab-active {
        display: flex !important;
        flex-direction: column !important;
    }

    #tab-active .active-two-column {
        order: 1 !important;
        flex-direction: column;
    }

    /* Hide action buttons on Active tab on mobile */
    #tab-active .mistake-action-bar {
        display: none !important;
    }

    #tab-active .categories-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #2d3842;
        position: sticky;
        top: 0;
        z-index: 100;
        background: #252d36;
        max-height: none;
        overflow-x: auto;
        overflow-y: hidden;
        display: flex;
        flex-wrap: nowrap;
        gap: 6px;
        padding: 10px 12px;
        -webkit-overflow-scrolling: touch;
    }

    #tab-active .categories-sidebar .category-item {
        flex-shrink: 0;
        white-space: nowrap;
        margin-bottom: 0;
        padding: 14px 16px;
        font-size: 14px;
        border-radius: 6px;
        background: #1e2730;
        min-height: 48px;
        display: flex;
        align-items: center;
    }

    #tab-active .instances-main {
        flex: 1;
        overflow-y: auto;
        padding: 12px;
        order: 2 !important;
    }

    /* Hide action buttons on All Issues tab on mobile */
    #tab-all-issues .mistake-action-bar {
        display: none !important;
    }

    /* 4. Gallery view: Stack vertically - stats, YG draft, opponent draft */
    .mistake-issue-gallery-header {
        max-height: 45vh;
        overflow-y: auto;
        padding: 12px !important;
    }

    .mistake-issue-gallery-header>div {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 12px !important;
    }

    .mistake-issue-gallery-header div[style*="display: flex"][style*="gap: 24px"] {
        flex-direction: column !important;
        gap: 12px !important;
        align-items: stretch !important;
    }

    /* Gallery draft container stacks vertically */
    .gallery-draft-container {
        flex-direction: column !important;
        gap: 8px !important;
        align-items: stretch !important;
    }

    .gallery-draft-team {
        min-width: auto !important;
        width: 100% !important;
    }

    /* 5. Issue detail buttons - compact layout (max 2 rows) */
    .instance-card .instance-header,
    .all-issues-container .instance-header {
        flex-wrap: wrap;
        gap: 4px !important;
    }

    .instance-card select,
    .all-issues-container select {
        padding: 4px 6px !important;
        font-size: 11px !important;
        min-width: auto !important;
    }

    .instance-card .instance-impact,
    .all-issues-container .instance-impact {
        padding: 2px 6px !important;
        font-size: 10px !important;
    }

    .instance-card .instance-player-badge,
    .all-issues-container .instance-player-badge {
        padding: 2px 6px !important;
        font-size: 11px !important;
    }
}

/* ====================================================================
   All Issues card — compact layout on mobile portrait
   ==================================================================== */
@media (max-width: 768px) and (orientation: portrait) {
    /* Card itself */
    .instance-card {
        padding: 6px 8px !important;
    }

    /* Meta row: smaller text, tighter gaps */
    .instance-meta {
        gap: 4px !important;
        font-size: 11px !important;
    }
    .instance-meta > span,
    .instance-meta > input,
    .instance-meta > select {
        font-size: 11px !important;
        padding: 1px 4px !important;
    }
    .instance-time-input {
        font-size: 11px !important;
        width: 36px !important;
    }
    .instance-impact {
        padding: 1px 5px !important;
        font-size: 10px !important;
    }
    .instance-phase {
        font-size: 10px !important;
    }

    /* Actions row: icon-only, tight */
    .instance-actions {
        gap: 4px !important;
    }
    .instance-edit-btn,
    .instance-delete-btn,
    .instance-duplicate-btn,
    .instance-share-btn,
    .instance-add-photos-btn {
        padding: 2px 5px !important;
        font-size: 13px !important;
    }
    .instance-status-select {
        font-size: 11px !important;
        padding: 1px 4px !important;
    }

    /* Description text */
    .instance-description {
        font-size: 12px !important;
    }

    /* Screenshots/video: full width, height auto */
    .instance-screenshots {
        grid-template-columns: 1fr !important;
        gap: 8px !important;
        margin-top: 6px !important;
    }
    .instance-screenshot-item img,
    .instance-screenshot-item video {
        height: auto !important;
        max-height: 55vw !important;
        width: 100% !important;
        object-fit: contain !important;
    }
}

/* ====================================================================
   Generic Fullscreen Gallery overlay (mistake-tracker, share, analytics)
   When the overlay is fullscreened, header / side nav / bottom bar
   become absolutely-positioned overlays on top of the video. They
   slide in when the mouse moves and auto-hide 5s after mouse stops.
   ==================================================================== */
.is-fs-gallery.is-fs {
    background: #000 !important;
    cursor: none;
}
.is-fs-gallery.is-fs.controls-visible {
    cursor: default;
}

.is-fs-gallery.is-fs .mistake-issue-gallery-main {
    margin: 0 !important;
    height: 100% !important;
}

.is-fs-gallery.is-fs .issue-image-container {
    margin: 0 !important;
    padding: 0 !important;
    width: 100%;
    height: 100%;
}

/* Header & bottom bar slide from top/bottom */
.is-fs-gallery.is-fs .fs-gallery-header,
.is-fs-gallery.is-fs .fs-gallery-bottom {
    position: absolute !important;
    left: 0;
    right: 0;
    z-index: 50;
    transition: transform 320ms ease, opacity 320ms ease;
    opacity: 0;
    pointer-events: none;
    background: rgba(15, 20, 25, 0.92) !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}
.is-fs-gallery.is-fs .fs-gallery-header {
    top: 0;
    transform: translateY(-100%);
    border-bottom: 1px solid rgba(45, 56, 66, 0.6) !important;
}
.is-fs-gallery.is-fs .fs-gallery-bottom {
    bottom: 0;
    transform: translateY(100%);
    border-top: 1px solid rgba(45, 56, 66, 0.6) !important;
}
.is-fs-gallery.is-fs.controls-visible .fs-gallery-header,
.is-fs-gallery.is-fs.controls-visible .fs-gallery-bottom {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

/* Side nav buttons slide from left / right */
.is-fs-gallery.is-fs .gallery-side-nav {
    transition: transform 320ms ease, opacity 320ms ease;
    opacity: 0;
    pointer-events: none;
    z-index: 50;
}
.is-fs-gallery.is-fs .gallery-side-nav.is-left {
    transform: translateY(-50%) translateX(-110%) !important;
}
.is-fs-gallery.is-fs .gallery-side-nav.is-right {
    transform: translateY(-50%) translateX(110%) !important;
}
.is-fs-gallery.is-fs.controls-visible .gallery-side-nav {
    opacity: 1;
    pointer-events: auto;
}
.is-fs-gallery.is-fs.controls-visible .gallery-side-nav.is-left,
.is-fs-gallery.is-fs.controls-visible .gallery-side-nav.is-right {
    transform: translateY(-50%) translateX(0) !important;
}

/* Push the video's own playback controls up so the gallery bottom bar doesn't cover them */
.is-fs-gallery.is-fs .gv-video-controls {
    bottom: 72px !important;
    transition: opacity 0.25s, bottom 320ms ease;
}