/* =========================================
   FEATURE 7: IMPORTER STYLES (ID-Scoped Fix)
   ========================================= */

/* --- MODAL OVERLAY --- */
#paste-modal-overlay.modal-overlay {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(15, 23, 42, 0.85) !important;
    backdrop-filter: blur(5px);
    z-index: 9000 !important;
    display: none; justify-content: center; align-items: center;
    opacity: 0; transition: opacity 0.3s ease;
}
#paste-modal-overlay.modal-overlay.active { display: flex !important; opacity: 1 !important; }

/* --- MODAL CONTENT (Forced Width) --- */
#paste-modal-overlay .modal-content {
    background: var(--panel-color) !important;
    border: 1px solid var(--glass-border) !important;
    border-top: 2px solid var(--brand-yellow) !important;
    border-radius: 16px;
    
    /* FORCE WIDTH with ID specificity */
    /* UPDATED: Reduced from 1400px to 1000px */
    width: 1000px !important; 
    max-width: 95vw !important; 
    
    height: auto !important; 
    max-height: 95vh;
    
    box-shadow: 0 25px 80px rgba(0,0,0,0.6) !important;
    display: flex; flex-direction: column; overflow: hidden;
    
    opacity: 0; transform: scale(1.1); filter: blur(20px);
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}
#paste-modal-overlay.active .modal-content {
    opacity: 1 !important; transform: scale(1) !important; filter: blur(0) !important;
}

/* --- STEPS --- */
#paste-modal-overlay .modal-step { 
    display: none !important; 
    flex-direction: column; 
    width: 100%; 
    height: auto !important; 
}
#paste-modal-overlay .modal-step.active { display: flex !important; animation: stepFade 0.3s ease-out; }
@keyframes stepFade { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* --- HEADER & FOOTER --- */
#paste-modal-overlay .modal-header { padding: 15px 25px; border-bottom: 1px solid var(--glass-border); display: flex; align-items: center; justify-content: space-between; background: rgba(0,0,0,0.2); }
#paste-modal-overlay .modal-header h3 { font-size: 1.1rem; color: #fff; margin: 0; font-family: 'Segoe UI', sans-serif; }
#paste-modal-overlay .close-modal { color: var(--text-muted); cursor: pointer; transition: 0.2s; }
#paste-modal-overlay .close-modal:hover { color: #fff; }

#paste-modal-overlay .modal-body { 
    padding: 20px 25px; 
    box-sizing: border-box;
    overflow: visible; 
    flex-grow: 0 !important; 
}
#paste-modal-overlay .modal-body p { margin-top: 0; margin-bottom: 15px; font-size: 0.85rem; color: var(--text-muted); }

#paste-modal-overlay .modal-footer { padding: 15px 25px; border-top: 1px solid var(--glass-border); background: rgba(0,0,0,0.2); display: flex; justify-content: flex-end; gap: 10px; }

/* --- STEP 1: PASTE INPUT --- */
#paste-modal-overlay textarea#paste-textarea { 
    width: 100%; 
    /* UPDATED: Increased from 150px to 300px */
    height: 300px; 
    background: var(--input-bg); 
    border: 1px solid var(--glass-border); color: #fff; border-radius: 6px; 
    padding: 15px; font-family: 'Segoe UI', monospace; font-size: 13px; resize: none; 
    box-sizing: border-box; 
    display: block;
}
#paste-modal-overlay textarea:focus { outline: 1px solid var(--brand-blue); border-color: var(--brand-blue); }

/* =================================================================
   PREVIEW TABLE STYLES (Scoped to Modal ID)
   ================================================================= */

#paste-modal-overlay .preview-table { 
    width: 100%; 
    border-collapse: separate; 
    border-spacing: 0 4px; 
    font-size: 12px; 
    table-layout: fixed; /* Fixed layout works now that width is forced */
}

#paste-modal-overlay .preview-table th { 
    text-align: left; padding: 0 4px 6px 4px; color: var(--text-muted); 
    font-weight: 700; text-transform: uppercase; font-size: 10px; letter-spacing: 0.5px; 
    border-bottom: 1px solid var(--glass-border); white-space: nowrap; 
}
#paste-modal-overlay .preview-table th:nth-child(n+3) { text-align: center; }

#paste-modal-overlay .preview-table td { 
    padding: 0 4px; 
    color: var(--text-muted); 
    background: rgba(255,255,255,0.03); 
    height: 28px; line-height: 28px; vertical-align: middle; 
    white-space: nowrap; overflow: visible; 
}

/* DATA COLUMNS - EXPLICIT COLOR FIX */
/* Targeting specific classes ensures we override generic TD styles */
#paste-modal-overlay .preview-table .cell-odds,
#paste-modal-overlay .preview-table .cell-people {
    width: 60px; 
    font-family: 'Segoe UI', sans-serif; 
    font-variant-numeric: tabular-nums; 
    text-align: center;
    color: #94a3b8 !important; /* FORCE GRAY */
}

/* 1. MATCH NUM */
#paste-modal-overlay .preview-table th:first-child, 
#paste-modal-overlay .preview-table td:first-child { 
    width: 35px; text-align: center; padding-left: 2px; 
    font-family: 'Segoe UI', sans-serif !important;
}
#paste-modal-overlay .preview-table td:first-child { color: var(--brand-yellow); font-weight: 700; border-top-left-radius: 4px; border-bottom-left-radius: 4px; }

/* 2. MATCH NAME */
#paste-modal-overlay .preview-table th:nth-child(2), 
#paste-modal-overlay .preview-table td:nth-child(2) { 
    width: auto; 
    min-width: 300px; 
}

/* 4. THE SEPARATOR */
#paste-modal-overlay .preview-table th:nth-child(5), 
#paste-modal-overlay .preview-table td:nth-child(5) { 
    border-right: 1px solid rgba(255, 255, 255, 0.15); 
    padding-right: 15px; 
}
#paste-modal-overlay .preview-table th:nth-child(6), 
#paste-modal-overlay .preview-table td:nth-child(6) { 
    padding-left: 15px; 
}

#paste-modal-overlay .preview-table td:last-child { border-top-right-radius: 4px; border-bottom-right-radius: 4px; }

/* Invalid Cell */
#paste-modal-overlay .preview-table td.invalid-cell { background: rgba(239, 68, 68, 0.15); border: 1px solid rgba(239, 68, 68, 0.3); }

/* EDITABLE FIELDS */
#paste-modal-overlay .match-cell-wrapper { 
    display: flex; 
    align-items: center; 
    /* FORCE LEFT ALIGNMENT: Items will pack to the left */
    justify-content: flex-start; 
    width: 100%; 
    padding-left: 8px;
    height: 100%; 
}

/* TEAM NAME STYLES */
#paste-modal-overlay .team-edit {
    color: #fff; font-weight: 600; cursor: text; 
    
    /* DYNAMIC WIDTH LOGIC */
    flex: 0 0 auto; /* Do not grow, do not shrink, fit to content */
    width: auto;    /* Width determined by text length */
    max-width: 180px; /* Cap it so really long names don't break the table */
    
    min-width: 20px;
    overflow: hidden; 
    text-overflow: ellipsis; 
    white-space: nowrap;
    outline: none; transition: color 0.2s; 
    border-bottom: 1px solid transparent; 
    text-align: left; 
}

#paste-modal-overlay .team-edit.placeholder-text {
    color: #ef4444 !important; 
    font-style: italic;
    font-weight: 400;
}

#paste-modal-overlay .team-edit:focus { border-bottom-color: var(--brand-blue); }
#paste-modal-overlay .team-edit:hover { color: var(--brand-yellow); }

/* VS SEPARATOR - SPECIFIC GAP */
#paste-modal-overlay .vs-sep { 
    color: var(--text-muted); 
    font-size: 10px; 
    font-weight: 400; 
    user-select: none;
    
    /* GAP SETTINGS */
    margin-left: 12px !important;  /* Distance from Home Team */
    margin-right: 12px !important; /* Distance to Away Team */
}

#paste-modal-overlay .cell-people::after { content: '%'; color: inherit; font-size: 10px; margin-left: 1px; opacity: 0.7; }
#paste-modal-overlay .preview-table br { display: none; }

/* STATUS MESSAGE */
#paste-modal-overlay .status-message {
    display: none; padding: 12px 15px; border-radius: 6px; margin-bottom: 15px; font-size: 13px; line-height: 1.4; align-items: center; gap: 10px;
}
#paste-modal-overlay .status-message.warning { display: flex; background: rgba(255, 152, 0, 0.1); color: #fbbf24; border: 1px solid rgba(251, 191, 36, 0.3); }
#paste-modal-overlay .status-message.success { display: flex; background: rgba(34, 197, 94, 0.1); color: #4ade80; border: 1px solid rgba(34, 197, 94, 0.3); }

/* --- STEP 3: SUCCESS VIEW --- */
#paste-modal-overlay .success-view { text-align: center; padding: 20px 30px !important; }
#paste-modal-overlay .success-view i { margin-bottom: 10px; display: block; font-size: 50px !important; }
#paste-modal-overlay .success-view h2 { margin: 5px 0 10px 0; font-size: 1.4rem; color: #fff; }
#paste-modal-overlay .success-view p { margin-bottom: 15px; font-size: 0.95rem; }
#paste-modal-overlay .success-view button { width: auto; padding: 10px 40px; display: inline-block; margin: 0 auto; }