/* ============================================
   PREGNANCY TEST CALCULATOR - CSS
   Version 1.0
============================================ */

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

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

.ptc-wrap {
    --pink:        #F72585;
    --purple:      #7209B7;
    --violet:      #560BAD;
    --blue:        #480CA8;
    --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%;
}

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

.ptc-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 ---- */
.ptc-header { background: var(--grad); padding: 28px 30px; display: flex; align-items: center; gap: 16px; position: relative; overflow: hidden; }
.ptc-header::after { content: ''; position: absolute; width: 200px; height: 200px; background: rgba(255,255,255,0.06); border-radius: 50%; top: -80px; right: -60px; }
.ptc-header::before { content: ''; position: absolute; width: 120px; height: 120px; background: rgba(255,255,255,0.04); border-radius: 50%; bottom: -40px; left: 30%; }
.ptc-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); }
.ptc-header-icon svg { width: 28px; height: 28px; }
.ptc-header-text { flex: 1; min-width: 0; }
.ptc-header-text h2 { color: #FFFFFF; font-size: 18px; font-weight: 800; letter-spacing: -0.4px; line-height: 1.25; }
.ptc-header-text p { color: rgba(255,255,255,0.75); font-size: 12.5px; font-weight: 400; margin-top: 3px; }

.ptc-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; }
.ptc-history-btn:hover { background: rgba(255,255,255,0.28); }

/* ---- History Panel ---- */
.ptc-history-panel { max-height: 0; overflow: hidden; transition: max-height 0.35s ease; background: #FAFAFF; border-bottom: 1px solid var(--border); }
.ptc-history-panel.ptc-history-open { max-height: 320px; overflow-y: auto; }
.ptc-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; }
.ptc-history-clear { background: none; border: none; color: var(--pink); font-size: 11px; font-weight: 700; cursor: pointer; }
.ptc-history-list { padding: 4px 20px 16px; display: flex; flex-direction: column; gap: 8px; }
.ptc-history-empty { font-size: 13px; color: var(--text-muted); padding: 12px 0; text-align: center; }
.ptc-history-item { background: white; border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 10px 14px; }
.ptc-history-item-date { font-size: 12.5px; font-weight: 700; color: var(--text); }
.ptc-history-item-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ---- Intro ---- */
.ptc-intro { font-size: 13px; color: var(--text-muted); line-height: 1.6; padding: 16px 30px 0; }
.ptc-intro strong { color: var(--text); }

/* ---- Mode Toggle ---- */
.ptc-mode-toggle { display: flex; gap: 8px; padding: 14px 30px 0; }
.ptc-mode-btn {
    flex: 1; padding: 12px 8px;
    border: 1.5px solid var(--border);
    background: white;
    border-radius: var(--radius-md);
    font-size: 12.5px; font-weight: 700;
    font-family: 'Inter', sans-serif;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.25s ease;
}
.ptc-mode-btn.ptc-mode-active { background: var(--grad); color: white; border-color: transparent; box-shadow: 0 6px 16px rgba(247,37,133,0.30); }

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

.ptc-step-label { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.ptc-step-label span { font-size: 13px; font-weight: 700; color: var(--text); letter-spacing: 0.1px; }
.ptc-optional { font-weight: 400; color: #A5A0B0; font-size: 11px; }

.ptc-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;
}
.ptc-help-btn:hover { background: var(--grad); color: white; border-color: transparent; }

/* Date Input */
.ptc-date-wrap { position: relative; display: flex; align-items: center; }
.ptc-date-icon { position: absolute; left: 14px; color: var(--purple); display: flex; align-items: center; pointer-events: none; z-index: 1; }
.ptc-date-icon svg { width: 20px; height: 20px; }
.ptc-date-wrap input[type="date"] {
    width: 100%; padding: 14px 16px 14px 46px;
    border: 2px solid var(--border); border-radius: var(--radius-md);
    font-size: 15px; font-family: 'Inter', sans-serif; font-weight: 500;
    color: var(--text); background: #FAFAFF; cursor: pointer;
    appearance: none; -webkit-appearance: none; outline: none;
    transition: all 0.25s ease;
}
.ptc-date-wrap input[type="date"]:focus { border-color: var(--pink); background: white; box-shadow: 0 0 0 4px rgba(247,37,133,0.08); }

/* Cycle Length */
.ptc-cycle-wrap { display: flex; align-items: center; gap: 12px; }
.ptc-cycle-input-wrap { display: flex; align-items: center; gap: 0; background: white; border-radius: var(--radius-sm); border: 1.5px solid var(--border); overflow: hidden; }
.ptc-cycle-btn { width: 36px; height: 36px; background: transparent; border: none; cursor: pointer; font-size: 18px; font-weight: 700; color: var(--purple); display: flex; align-items: center; justify-content: center; transition: background 0.2s; line-height: 1; }
.ptc-cycle-btn:hover { background: var(--grad-soft); }
.ptc-cycle-input-wrap input[type="number"] { width: 60px; text-align: center; border: none; border-left: 1.5px solid var(--border); border-right: 1.5px solid var(--border); font-size: 15px; font-weight: 700; font-family: 'Inter', sans-serif; color: var(--text); background: white; padding: 0; height: 36px; outline: none; -moz-appearance: textfield; }
.ptc-cycle-input-wrap input[type="number"]::-webkit-inner-spin-button, .ptc-cycle-input-wrap input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; }
.ptc-cycle-note { font-size: 13px; color: var(--text-muted); font-weight: 500; }

/* Select */
.ptc-select-wrap { position: relative; }
.ptc-select-wrap select {
    width: 100%; padding: 14px 46px 14px 16px;
    border: 2px solid var(--border); border-radius: var(--radius-md);
    font-size: 14px; font-family: 'Inter', sans-serif; font-weight: 600;
    color: var(--text); background: #FAFAFF; cursor: pointer;
    appearance: none; -webkit-appearance: none; outline: none;
    transition: all 0.25s ease;
}
.ptc-select-wrap select:focus { border-color: var(--pink); background: white; box-shadow: 0 0 0 4px rgba(247,37,133,0.08); }
.ptc-select-arrow { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--purple); pointer-events: none; }

/* Custom Sensitivity */
.ptc-custom-wrap { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.ptc-plain-input {
    flex: 1; padding: 12px 14px;
    border: 2px solid var(--border); border-radius: var(--radius-md);
    font-size: 15px; font-family: 'Inter', sans-serif; font-weight: 600;
    color: var(--text); background: #FAFAFF; outline: none;
    transition: all 0.25s ease;
}
.ptc-plain-input:focus { border-color: var(--pink); background: white; box-shadow: 0 0 0 4px rgba(247,37,133,0.08); }
.ptc-custom-suffix { font-size: 13px; color: var(--text-muted); font-weight: 600; }

/* ---- Calculate Button ---- */
#ptc_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);
}
#ptc_btn::before { content: ''; position: absolute; inset: 0; background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent); opacity: 0; transition: opacity 0.3s; }
#ptc_btn:hover { transform: translateY(-2px); box-shadow: 0 18px 40px rgba(247,37,133,0.50); }
#ptc_btn:hover::before { opacity: 1; }
.ptc-btn-text { font-size: 16px; font-weight: 700; }
.ptc-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 ---- */
.ptc-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; }
.ptc-help-overlay.ptc-help-open { display: flex; }
.ptc-help-popover { background: white; border-radius: var(--radius-lg); padding: 24px; max-width: 380px; width: 100%; box-shadow: 0 24px 60px rgba(0,0,0,0.3); }
.ptc-help-popover-title { font-size: 16px; font-weight: 800; color: var(--pink); margin-bottom: 10px; }
.ptc-help-popover-text { font-size: 13.5px; color: var(--text); line-height: 1.65; margin-bottom: 18px; }
.ptc-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 ---- */
.ptc-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%);
}
.ptc-result-visible { opacity: 1 !important; transform: translateY(0) !important; }
.ptc-result-header { display: flex; justify-content: center; margin-bottom: 20px; }
.ptc-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); }

/* Urine Test Big Card */
.ptc-due-card {
    background: var(--grad); border-radius: var(--radius-lg); padding: 24px;
    text-align: center; margin-bottom: 16px; position: relative; overflow: hidden;
    box-shadow: 0 16px 40px rgba(247,37,133,0.25);
}
.ptc-due-card::before { content: ''; position: absolute; width: 150px; height: 150px; background: rgba(255,255,255,0.07); border-radius: 50%; top: -50px; right: -30px; }
.ptc-due-card::after { content: ''; position: absolute; width: 100px; height: 100px; background: rgba(255,255,255,0.05); border-radius: 50%; bottom: -30px; left: -20px; }
.ptc-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; }
.ptc-due-date { color: white; font-size: 20px; font-weight: 800; letter-spacing: -0.5px; line-height: 1.2; margin-bottom: 8px; }
.ptc-due-sub { color: rgba(255,255,255,0.85); font-size: 13px; font-weight: 600; }

/* Blood Test Card */
.ptc-blood-card { display: flex; gap: 14px; align-items: flex-start; background: white; border: 1.5px solid var(--border); border-radius: var(--radius-md); padding: 16px 18px; margin-bottom: 20px; }
.ptc-blood-icon { font-size: 22px; flex-shrink: 0; }
.ptc-blood-label { font-size: 11px; color: var(--text-muted); font-weight: 600; margin-bottom: 4px; }
.ptc-blood-val { font-size: 15px; font-weight: 800; color: var(--text); margin-bottom: 4px; }
.ptc-blood-sub { font-size: 11px; color: var(--text-muted); line-height: 1.5; }

/* Planned Test Date Check */
.ptc-planned-card { background: var(--grad-soft); border: 1.5px solid var(--border); border-radius: var(--radius-md); padding: 16px 18px; margin-bottom: 20px; }
.ptc-planned-title { font-size: 13px; font-weight: 800; color: var(--text); margin-bottom: 10px; }
.ptc-planned-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); }
.ptc-planned-row:first-of-type { border-top: none; padding-top: 0; }
.ptc-planned-label { font-size: 12.5px; color: var(--text-muted); }
.ptc-planned-label strong { color: var(--text); }
.ptc-planned-tag { font-size: 11px; font-weight: 800; padding: 4px 10px; border-radius: 100px; flex-shrink: 0; }
.ptc-tag-early { background: rgba(232,163,61,0.18); color: #B4780A; }
.ptc-tag-ok { background: rgba(6,167,125,0.15); color: #05664D; }

/* Stats Row */
.ptc-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px; }
.ptc-stat-card { background: white; border: 1.5px solid var(--border); border-radius: var(--radius-md); padding: 16px 10px; text-align: center; transition: all 0.25s ease; }
.ptc-stat-card:hover { border-color: var(--pink); box-shadow: 0 6px 20px rgba(247,37,133,0.10); transform: translateY(-2px); }
.ptc-stat-icon { font-size: 22px; margin-bottom: 8px; line-height: 1; }
.ptc-stat-value { font-size: 13px; font-weight: 800; color: var(--text); letter-spacing: -0.3px; line-height: 1.2; margin-bottom: 4px; }
.ptc-stat-label { font-size: 10.5px; color: var(--text-muted); font-weight: 500; line-height: 1.3; }

/* Explainer */
.ptc-explainer-card { background: var(--grad-soft); border: 1.5px solid var(--border); border-radius: var(--radius-md); padding: 16px 18px; margin-bottom: 20px; }
.ptc-explainer-title { font-size: 13px; font-weight: 800; color: var(--text); margin-bottom: 8px; }
.ptc-explainer-card p { font-size: 12px; color: var(--text-muted); line-height: 1.6; }
.ptc-explainer-card strong { color: var(--text); }

/* Export Buttons */
.ptc-export-row { display: flex; gap: 12px; }
.ptc-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;
}
.ptc-export-btn:hover { border-color: var(--pink); background: var(--grad-soft); color: var(--pink); transform: translateY(-1px); }
.ptc-export-btn svg { flex-shrink: 0; }

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

/* ---- Mobile ---- */
@media (max-width: 580px) {
    .ptc-wrap { padding: 20px 10px; }
    .ptc-card { border-radius: var(--radius-lg); }
    .ptc-header { padding: 22px 20px; }
    .ptc-intro { padding: 14px 20px 0; }
    .ptc-mode-toggle { padding: 12px 20px 0; }
    .ptc-body { padding: 20px 20px 22px; gap: 18px; }
    .ptc-result { padding: 22px 20px; }
    .ptc-footer { padding: 14px 20px 20px; }
    .ptc-due-date { font-size: 16px; }
    .ptc-stats { gap: 8px; }
    .ptc-stat-value { font-size: 11px; }
    .ptc-stat-card { padding: 12px 6px; }
    .ptc-header-text h2 { font-size: 16px; }
    .ptc-export-row { flex-direction: column; }
    .ptc-history-item-load { align-self: flex-end; }
}
