/* =========================================
   Feature 12: Custom Probability Styles
   ========================================= */

/* Modal Variables (Scoped) */
#custom-prob-modal {
    --modal-width: 1000px;
    --brand-blue: #00427A;
    --brand-blue-hover: #00569e;
    --brand-yellow: #FFCC00;
    --brand-light-blue: #60a5fa;
    --glass-border: rgba(255, 255, 255, 0.08);
    --text-muted: #94a3b8;
}

/* Modal Backdrop & Animation Structure */
.modal-backdrop {
    display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0); 
    backdrop-filter: blur(0);
    z-index: 2000; justify-content: center; align-items: center;
    transition: background 0.4s ease, backdrop-filter 0.4s ease;
}
.modal-backdrop.open { 
    display: flex;
    background: rgba(15, 23, 42, 0.85); 
    backdrop-filter: blur(5px); 
}

.modal-content {
    background: #1e293b; border: 1px solid var(--glass-border);
    width: var(--modal-width); max-width: 95vw;
    border-radius: 16px; box-shadow: 0 25px 80px rgba(0,0,0,0.6);
    border-top: 3px solid var(--brand-yellow); 
    display: flex; flex-direction: column; overflow: hidden;
    height: 85vh; max-height: 800px;

    /* START STATE: Landing Style */
    opacity: 0; 
    transform: scale(1.1); 
    filter: blur(20px);
    
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* END STATE: Landing Style */
.modal-backdrop.open .modal-content { 
    opacity: 1; 
    transform: scale(1); 
    filter: blur(0); 
}

/* Header */
.modal-header { 
    padding: 20px 25px; border-bottom: 1px solid var(--glass-border); 
    display: flex; align-items: center; justify-content: space-between; 
    background: rgba(15, 23, 42, 0.3);
}
.modal-header h3 { font-size: 1.1rem; color: #fff; margin: 0; }
.close-modal { color: var(--text-muted); cursor: pointer; transition: 0.2s; font-size: 1.2rem; }
.close-modal:hover { color: #fff; }

/* Toolbar */
.modal-toolbar {
    padding: 10px 25px; background: rgba(0,0,0,0.2);
    display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px solid var(--glass-border);
}
.toolbar-left { color: var(--text-muted); font-size: 13px; font-style: italic; }
.toolbar-actions { display: flex; gap: 8px; }

.text-btn {
    background: transparent; border: 1px solid transparent; 
    color: var(--brand-light-blue); 
    cursor: pointer; font-size: 13px; font-weight: 600; padding: 6px 10px;
    display: flex; align-items: center; gap: 6px; border-radius: 4px; transition: 0.2s;
}
.text-btn:hover { background: rgba(56, 189, 248, 0.1); color: #fff; border-color: rgba(56, 189, 248, 0.3); }

/* Body & Views */
.modal-body { 
    padding: 25px; box-sizing: border-box; overflow-y: hidden; 
    flex: 1; position: relative; 
}

.cp-view { display: none; height: 100%; flex-direction: column; }
.cp-view.active { display: flex; }

/* Table View */
.preview-table { width: 100%; border-collapse: separate; border-spacing: 0 4px; font-size: 12px; table-layout: fixed; }
.preview-table th { text-align: left; padding: 0 4px 6px 4px; color: var(--text-muted); font-weight: 700; text-transform: uppercase; font-size: 10px; border-bottom: 1px solid var(--glass-border); }
.preview-table th:nth-child(n+3) { text-align: center; } 
.preview-table td { padding: 0 4px; color: #fff; background: rgba(255,255,255,0.03); height: 28px; line-height: 28px; }
.preview-table td.invalid-cell { background: rgba(239, 68, 68, 0.15); border: 1px solid rgba(239, 68, 68, 0.3); }

.preview-table th:first-child, .preview-table td:first-child { width: 35px; text-align: center; }
.preview-table td:first-child { color: var(--brand-yellow); font-family: monospace; font-weight: 700; border-radius: 4px 0 0 4px; }
.preview-table th:nth-child(2), .preview-table td:nth-child(2) { width: auto; }
.preview-table th:nth-child(n+3), .preview-table td:nth-child(n+3) { width: 100px; text-align: center; color: var(--text-muted); }
.preview-table td:last-child { border-radius: 0 4px 4px 0; }

.match-cell-wrapper { display: flex; align-items: center; width: 100%; padding-left: 8px; font-weight: 600; }
.vs-sep { color: var(--text-muted); font-size: 10px; margin: 0 6px; font-weight: 400; }

/* Editable Cells */
.preview-table td[contenteditable="true"] { color: var(--brand-yellow); cursor: text; }
.preview-table td[contenteditable="true"]:hover { background: rgba(255,255,255,0.08); }
.preview-table td[contenteditable="true"]:focus { outline: none; background: rgba(255,255,255,0.15); border: 1px solid var(--brand-blue); border-radius: 4px; color: #fff; line-height: 26px; }

/* FIX: Ensure percentage sign appears */
.cell-custom::after { content: '%'; color: #64748b; font-size: 10px; margin-left: 2px; }

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

/* Paste View */
.paste-container { width: 100%; max-width: 500px; display: flex; flex-direction: column; height: 100%; margin: 0 auto; }
.paste-instruction { text-align: center; color: var(--text-muted); font-size: 0.9rem; margin-bottom: 10px; }
#cp-paste-area { flex: 1; width: 100%; background: #0f172a; border: 1px solid var(--glass-border); border-radius: 6px; color: #fff; padding: 15px; font-family: monospace; font-size: 14px; resize: none; margin-bottom: 5px; }
#cp-paste-area:focus { outline: none; border-color: var(--brand-blue); }
#cp-paste-status { font-size: 13px; margin-bottom: 15px; text-align: right; font-weight: 600; min-height: 20px; }
.paste-actions { display: flex; justify-content: space-between; margin-top: auto; }

/* Success View */
.success-content { text-align: center; padding-top: 60px; display: flex; flex-direction: column; align-items: center; height: 100%; }
.success-icon { font-size: 60px; color: #4ade80; margin-bottom: 20px; animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.success-content h2 { color: #fff; margin: 0 0 10px 0; }
.success-content p { color: var(--text-muted); font-size: 0.9rem; }

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

/* Footer & Buttons */
.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; }

.action-button {
    background-color: var(--brand-blue); color: white;
    border: 1px solid rgba(255,255,255,0.1); padding: 10px 20px; font-size: 14px; font-weight: 600;
    border-radius: 6px; cursor: pointer; transition: all 0.2s;
}
.action-button:hover { background-color: var(--brand-blue-hover); border-color: var(--brand-yellow); }
.action-button:disabled { background-color: #334155; color: #64748b; border-color: transparent; cursor: not-allowed; opacity: 0.7; }

.btn-secondary { background-color: transparent; border: 1px solid var(--glass-border); color: var(--text-muted); }
.btn-secondary:hover { background-color: rgba(255,255,255,0.05); color: #fff; }