/* ============================================
   FRACTIONS CALCULATOR PRO - CSS
   Version 1.0
============================================ */

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

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

.c24frc-wrap {
    --blue:        #0D9488;
    --darkblue:    #0F2A3D;
    --cyan:        #14B8A6;
    --amber:       #E8A33D;
    --red:         #E0554F;
    --grad:        #0D9488;
    --grad-soft:   rgba(13,148,136,0.08);
    --white:       #FFFFFF;
    --bg:          #F2F7F6;
    --card-bg:     #FFFFFF;
    --border:      rgba(13,148,136,0.14);
    --text:        #0F2A3D;
    --text-muted:  #5C7A80;
    --shadow-card: 0 32px 80px rgba(15,42,61,0.16), 0 8px 24px rgba(13,148,136,0.10);
    --shadow-btn:  0 12px 32px rgba(13,148,136,0.40);
    --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%;
    color: var(--text);
}

.c24frc-blob { position: absolute; border-radius: 50%; filter: blur(60px); pointer-events: none; z-index: 0; }
.c24frc-blob-1 { width: 300px; height: 300px; background: rgba(13,148,136,0.14); top: -60px; left: -80px; }
.c24frc-blob-2 { width: 250px; height: 250px; background: rgba(15,42,61,0.10); bottom: 40px; right: -60px; }

.c24frc-card {
    position: relative;
    z-index: 1;
    max-width: 620px;
    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 ---- */
.c24frc-header { background: var(--grad); padding: 26px 28px; display: flex; align-items: center; justify-content: space-between; gap: 16px; position: relative; overflow: hidden; }
.c24frc-header::after { content: ''; position: absolute; width: 200px; height: 200px; background: rgba(255,255,255,0.06); border-radius: 50%; top: -80px; right: -60px; }
.c24frc-header-left { display: flex; align-items: center; gap: 16px; position: relative; z-index: 1; min-width: 0; }
.c24frc-header-icon { width: 50px; height: 50px; 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); }
.c24frc-header-text h1 { color: #fff; font-size: 17px; font-weight: 800; letter-spacing: -0.4px; line-height: 1.25; }
.c24frc-header-text p { color: rgba(255,255,255,0.75); font-size: 12px; margin-top: 3px; }
.c24frc-icon-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; }
.c24frc-icon-btn:hover { background: rgba(255,255,255,0.28); }

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

/* ---- Explainer ---- */
.c24frc-explainer { border-bottom: 1px solid var(--border); }
.c24frc-explainer-toggle {
    width: 100%; display: flex; align-items: center; justify-content: space-between;
    padding: 16px 28px; background: var(--grad-soft); border: none; cursor: pointer;
    font-size: 13.5px; font-weight: 700; color: var(--text); font-family: 'Inter', sans-serif;
}
.c24frc-explainer-toggle svg { color: var(--blue); transition: transform 0.25s ease; flex-shrink: 0; }
#c24frc-explainer_arrow.c24frc-explainer-arrow-open { transform: rotate(180deg); }
.c24frc-explainer-body { max-height: 0; overflow: hidden; transition: max-height 0.4s ease; padding: 0 28px; }
.c24frc-explainer-body.c24frc-explainer-open { max-height: 320px; padding: 16px 28px; }
.c24frc-explainer-body p { font-size: 12.5px; color: var(--text-muted); line-height: 1.65; margin-bottom: 10px; }
.c24frc-explainer-body p:last-child { margin-bottom: 0; }
.c24frc-explainer-body strong { color: var(--text); }

/* ---- Mode tabs ---- */
.c24frc-mode-tabs { display: flex; gap: 8px; padding: 20px 28px 0; }
.c24frc-mode-tab { flex: 1; background: var(--bg); border: 1.5px solid var(--border); color: var(--text-muted); font-family: 'Inter', sans-serif; font-size: 13.5px; font-weight: 700; border-radius: var(--radius-md); padding: 12px; cursor: pointer; transition: all 0.15s; }
.c24frc-mode-tab:hover { color: var(--blue); }
.c24frc-mode-tab.c24frc-mode-active { background: var(--grad); border-color: transparent; color: #fff; }

.c24frc-mode-panel { padding: 18px 28px 0; }

/* ---- Sub tabs ---- */
.c24frc-subtabs-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.c24frc-subtabs-row .c24frc-subtabs { margin-bottom: 0; }
.c24frc-subtabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.c24frc-clearall-btn { background: rgba(224,85,79,0.08); border: 1.5px solid rgba(224,85,79,0.25); color: var(--red); font-family: 'Inter', sans-serif; font-size: 11.5px; font-weight: 700; border-radius: 999px; padding: 8px 14px; cursor: pointer; white-space: nowrap; flex-shrink: 0; }
.c24frc-clearall-btn:hover { background: rgba(224,85,79,0.16); }
.c24frc-subtab { background: var(--white); border: 1.5px solid var(--border); color: var(--text-muted); font-family: 'Inter', sans-serif; font-size: 12px; font-weight: 700; border-radius: 999px; padding: 8px 14px; cursor: pointer; transition: all 0.15s; }
.c24frc-subtab:hover { border-color: var(--blue); color: var(--blue); }
.c24frc-subtab.c24frc-subtab-active { background: var(--grad-soft); border-color: var(--blue); color: var(--blue); }

.c24frc-convert-tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.c24frc-convert-tab { flex: 1; background: var(--white); border: 1.5px solid var(--border); color: var(--text-muted); font-family: 'Inter', sans-serif; font-size: 11.5px; font-weight: 700; border-radius: var(--radius-sm); padding: 9px; cursor: pointer; text-align: center; }
.c24frc-convert-tab.c24frc-convert-active { background: var(--grad); border-color: transparent; color: #fff; }

/* ---- Samples ---- */
.c24frc-samples-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.c24frc-samples-label { font-size: 11.5px; font-weight: 700; color: var(--text-muted); }
.c24frc-samples-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.c24frc-sample-chip { background: var(--grad-soft); border: 1.5px solid var(--border); color: var(--blue); font-family: 'Inter', sans-serif; font-size: 11.5px; font-weight: 700; border-radius: 999px; padding: 6px 12px; cursor: pointer; }
.c24frc-sample-chip:hover { background: var(--blue); color: #fff; }

/* ---- Fraction inputs ---- */
.c24frc-op-row { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.c24frc-op-row-single { justify-content: center; }
.c24frc-fraction-input { display: flex; align-items: center; gap: 8px; }
.c24frc-frac-stack { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.c24frc-frac-stack input { width: 3.5ch; min-width: 3.5ch; max-width: 12ch; text-align: center; padding: 8px 4px; box-sizing: content-box; -moz-appearance: textfield; transition: width 0.1s ease; }
.c24frc-frac-stack input::-webkit-outer-spin-button, .c24frc-frac-stack input::-webkit-inner-spin-button { margin: 0; }
.c24frc-frac-bar { width: 100%; min-width: 52px; height: 2px; background: var(--text); border-radius: 2px; }
.c24frc-op-select-wrap { flex-shrink: 0; }
.c24frc-op-select { border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 10px 8px; font-family: 'Inter', sans-serif; font-size: 18px; font-weight: 800; color: var(--blue); background: var(--white); outline: none; cursor: pointer; }
.c24frc-vs-label { font-size: 13px; font-weight: 800; color: var(--text-muted); }

.c24frc-whole, .c24frc-num, .c24frc-den, .c24frc-plain-input {
    border: 1.5px solid var(--border); border-radius: var(--radius-sm);
    padding: 11px 12px; font-family: 'Inter', sans-serif; font-size: 14px; font-weight: 700; color: var(--text);
    background: var(--white); outline: none; transition: border-color 0.2s;
}
.c24frc-whole:focus, .c24frc-num:focus, .c24frc-den:focus, .c24frc-plain-input:focus { border-color: var(--blue); }
.c24frc-plain-input { width: 100%; }
.c24frc-whole { width: 3.5ch; min-width: 3.5ch; max-width: 12ch; padding: 11px 8px; text-align: center; flex-shrink: 0; box-sizing: content-box; -moz-appearance: textfield; transition: width 0.1s ease; }
.c24frc-whole::-webkit-outer-spin-button, .c24frc-whole::-webkit-inner-spin-button { margin: 0; }

.c24frc-field { margin-bottom: 14px; }
.c24frc-field label { display: block; font-size: 12px; font-weight: 700; color: var(--text-muted); margin-bottom: 7px; }
.c24frc-hint-inline { font-weight: 500; text-transform: none; font-size: 11px; display: block; margin-top: 2px; color: var(--text-muted); }
.c24frc-expr-input { font-size: 15px; font-family: 'SFMono-Regular', Consolas, monospace; }
.c24frc-hint { font-size: 11.5px; color: var(--text-muted); margin-top: 4px; }

.c24frc-qty-input { max-width: 140px; }
.c24frc-ratio-row { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 6px; }
.c24frc-ratio-cell { width: 64px; text-align: center; }
.c24frc-ratio-slash { font-size: 18px; font-weight: 800; color: var(--text-muted); }
.c24frc-ratio-eq { font-size: 18px; font-weight: 800; color: var(--blue); }

/* ---- Result ---- */
.c24frc-result { padding: 22px 28px 26px; }
.c24frc-result-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.c24frc-result-badge { font-size: 13px; font-weight: 800; color: var(--text); }

.c24frc-input-recap { font-size: 12px; color: var(--text-muted); margin-bottom: 10px; line-height: 1.5; }
.c24frc-input-recap:empty { display: none; }

.c24frc-due-card { background: var(--grad); border-radius: var(--radius-lg); padding: 22px; text-align: center; margin-bottom: 16px; position: relative; overflow: hidden; }
.c24frc-due-card::after { content: ''; position: absolute; width: 160px; height: 160px; background: rgba(255,255,255,0.06); border-radius: 50%; top: -70px; right: -50px; }
.c24frc-due-label { color: rgba(255,255,255,0.8); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; position: relative; }
.c24frc-due-value { color: #fff; font-size: 30px; font-weight: 900; letter-spacing: -0.3px; margin: 6px 0; position: relative; word-break: break-word; }
.c24frc-due-sub { color: rgba(255,255,255,0.85); font-size: 12px; font-weight: 500; position: relative; }

.c24frc-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.c24frc-stat-card { background: var(--bg); border-radius: var(--radius-md); padding: 14px; text-align: center; border: 1px solid var(--border); }
.c24frc-stat-icon { font-size: 16px; margin-bottom: 4px; }
.c24frc-stat-value { font-size: 16.5px; font-weight: 800; color: var(--text); }
.c24frc-stat-label { font-size: 10.5px; font-weight: 600; color: var(--text-muted); margin-top: 2px; }

.c24frc-visual-card, .c24frc-steps-card { background: var(--bg); border-radius: var(--radius-md); border: 1px solid var(--border); padding: 16px; margin-bottom: 14px; }
.c24frc-visual-title, .c24frc-steps-title { font-size: 12.5px; font-weight: 800; color: var(--text); margin-bottom: 10px; }
.c24frc-visual-wrap { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; align-items: flex-end; }

.c24frc-steps-list { padding-left: 20px; display: flex; flex-direction: column; gap: 10px; }
.c24frc-steps-list li { font-size: 12.5px; color: var(--text); line-height: 1.6; }
.c24frc-steps-list li strong { color: var(--blue); }

.c24frc-export-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 14px; }
.c24frc-export-btn { background: var(--white); border: 1.5px solid var(--border); color: var(--text); font-family: 'Inter', sans-serif; font-size: 12px; font-weight: 700; border-radius: var(--radius-sm); padding: 11px 6px; cursor: pointer; }
.c24frc-export-btn:hover { border-color: var(--blue); color: var(--blue); }

.c24frc-footer-note { font-size: 10.5px; color: var(--text-muted); text-align: center; line-height: 1.5; }

/* ---- Responsive ---- */
@media (max-width: 480px) {
    .c24frc-op-row { flex-wrap: wrap; justify-content: center; }
    .c24frc-header-text h1 { font-size: 15px; }
    .c24frc-mode-panel, .c24frc-result, .c24frc-explainer-toggle, .c24frc-explainer-body.c24frc-explainer-open { padding-left: 18px; padding-right: 18px; }
    .c24frc-mode-tabs { padding-left: 18px; padding-right: 18px; }
}
