/* ============================================
   BISHOP SCORE CALCULATOR - CSS
   Version 1.0
============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

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

.bsc-wrap {
    --pink:        #F72585;
    --purple:      #7209B7;
    --violet:      #560BAD;
    --blue:        #480CA8;
    --green:       #06A77D;
    --amber:       #E8A33D;
    --red:         #E5484D;
    --grad:        linear-gradient(135deg, #F72585 0%, #7209B7 100%);
    --grad-soft:   linear-gradient(135deg, rgba(247,37,133,0.08) 0%, rgba(114,9,183,0.08) 100%);
    --white:       #FFFFFF;
    --bg:          #F8F4FF;
    --card-bg:     #FFFFFF;
    --border:      rgba(114,9,183,0.12);
    --text:        #1A1A2E;
    --text-muted:  #6B7280;
    --shadow-card: 0 32px 80px rgba(114,9,183,0.18), 0 8px 24px rgba(247,37,133,0.10);
    --shadow-btn:  0 12px 32px rgba(247,37,133,0.45);
    --radius-xl:   24px;
    --radius-lg:   16px;
    --radius-md:   12px;
    --radius-sm:   8px;
    font-family: 'Inter', sans-serif;
    position: relative;
    padding: 40px 16px;
    background: var(--bg);
    min-height: 100%;
}

.bsc-blob { position: absolute; border-radius: 50%; filter: blur(60px); pointer-events: none; z-index: 0; }
.bsc-blob-1 { width: 300px; height: 300px; background: rgba(247,37,133,0.12); top: -60px; left: -80px; }
.bsc-blob-2 { width: 250px; height: 250px; background: rgba(114,9,183,0.10); bottom: 40px; right: -60px; }
.bsc-blob-3 { width: 180px; height: 180px; background: rgba(72,12,168,0.08); top: 50%; left: 50%; transform: translate(-50%,-50%); }

.bsc-card {
    position: relative;
    z-index: 1;
    max-width: 560px;
    margin: 0 auto;
    background: var(--card-bg);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    border: 1px solid var(--border);
}

/* ---- Header ---- */
.bsc-header {
    background: var(--grad);
    padding: 28px 30px;
    display: flex;
    align-items: center;
    gap: 16px;
    position: relative;
    overflow: hidden;
}
.bsc-header::after { content: ''; position: absolute; width: 200px; height: 200px; background: rgba(255,255,255,0.06); border-radius: 50%; top: -80px; right: -60px; }
.bsc-header::before { content: ''; position: absolute; width: 120px; height: 120px; background: rgba(255,255,255,0.04); border-radius: 50%; bottom: -40px; left: 30%; }

.bsc-header-icon {
    width: 52px; height: 52px;
    background: rgba(255,255,255,0.18);
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.25);
}
.bsc-header-icon svg { width: 28px; height: 28px; }
.bsc-header-text { flex: 1; min-width: 0; }
.bsc-header-text h2 { color: #FFFFFF; font-size: 18px; font-weight: 800; letter-spacing: -0.4px; line-height: 1.25; }
.bsc-header-text p { color: rgba(255,255,255,0.75); font-size: 12.5px; font-weight: 400; margin-top: 3px; }

.bsc-history-btn {
    width: 40px; height: 40px;
    background: rgba(255,255,255,0.18);
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    position: relative;
    z-index: 2;
    transition: background 0.2s;
}
.bsc-history-btn:hover { background: rgba(255,255,255,0.28); }

/* ---- History Panel ---- */
.bsc-history-panel {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
    background: #FAFAFF;
    border-bottom: 1px solid var(--border);
}
.bsc-history-panel.bsc-history-open { max-height: 320px; overflow-y: auto; }
.bsc-history-top { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px 8px; font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.6px; }
.bsc-history-clear { background: none; border: none; color: var(--pink); font-size: 11px; font-weight: 700; cursor: pointer; }
.bsc-history-list { padding: 4px 20px 16px; display: flex; flex-direction: column; gap: 8px; }
.bsc-history-empty { font-size: 13px; color: var(--text-muted); padding: 12px 0; text-align: center; }
.bsc-history-item { display: flex; align-items: center; justify-content: space-between; background: white; border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 10px 14px; }
.bsc-history-item-score { font-size: 13px; font-weight: 800; color: var(--text); }
.bsc-history-item-date { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }
.bsc-history-item-load { background: var(--grad-soft); border: none; color: var(--purple); font-size: 12px; font-weight: 700; padding: 6px 14px; border-radius: 100px; cursor: pointer; flex-shrink: 0; }
.bsc-history-item-load:hover { background: var(--grad); color: white; }

/* ---- Body ---- */
.bsc-body { padding: 24px 30px 28px; display: flex; flex-direction: column; gap: 20px; }

/* ---- Field ---- */
.bsc-field { padding: 4px; border-radius: var(--radius-md); transition: box-shadow 0.25s; }
.bsc-field.bsc-field-missing { box-shadow: 0 0 0 2px var(--red); }
.bsc-field-label { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.bsc-field-label span { font-size: 13.5px; font-weight: 700; color: var(--text); }
.bsc-field.bsc-field-done .bsc-field-label span::after { content: ' ✓'; color: var(--green); font-weight: 800; }

.bsc-help-btn {
    width: 20px; height: 20px;
    border-radius: 50%;
    background: var(--grad-soft);
    border: 1px solid var(--border);
    color: var(--purple);
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s;
}
.bsc-help-btn:hover { background: var(--grad); color: white; border-color: transparent; }

/* ---- Option Grid ---- */
.bsc-option-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.bsc-option-grid-3 { grid-template-columns: repeat(3, 1fr); }
.bsc-option-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 12px 6px;
    border: 1.5px solid var(--border);
    background: white;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s ease;
}
.bsc-option-btn em { font-style: normal; font-size: 9.5px; font-weight: 600; color: var(--text-muted); }
.bsc-option-btn:hover { border-color: rgba(114,9,183,0.35); }
.bsc-option-btn.bsc-option-active { background: var(--grad); color: white; border-color: transparent; box-shadow: 0 4px 12px rgba(247,37,133,0.30); }
.bsc-option-btn.bsc-option-active em { color: rgba(255,255,255,0.85); }

/* ---- Calculate Button ---- */
#bsc_btn {
    width: 100%;
    padding: 16px 24px;
    background: var(--grad);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    gap: 10px;
    letter-spacing: 0.3px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-btn);
}
#bsc_btn::before { content: ''; position: absolute; inset: 0; background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent); opacity: 0; transition: opacity 0.3s; }
#bsc_btn:hover { transform: translateY(-2px); box-shadow: 0 18px 40px rgba(247,37,133,0.50); }
#bsc_btn:hover::before { opacity: 1; }
.bsc-btn-text { font-size: 16px; font-weight: 700; }
.bsc-btn-icon { display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; background: rgba(255,255,255,0.20); border-radius: 50%; }

/* ---- Help Popover ---- */
.bsc-help-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(26,26,46,0.55);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.bsc-help-overlay.bsc-help-open { display: flex; }
.bsc-help-popover {
    background: white;
    border-radius: var(--radius-lg);
    padding: 24px;
    max-width: 360px;
    width: 100%;
    box-shadow: 0 24px 60px rgba(0,0,0,0.3);
}
.bsc-help-popover-title { font-size: 16px; font-weight: 800; color: var(--pink); margin-bottom: 10px; }
.bsc-help-popover-text { font-size: 13.5px; color: var(--text); line-height: 1.65; margin-bottom: 18px; }
.bsc-help-close {
    width: 100%;
    padding: 10px;
    background: var(--grad);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
}

/* ---- Result Section ---- */
.bsc-result {
    display: none;
    opacity: 0;
    transform: translateY(16px);
    transition: all 0.45s cubic-bezier(0.34,1.56,0.64,1);
    border-top: 1px solid var(--border);
    padding: 28px 30px;
    background: linear-gradient(180deg, rgba(247,37,133,0.02) 0%, rgba(114,9,183,0.03) 100%);
}
.bsc-result-visible { opacity: 1 !important; transform: translateY(0) !important; }

.bsc-result-header { display: flex; justify-content: center; margin-bottom: 20px; }
.bsc-result-badge { background: var(--grad); color: white; padding: 6px 18px; border-radius: 100px; font-size: 13px; font-weight: 700; letter-spacing: 0.5px; box-shadow: 0 4px 14px rgba(247,37,133,0.30); }

/* Score Big Card */
.bsc-due-card {
    background: var(--grad);
    border-radius: var(--radius-lg);
    padding: 24px;
    text-align: center;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 16px 40px rgba(247,37,133,0.25);
    transition: background 0.3s ease;
}
.bsc-due-card::before { content: ''; position: absolute; width: 150px; height: 150px; background: rgba(255,255,255,0.07); border-radius: 50%; top: -50px; right: -30px; }
.bsc-due-card::after { content: ''; position: absolute; width: 100px; height: 100px; background: rgba(255,255,255,0.05); border-radius: 50%; bottom: -30px; left: -20px; }
.bsc-due-label { color: rgba(255,255,255,0.80); font-size: 12px; font-weight: 600; letter-spacing: 1.2px; text-transform: uppercase; margin-bottom: 10px; }
.bsc-due-date { color: white; font-size: 36px; font-weight: 800; letter-spacing: -0.5px; line-height: 1.2; margin-bottom: 8px; }
.bsc-due-sub { color: rgba(255,255,255,0.85); font-size: 13px; font-weight: 600; }

.bsc-score-low { background: linear-gradient(135deg, #E5484D 0%, #AD2831 100%); }
.bsc-score-mid { background: linear-gradient(135deg, #E8A33D 0%, #C97A0F 100%); }
.bsc-score-high { background: linear-gradient(135deg, #06A77D 0%, #05664D 100%); }

/* Breakdown Card */
.bsc-breakdown-card { background: white; border: 1.5px solid var(--border); border-radius: var(--radius-md); padding: 16px 18px; margin-bottom: 20px; }
.bsc-breakdown-title { font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 12px; }
.bsc-breakdown-list { display: flex; flex-direction: column; }
.bsc-breakdown-row { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); font-size: 12.5px; }
.bsc-breakdown-row:first-child { border-top: none; padding-top: 0; }
.bsc-breakdown-key { color: var(--text-muted); font-weight: 500; }
.bsc-breakdown-val { color: var(--text); font-weight: 700; text-align: right; }

/* Interpretation Guide */
.bsc-guide-card { background: white; border: 1.5px solid var(--border); border-radius: var(--radius-md); padding: 16px 18px; margin-bottom: 20px; }
.bsc-guide-title { font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 12px; }
.bsc-guide-bands { display: flex; flex-direction: column; gap: 10px; }
.bsc-guide-band { display: flex; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm); background: #FAFAFF; border: 1.5px solid var(--border); opacity: 0.55; transition: all 0.25s; }
.bsc-guide-band.bsc-band-active { opacity: 1; border-color: var(--pink); background: var(--grad-soft); }
.bsc-guide-band-range { font-size: 13px; font-weight: 800; color: var(--purple); flex-shrink: 0; width: 40px; }
.bsc-guide-band-text { font-size: 11.5px; color: var(--text-muted); line-height: 1.5; }
.bsc-guide-band.bsc-band-active .bsc-guide-band-text { color: var(--text); }

/* Save Button */
.bsc-save-btn {
    width: 100%;
    padding: 12px 16px;
    background: white;
    border: 1.5px dashed var(--purple);
    border-radius: var(--radius-md);
    color: var(--purple);
    font-size: 13px;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    margin-bottom: 16px;
    transition: all 0.25s ease;
}
.bsc-save-btn:hover { background: var(--grad-soft); }

/* Export Buttons */
.bsc-export-row { display: flex; gap: 12px; }
.bsc-export-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 14px;
    background: white;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    color: var(--purple);
    cursor: pointer;
    transition: all 0.25s ease;
}
.bsc-export-btn:hover { border-color: var(--pink); background: var(--grad-soft); color: var(--pink); transform: translateY(-1px); }
.bsc-export-btn svg { flex-shrink: 0; }

/* ---- Footer ---- */
.bsc-footer {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 16px 30px 24px;
    font-size: 11.5px;
    color: var(--text-muted);
    line-height: 1.6;
    border-top: 1px solid var(--border);
    background: #FAFAFF;
}
.bsc-footer svg { flex-shrink: 0; margin-top: 2px; color: var(--purple); }

/* ---- Mobile ---- */
@media (max-width: 580px) {
    .bsc-wrap { padding: 20px 10px; }
    .bsc-card { border-radius: var(--radius-lg); }
    .bsc-header { padding: 22px 20px; }
    .bsc-body { padding: 20px 20px 22px; gap: 18px; }
    .bsc-result { padding: 22px 20px; }
    .bsc-footer { padding: 14px 20px 20px; }
    .bsc-due-date { font-size: 28px; }
    .bsc-header-text h2 { font-size: 16px; }
    .bsc-export-row { flex-direction: column; }
    .bsc-option-grid { grid-template-columns: repeat(2, 1fr); }
    .bsc-option-grid-3 { grid-template-columns: repeat(3, 1fr); }
    .bsc-history-item { flex-direction: column; align-items: flex-start; gap: 8px; }
    .bsc-history-item-load { align-self: flex-end; }
    .bsc-breakdown-row { flex-direction: column; gap: 2px; }
    .bsc-breakdown-val { text-align: left; }
}
