/*!
 * EasifyMe Temperature Converter
 * CSS Prefix: tc-
 * Immersive background, particles, glass morphism, thermometer
 */

/* ============================================================
   DYNAMIC BACKGROUND
   ============================================================ */
.tc-bg-container {
    position: fixed;
    inset: 0;
    z-index: -1;
    background: linear-gradient(160deg, var(--bg-color-1, #93C5FD), var(--bg-color-2, #6EE7B7), var(--bg-color-3, #D1FAE5));
    transition: background 1.2s ease;
    overflow: hidden;
    pointer-events: none;
}

.tc-bg-container::after {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--color-bg, #fff);
    opacity: 0.55;
    transition: opacity 0.5s;
}

[data-theme="dark"] .tc-bg-container::after { opacity: 0.75; }

/* ============================================================
   PARTICLES (CSS-only animations)
   ============================================================ */
.temp-particle {
    position: fixed;
    pointer-events: none;
    z-index: 0;
    will-change: transform, opacity;
}

/* Snow */
.temp-particle-heavy-snow,
.temp-particle-light-snow {
    width: 6px; height: 6px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0 4px rgba(255,255,255,0.8);
    animation: tc-snowfall linear infinite;
}
.temp-particle-heavy-snow { width: 8px; height: 8px; }

@keyframes tc-snowfall {
    0%   { transform: translateY(-5vh) translateX(0) rotate(0deg); opacity: 0.7; }
    100% { transform: translateY(105vh) translateX(40px) rotate(360deg); opacity: 0; }
}

/* Mist */
.temp-particle-mist {
    width: 60px; height: 20px;
    background: rgba(255,255,255,0.3);
    border-radius: 50%;
    filter: blur(8px);
    animation: tc-mist linear infinite;
}

@keyframes tc-mist {
    0%   { transform: translateX(-10vw); opacity: 0; }
    20%  { opacity: 0.4; }
    80%  { opacity: 0.4; }
    100% { transform: translateX(110vw); opacity: 0; }
}

/* Breeze / leaves */
.temp-particle-breeze {
    width: 8px; height: 4px;
    background: #6EE7B7;
    border-radius: 40%;
    animation: tc-breeze linear infinite;
}

@keyframes tc-breeze {
    0%   { transform: translate(-5vw, 30vh) rotate(0deg); opacity: 0; }
    10%  { opacity: 0.6; }
    90%  { opacity: 0.6; }
    100% { transform: translate(105vw, 25vh) rotate(720deg); opacity: 0; }
}

/* Sun rays */
.temp-particle-sun-rays {
    width: 3px; height: 40px;
    background: linear-gradient(180deg, rgba(252,211,77,0.5), transparent);
    border-radius: 2px;
    animation: tc-sunray linear infinite;
    transform-origin: top center;
}

@keyframes tc-sunray {
    0%   { opacity: 0; transform: translateY(-10vh) scaleY(0.5); }
    30%  { opacity: 0.5; transform: translateY(10vh) scaleY(1); }
    70%  { opacity: 0.5; transform: translateY(60vh) scaleY(1); }
    100% { opacity: 0; transform: translateY(100vh) scaleY(0.5); }
}

/* Heat shimmer */
.temp-particle-heat-shimmer,
.temp-particle-heat-waves {
    width: 80px; height: 3px;
    background: rgba(251,146,60,0.3);
    border-radius: 2px;
    filter: blur(2px);
    animation: tc-heat linear infinite;
}

@keyframes tc-heat {
    0%   { transform: translateY(100vh) scaleX(0.8); opacity: 0; }
    30%  { opacity: 0.5; }
    70%  { opacity: 0.4; }
    100% { transform: translateY(-10vh) scaleX(1.2); opacity: 0; }
}

/* Steam */
.temp-particle-steam {
    width: 20px; height: 20px;
    background: rgba(255,255,255,0.25);
    border-radius: 50%;
    filter: blur(6px);
    animation: tc-steam ease-out infinite;
}

@keyframes tc-steam {
    0%   { transform: translateY(100vh) scale(0.5); opacity: 0; }
    20%  { opacity: 0.5; }
    100% { transform: translateY(-10vh) scale(2); opacity: 0; }
}

/* Embers */
.temp-particle-embers {
    width: 4px; height: 4px;
    background: #F97316;
    border-radius: 50%;
    box-shadow: 0 0 6px #F97316, 0 0 12px rgba(249,115,22,0.4);
    animation: tc-ember ease-out infinite;
}

@keyframes tc-ember {
    0%   { transform: translateY(100vh) translateX(0); opacity: 0; }
    20%  { opacity: 0.8; }
    100% { transform: translateY(-10vh) translateX(30px); opacity: 0; }
}

/* ============================================================
   GLASS MORPHISM CARDS
   ============================================================ */
.tc-glass {
    background: rgba(255,255,255,0.78);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 24px rgba(0,0,0,0.06);
    transition: background 0.5s, border-color 0.5s;
}

[data-theme="dark"] .tc-glass {
    background: rgba(30,41,59,0.78);
    border-color: rgba(255,255,255,0.08);
}

/* ============================================================
   TOOL LAYOUT
   ============================================================ */
.tc-tool { font-family: inherit; position: relative; z-index: 1; }

/* ============================================================
   INPUT AREA
   ============================================================ */
.tc-input-card {
    padding: var(--space-5);
    margin-bottom: var(--space-5);
}

.tc-input-row {
    display: flex;
    gap: var(--space-3);
    align-items: center;
    margin-bottom: var(--space-4);
}

.tc-main-input {
    flex: 1;
    padding: 14px 18px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-bg-secondary);
    color: var(--color-text);
    font-size: 28px;
    font-weight: 800;
    transition: var(--transition-base);
    min-width: 0;
}

.tc-main-input:focus {
    outline: none;
    border-color: var(--color-accent);
    background: var(--color-surface);
    box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}

.tc-main-input::-webkit-outer-spin-button,
.tc-main-input::-webkit-inner-spin-button { -webkit-appearance: none; }

.tc-scale-select {
    padding: 14px 18px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-bg-secondary);
    color: var(--color-text);
    font-size: var(--text-base);
    font-weight: 700;
    cursor: pointer;
    min-width: 120px;
}

.tc-scale-select:focus { outline: none; border-color: var(--color-accent); }

/* ============================================================
   FIVE SCALE CARDS
   ============================================================ */
.tc-scales-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
}

.tc-scale-card {
    text-align: center;
    padding: 16px 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.tc-scale-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.08); }

.tc-scale-card.active {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 2px var(--color-accent), 0 4px 16px rgba(59,130,246,0.15);
}

.tc-scale-val {
    font-size: 22px;
    font-weight: 800;
    color: var(--color-text);
    line-height: 1.2;
    margin-bottom: 4px;
    transition: color 0.3s;
    word-break: break-all;
}

.tc-scale-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tc-scale-copy {
    position: absolute;
    top: 6px; right: 6px;
    border: none;
    background: none;
    color: var(--color-text-muted);
    cursor: pointer;
    font-size: 11px;
    opacity: 0;
    transition: opacity 0.2s;
    padding: 2px 4px;
}

.tc-scale-card:hover .tc-scale-copy { opacity: 1; }
.tc-scale-copy:hover { color: var(--color-accent); }

/* ============================================================
   THERMOMETER + CONTEXT LAYOUT
   ============================================================ */
.tc-thermo-context {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: var(--space-5);
    margin-bottom: var(--space-5);
    align-items: start;
}

/* SVG Thermometer */
.tc-thermo-wrap {
    display: flex;
    justify-content: center;
}

.tc-thermometer-svg {
    width: 70px;
    height: 360px;
}

.tc-mercury-col {
    transition: height 0.5s cubic-bezier(0.4, 0, 0.2, 1), fill 0.5s ease;
}

.tc-mercury-bulb {
    transition: fill 0.5s ease;
}

.tc-thermo-pointer {
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.tc-thermo-label {
    font-size: 9px;
    fill: var(--color-text-muted);
    font-weight: 600;
}

.tc-thermo-ref-label {
    font-size: 8px;
    fill: var(--color-text-muted);
    font-weight: 500;
}

.tc-thermo-tick {
    stroke: var(--color-border);
    stroke-width: 1;
}

/* Context panel */
.tc-context-panel {
    padding: var(--space-5);
}

.tc-ctx-category {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 14px;
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    font-weight: 700;
    margin-bottom: var(--space-3);
    background: rgba(59,130,246,0.08);
    color: var(--color-accent);
}

.tc-ctx-section {
    margin-bottom: var(--space-3);
    font-size: var(--text-sm);
    color: var(--color-text);
    line-height: 1.6;
}

.tc-ctx-section strong {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--color-text);
    font-weight: 700;
}

.tc-ctx-section p { margin: 2px 0 0 24px; color: var(--color-text-muted); }

/* ============================================================
   FEATURE TABS
   ============================================================ */
.tc-tabs {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-bottom: var(--space-4);
    background: var(--color-bg-secondary);
    padding: 5px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--color-border);
}

.tc-tab-btn {
    flex: 1;
    min-width: 100px;
    padding: 7px 10px;
    border: none;
    background: transparent;
    color: var(--color-text-muted);
    font-size: 12px;
    font-weight: 500;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition-base);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: center;
}

.tc-tab-btn:hover { background: var(--color-surface); color: var(--color-text); }
.tc-tab-btn.active { background: var(--color-accent); color: #fff; box-shadow: 0 2px 8px rgba(59,130,246,0.3); }

.tc-tab-panel { display: none; }
.tc-tab-panel.active { display: block; }

/* ============================================================
   MILESTONES TIMELINE
   ============================================================ */
.tc-milestones {
    position: relative;
    padding-left: 30px;
}

.tc-milestones::before {
    content: '';
    position: absolute;
    left: 12px;
    top: 0; bottom: 0;
    width: 2px;
    background: var(--color-border);
}

.tc-milestone {
    position: relative;
    padding: 8px 0 8px 20px;
    cursor: pointer;
    transition: background 0.15s;
    border-radius: var(--radius-md);
}

.tc-milestone:hover { background: rgba(59,130,246,0.04); }

.tc-milestone::before {
    content: '';
    position: absolute;
    left: -22px;
    top: 14px;
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--color-border);
    border: 2px solid var(--color-surface);
    z-index: 1;
    transition: all 0.3s;
}

.tc-milestone.tc-ms-active::before {
    background: var(--color-accent);
    box-shadow: 0 0 0 4px rgba(59,130,246,0.2);
    width: 14px; height: 14px;
    left: -24px;
    top: 12px;
}

.tc-milestone.tc-ms-nearest::before {
    background: #F59E0B;
    box-shadow: 0 0 0 4px rgba(245,158,11,0.2);
}

.tc-ms-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: var(--text-sm);
    color: var(--color-text);
}

.tc-ms-header .tc-ms-icon { font-size: 16px; }

.tc-ms-temps {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-top: 2px;
    font-weight: 500;
}

.tc-ms-detail {
    font-size: 12px;
    color: var(--color-text-muted);
    margin-top: 2px;
}

.tc-ms-you-badge {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 1px 8px;
    background: var(--color-accent);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    border-radius: var(--radius-full);
    margin-left: 6px;
    animation: tc-pulse 2s infinite;
}

@keyframes tc-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(59,130,246,0.4); }
    50% { box-shadow: 0 0 0 6px rgba(59,130,246,0); }
}

/* ============================================================
   FEVER CHECKER
   ============================================================ */
.tc-fever-input-row {
    display: flex;
    gap: var(--space-3);
    align-items: center;
    margin-bottom: var(--space-4);
}

.tc-fever-input {
    padding: 10px 14px;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-bg-secondary);
    color: var(--color-text);
    font-size: var(--text-base);
    font-weight: 700;
    width: 120px;
}

.tc-fever-input:focus { outline: none; border-color: var(--color-accent); }

.tc-fever-toggle {
    display: flex;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.tc-fever-toggle button {
    padding: 10px 14px;
    border: none;
    background: transparent;
    color: var(--color-text-muted);
    font-size: var(--text-sm);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-base);
}

.tc-fever-toggle button.active {
    background: var(--color-accent);
    color: #fff;
}

.tc-fever-gauge {
    position: relative;
    height: 24px;
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: var(--space-3);
    display: flex;
}

.tc-fever-zone {
    height: 100%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 600;
    color: #fff;
}

.tc-fever-zone-normal { background: #10B981; flex: 1.1; }
.tc-fever-zone-low { background: #FCD34D; flex: 0.7; color: #78350F; }
.tc-fever-zone-mod { background: #FB923C; flex: 0.9; }
.tc-fever-zone-high { background: #EF4444; flex: 1; }
.tc-fever-zone-vhigh { background: #B91C1C; flex: 0.3; }

.tc-fever-marker {
    position: absolute;
    top: -8px;
    width: 2px; height: calc(100% + 16px);
    background: var(--color-text);
    z-index: 2;
    transition: left 0.4s ease;
}

.tc-fever-marker::after {
    content: '\u25BC';
    position: absolute;
    top: -14px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    color: var(--color-text);
}

.tc-fever-result {
    font-size: var(--text-base);
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: var(--space-2);
    display: flex;
    align-items: center;
    gap: 8px;
}

.tc-fever-advice {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    line-height: 1.6;
    margin-bottom: var(--space-3);
}

.tc-fever-disclaimer {
    font-size: 12px;
    color: var(--color-text-muted);
    padding: 10px 14px;
    background: rgba(245,158,11,0.06);
    border: 1px solid rgba(245,158,11,0.2);
    border-radius: var(--radius-md);
}

/* ============================================================
   COOKING GUIDE
   ============================================================ */
.tc-cook-section {
    margin-bottom: var(--space-4);
}

.tc-cook-title {
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: var(--space-2);
    display: flex;
    align-items: center;
    gap: 6px;
}

.tc-cook-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 6px;
}

.tc-cook-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-bg-secondary);
    cursor: pointer;
    transition: var(--transition-base);
    font-size: var(--text-sm);
}

.tc-cook-item:hover {
    border-color: var(--color-accent);
    background: rgba(59,130,246,0.04);
}

.tc-cook-name { font-weight: 500; color: var(--color-text); }

.tc-cook-temps {
    font-weight: 700;
    color: var(--color-accent);
    white-space: nowrap;
}

/* ============================================================
   FORMULA & MENTAL MATH
   ============================================================ */
.tc-formula-list {
    display: grid;
    gap: 6px;
    margin-bottom: var(--space-4);
}

.tc-formula-item {
    padding: 8px 14px;
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: var(--text-sm);
    font-family: 'Courier New', monospace;
    color: var(--color-text);
}

.tc-step-box {
    background: var(--color-bg-secondary);
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-4);
    margin-bottom: var(--space-4);
}

.tc-step-title {
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: var(--space-2);
}

.tc-step-line {
    font-size: var(--text-sm);
    color: var(--color-text);
    padding: 3px 0;
}

.tc-step-line strong { color: var(--color-accent); }

.tc-mental-card {
    padding: var(--space-4);
    background: var(--color-bg-secondary);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-3);
}

.tc-mental-title {
    font-size: var(--text-sm);
    font-weight: 700;
    color: var(--color-text);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.tc-mental-body {
    font-size: var(--text-sm);
    color: var(--color-text-muted);
    line-height: 1.6;
}

.tc-mental-body strong { color: var(--color-text); }

/* Anchors grid */
.tc-anchors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 6px;
    margin-top: var(--space-3);
}

.tc-anchor-item {
    padding: 8px 12px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    color: var(--color-text);
    cursor: pointer;
    transition: var(--transition-base);
    text-align: center;
}

.tc-anchor-item:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
}

/* ============================================================
   QUICK CONVERT BUTTONS
   ============================================================ */
.tc-quick-grid {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.tc-quick-btn {
    padding: 6px 14px;
    border: 1.5px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text-muted);
    font-size: 12px;
    font-weight: 600;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: var(--transition-base);
}

.tc-quick-btn:hover {
    border-color: var(--color-accent);
    color: var(--color-accent);
    background: rgba(59,130,246,0.04);
}

/* ============================================================
   TOAST
   ============================================================ */
.tc-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    background: #1E293B;
    color: #fff;
    padding: 10px 20px;
    border-radius: var(--radius-full);
    font-size: var(--text-sm);
    font-weight: 600;
    box-shadow: var(--shadow-lg);
    z-index: 9999;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
}

.tc-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
    .tc-scales-row { grid-template-columns: repeat(3, 1fr); }
    .tc-thermo-context { grid-template-columns: 1fr; }
    .tc-thermo-wrap { justify-content: center; }
    .tc-thermometer-svg { height: 280px; }
    .tc-main-input { font-size: 22px; }
    .tc-scale-val { font-size: 18px; }
    .tc-cook-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .tc-scales-row { grid-template-columns: repeat(2, 1fr); }
    .tc-input-row { flex-direction: column; }
    .tc-main-input { font-size: 20px; width: 100%; }
    .tc-scale-select { width: 100%; }
    .tc-tabs { gap: 2px; padding: 4px; }
    .tc-tab-btn { min-width: 70px; font-size: 11px; padding: 6px 6px; }
    .tc-anchors-grid { grid-template-columns: 1fr 1fr; }
}
