/* ============================================================
   Percentage Calculator — tool skin on top of base.css.
   NO :root and NO theme here. All colors, fonts, radii and
   shadows come from base.css variables, so the tool matches
   the Spin Numbers hero. HTML class names are kept as-is
   (no JS/HTML change needed). This file is the reference
   pattern for re-skinning every other pre-built tool.
   ============================================================ */

.percentage-container {
    max-width: 100%;
    margin: auto;
    background: var(--bg);
    padding: 50px 30px;
    position: relative;
    transition: background 0.5s;
    font-family: var(--font-head);
    color: var(--text);
}

/* ---------- Intro header ---------- */
.tool-instructions-wrapper {
    text-align: center;
    margin-bottom: 24px;
}
.tool-section-title {
    font-family: var(--font-head);
    font-weight: 800;
    font-size: clamp(1.6rem, 4vw, 2.4rem);
    color: var(--text);
    margin: 0 0 12px;
    letter-spacing: -0.3px;
}
.text-primary-red { color: var(--accent-2); }
.tool-section-texte {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.7;
    margin: 10px auto !important;
}

/* ---------- Theme toggle (shared chrome) ---------- */
.theme-toggle {
    position: absolute;
    top: 8px;
    right: 24px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
    cursor: pointer;
    z-index: 10;
    background: var(--card-bg);
    border: 1px solid var(--panel-border);
    padding: 6px 12px;
    border-radius: 20px;
}
.theme-toggle .sun  { opacity: 1; }
.theme-toggle .moon { opacity: 0.3; }
body.dark-mode .theme-toggle .sun  { opacity: 0.3; }
body.dark-mode .theme-toggle .moon { opacity: 1; }

/* ---------- Layout ---------- */
.tool-wrapper {
    width: 100%;
    max-width: 82rem;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    align-items: start;
    padding-bottom: 30px;
}
@media (min-width: 1024px) {
    .tool-wrapper { grid-template-columns: repeat(12, minmax(0, 1fr)); }
    .controls { grid-column: span 6 / span 6; }
    .info-display-container { grid-column: span 6 / span 6; }
}

.controls {
    background: var(--panel-bg);
    color: var(--text);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
    padding: 1.5rem;
}

/* ---------- Mode selector ---------- */
.calculator-modes {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 28px;
}
.mode-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--font-head);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    opacity: 0.85;
}
.mode-btn:hover {
    opacity: 1;
    border-color: var(--accent-2);
    transform: translateY(-2px);
}
.mode-btn.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
    opacity: 1;
    box-shadow: 0 4px 14px rgba(231, 76, 60, 0.3);
}
.mode-btn svg { flex-shrink: 0; }

/* ---------- Mode panels ---------- */
.calc-mode { display: none; }
.calc-mode.active { display: block; animation: pctFadeIn 0.3s ease; }
@keyframes pctFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}
.mode-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 8px;
}
.mode-description {
    color: var(--text-muted);
    margin-bottom: 24px;
    font-size: 0.95rem;
}

/* ---------- Inputs ---------- */
.input-group { margin-bottom: 20px; position: relative; }
.input-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}
.calc-input {
    width: 100%;
    padding: 14px 18px;
    padding-right: 50px;
    font-size: 1.1rem;
    font-weight: 600;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--card-bg);
    color: var(--text);
    font-family: var(--font-head);
    transition: var(--transition);
}
.calc-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.15);
}
.input-suffix {
    position: absolute;
    right: 18px;
    top: 38px;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    opacity: 0.5;
}

/* ---------- Calculate button ---------- */
.calculate-btn {
    width: 100%;
    padding: 16px;
    background: var(--success);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font-head);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 16px rgba(39, 174, 96, 0.3);
    margin-bottom: 20px;
}
.calculate-btn:hover {
    background: var(--success-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(39, 174, 96, 0.4);
}
.calculate-btn:active { transform: translateY(0); }
.calculate-btn.calculating { animation: pctPulse 0.3s ease-in-out; }
@keyframes pctPulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(0.98); }
}

/* ---------- Result box ---------- */
.result-box {
    background: var(--gradient-result);
    padding: 26px;
    border-radius: var(--radius);
    text-align: center;
    box-shadow: var(--shadow-soft);
    margin-bottom: 20px;
}
.result-main {
    font-size: 3rem;
    font-weight: 800;
    color: #fff;
    margin-bottom: 10px;
    line-height: 1.1;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}
.result-formula {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 8px;
    font-weight: 500;
}
.result-detail {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 500;
}

/* ---------- Info / steps ---------- */
.info-display-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
}
.steps-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
.step {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    transition: var(--transition);
    text-align: left;
}
.step:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.2);
}
.step-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    min-width: 28px;
    background: var(--accent-2);
    color: #fff;
    font-weight: 700;
    border-radius: 50%;
    font-size: 13px;
    flex-shrink: 0;
    box-shadow: 0 2px 6px rgba(255, 107, 107, 0.35);
}
.step p {
    margin: 0;
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.55;
}
.step p strong { color: var(--text); }
.steps-grid-mobile { display: none; }

.info-section {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}
.info-card {
    background: var(--card-bg);
    padding: 22px;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
}
.info-card p {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 14px;
}
.info-card ul { list-style: none; padding: 0; margin: 0; }
.info-card li {
    padding: 8px 0 8px 25px;
    position: relative;
    color: var(--text-muted);
    line-height: 1.6;
}
.info-card li::before {
    content: '✓';
    position: absolute;
    left: 0;
    color: var(--success);
    font-weight: 700;
}
.formula-info {
    padding: 10px 0;
    color: var(--text-muted);
    font-size: 0.95rem;
    border-bottom: 1px solid var(--panel-border);
}
.formula-info:last-child { border-bottom: none; }
.formula-info strong { color: var(--accent-2); margin-right: 8px; }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .percentage-container { padding: 40px 0; }
    .controls {
        border: none;
        box-shadow: none;
        background: transparent;
    }
    .tool-wrapper { width: 95%; gap: 0; }
    .calculator-modes { gap: 8px; }
    .mode-btn { padding: 10px 8px; font-size: 0.85rem; }
    .result-main { font-size: 2.5rem; }
    .steps-grid { display: none; }
    .steps-grid-mobile { display: block; padding-bottom: 40px; }
    .steps-grid-mobile .step { margin-bottom: 16px; }
    .info-section { padding: 0 10px; }
}

@media (max-width: 480px) {
    .mode-btn { font-size: 0.75rem; padding: 8px 6px; }
    .mode-btn svg { width: 16px; height: 16px; }
    .result-main { font-size: 2rem; }
    .result-formula { font-size: 1rem; }
}