/* ========================================
   Share Calculator - Custom Styles
   Mobile-First, Flowing Design
   ======================================== */

/* Tool Header */
.tool-header {
    padding: 20px 0;
}

.back-link {
    display: inline-flex;
    align-items: center;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 12px;
    transition: var(--transition-fast);
}

.back-link:hover {
    color: var(--text-primary);
}

.tool-title-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tool-icon-large {
    font-size: 2rem;
}

.tool-title-section h1 {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 2px;
}

.tool-subtitle {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Calculator Section - Full width, no max-width on mobile */
.calculator-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Mode Toggle - Pill style */
.mode-toggle {
    display: flex;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 50px;
    padding: 4px;
    gap: 4px;
}

.mode-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-radius: 50px;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mode-btn:hover {
    color: var(--text-primary);
}

.mode-btn.active {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
    box-shadow: 0 4px 16px rgba(34, 197, 94, 0.35);
    transform: scale(1.02);
}

.mode-btn[data-mode="sell"].active {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.35);
}

.mode-icon {
    font-size: 1.1rem;
}

/* Calculator Card - Remove border, use glass effect */
.calc-card {
    background: rgba(255, 255, 255, 0.02);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 24px;
    overflow: hidden;
}

.calc-inputs {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.sell-fields {
    display: flex;
    flex-direction: column;
    gap: 14px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Input Groups - Cleaner look */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.input-group label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding-left: 4px;
}

.input-field {
    width: 100%;
    padding: 16px 18px;
    background: rgba(255, 255, 255, 0.04);
    border: none;
    border-radius: 16px;
    color: var(--text-primary);
    font-size: 1.15rem;
    font-family: inherit;
    font-weight: 600;
    outline: none;
    transition: all 0.3s ease;
}

.input-field::placeholder {
    color: var(--text-muted);
    font-weight: 400;
    font-size: 0.95rem;
}

.input-field:focus {
    background: rgba(147, 51, 234, 0.08);
    box-shadow: 0 0 0 2px rgba(147, 51, 234, 0.3);
}

.input-field::-webkit-outer-spin-button,
.input-field::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.input-field[type=number] {
    -moz-appearance: textfield;
}

/* WACC Toggle */
.wacc-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    cursor: pointer;
    user-select: none;
}

.wacc-toggle input[type="checkbox"] {
    display: none;
}

.wacc-check {
    width: 18px;
    height: 18px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.wacc-toggle input:checked+.wacc-check {
    background: linear-gradient(135deg, #9333ea, #7c3aed);
    border-color: transparent;
}

.wacc-toggle input:checked+.wacc-check::after {
    content: '✓';
    color: white;
    font-size: 11px;
    font-weight: 700;
}

.wacc-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* CGT Options - Inline style */
.cgt-options {
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 16px;
}

.cgt-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 10px;
}

.cgt-toggle {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.cgt-btn {
    flex: 1;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.04);
    border: none;
    border-radius: 12px;
    color: var(--text-secondary);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cgt-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.cgt-btn.active {
    background: linear-gradient(135deg, #9333ea, #7c3aed);
    color: white;
    box-shadow: 0 2px 12px rgba(147, 51, 234, 0.3);
}

.cgt-hint {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    font-style: italic;
    padding-left: 2px;
}

/* Results Section - Card-less flowing design */
.results-section {
    padding: 20px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.02) 0%, transparent 100%);
}

.results-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 16px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.results-icon {
    font-size: 1rem;
}

.results-grid {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 16px;
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.result-item:last-child {
    border-bottom: none;
}

.result-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
}

.result-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
}

.result-rate {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-left: 6px;
}

/* Total Payable - Hero style */
.result-total {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 20px;
    background: linear-gradient(135deg, rgba(147, 51, 234, 0.12), rgba(99, 102, 241, 0.12));
    border-radius: 20px;
    margin-bottom: 12px;
}

.total-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 6px;
}

.total-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
}

/* Per Unit - Subtle */
.result-perunit {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
}

.perunit-label {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 500;
}

.perunit-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: #a78bfa;
}

/* Profit/Loss - Prominent card */
.profit-loss {
    margin-top: 12px;
    padding: 20px;
    border-radius: 20px;
    text-align: center;
    transition: all 0.3s ease;
}

.profit-loss.profit {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.12), rgba(22, 163, 74, 0.08));
}

.profit-loss.loss {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.12), rgba(220, 38, 38, 0.08));
}

.profit-loss.neutral {
    background: rgba(255, 255, 255, 0.02);
}

.pl-header {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.pl-value {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.profit-loss.profit .pl-value {
    color: #22c55e;
}

.profit-loss.loss .pl-value {
    color: #ef4444;
}

.profit-loss.neutral .pl-value {
    color: var(--text-secondary);
}

.pl-percent {
    font-size: 0.85rem;
    font-weight: 600;
    margin-top: 2px;
    opacity: 0.8;
}

.profit-loss.profit .pl-percent {
    color: #4ade80;
}

.profit-loss.loss .pl-percent {
    color: #f87171;
}

/* Fee Info - Collapsible style */
.fee-info {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 20px;
    padding: 16px;
}

.fee-info h4 {
    font-size: 0.85rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-secondary);
}

.fee-table {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: 10px;
}

.fee-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    font-size: 0.8rem;
}

.fee-row:last-child {
    border-bottom: none;
}

.fee-row span:first-child {
    color: var(--text-muted);
}

.fee-row span:last-child {
    font-weight: 700;
    color: #a78bfa;
}

.fee-note {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-style: italic;
}

/* ========================================
   Tablet (600px+)
   ======================================== */
@media (min-width: 600px) {
    .tool-header {
        padding: 28px 0;
    }

    .tool-title-section h1 {
        font-size: 1.75rem;
    }

    .tool-icon-large {
        font-size: 2.5rem;
    }

    .tool-subtitle {
        font-size: 0.95rem;
    }

    .mode-btn {
        padding: 14px 20px;
        font-size: 1rem;
    }

    .calc-inputs {
        padding: 24px;
        gap: 16px;
    }

    .results-section {
        padding: 24px;
    }

    .input-field {
        font-size: 1.2rem;
        padding: 18px 20px;
    }

    .total-value {
        font-size: 1.85rem;
    }

    .pl-value {
        font-size: 1.75rem;
    }
}

/* ========================================
   Desktop (900px+)
   ======================================== */
@media (min-width: 900px) {
    .tool-header {
        padding: 36px 0;
    }

    .tool-title-section {
        gap: 16px;
    }

    .tool-title-section h1 {
        font-size: 2rem;
    }

    .tool-icon-large {
        font-size: 3rem;
    }

    .calculator-section {
        max-width: 680px;
        margin: 0 auto;
        gap: 20px;
    }

    .mode-btn {
        padding: 16px 24px;
        font-size: 1.05rem;
    }

    .calc-card {
        display: grid;
        grid-template-columns: 1fr 1.1fr;
        border-radius: 28px;
    }

    .calc-inputs {
        padding: 28px;
        border-right: 1px solid rgba(255, 255, 255, 0.04);
    }

    .results-section {
        padding: 28px;
    }

    .total-value {
        font-size: 2rem;
    }

    .pl-value {
        font-size: 2rem;
    }
}