/**
 * ConvMaster - Savings Calculator Styles
 * 
 * @package    ConvMaster
 * @version    1.0.0
 */

/* =====================================================
   TOOL PAGE LAYOUT
   ===================================================== */
.tool-page {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.tool-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.tool-header__icon {
    font-size: 2.5rem;
}

.tool-header__icon .icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: var(--radius-lg);
    background: var(--bg-tertiary);
}

.tool-header__icon .icon--green {
    background: rgba(16, 185, 129, 0.15);
}

.tool-header__text h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0 0 0.25rem;
    color: var(--text-primary);
}

.tool-header__text p {
    margin: 0;
    color: var(--text-secondary);
}

/* =====================================================
   CURRENT DATE BANNER
   ===================================================== */
.current-date-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.875rem 1.25rem;
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(59, 130, 246, 0.1));
    border: 1px solid rgba(16, 185, 129, 0.2);
    border-radius: var(--radius-lg);
    margin-bottom: 1.5rem;
}

.current-date-banner__icon {
    font-size: 1.25rem;
}

.current-date-banner__text {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* =====================================================
   SAVINGS WIDGET
   ===================================================== */
.savings-widget {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

/* =====================================================
   TOOLBAR
   ===================================================== */
.savings-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    flex-wrap: wrap;
    gap: 1rem;
}

.savings-toolbar__left,
.savings-toolbar__right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Design Selector */
.design-selector {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.design-selector label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.design-buttons {
    display: flex;
    gap: 0.25rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 0.25rem;
}

.design-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1.1rem;
}

.design-btn:hover {
    background: var(--bg-tertiary);
}

.design-btn.active {
    background: var(--bg-card);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Popup Button */
.btn-popup {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #10b981;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-popup:hover {
    background: rgba(16, 185, 129, 0.2);
    border-color: #10b981;
}

.btn-popup__icon {
    font-size: 1rem;
}

/* =====================================================
   MAIN CONTAINER
   ===================================================== */
.savings-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
}

/* =====================================================
   FORM SECTION
   ===================================================== */
.savings-form {
    padding: 1.5rem;
    border-right: 1px solid var(--border-color);
}

.form-row {
    margin-bottom: 1.25rem;
}

.form-row:last-child {
    margin-bottom: 0;
}

.form-row > label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.form-hint {
    display: block;
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-top: 0.25rem;
}

/* Input Groups */
.input-group {
    display: flex;
    align-items: center;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all 0.2s ease;
}

.input-group:focus-within {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.input-group input {
    flex: 1;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    font-weight: 500;
    border: none;
    background: transparent;
    color: var(--text-primary);
    min-width: 0;
}

.input-group input:focus {
    outline: none;
}

/* Remove spinners from number inputs */
.input-group input[type="number"],
.input-group input[inputmode="numeric"],
.input-group input[inputmode="decimal"] {
    -moz-appearance: textfield;
}

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

.input-prefix,
.input-suffix {
    padding: 0.75rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    border-right: 1px solid var(--border-color);
    min-width: 2.5rem;
    text-align: center;
}

.input-suffix {
    border-right: none;
    border-left: 1px solid var(--border-color);
}

/* Select */
.savings-form select {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    font-weight: 500;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.savings-form select:focus {
    outline: none;
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* Currency Selector */
.form-row--currency {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.currency-selector select {
    font-size: 0.95rem;
}

/* Radio Groups */
.radio-group {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

.radio-option:hover {
    background: var(--bg-tertiary);
}

.radio-option input[type="radio"] {
    accent-color: #10b981;
}

.radio-option input[type="radio"]:checked + span {
    color: #10b981;
    font-weight: 600;
}

.radio-option span {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Action Buttons */
.form-row--actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.btn-calculate {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, #10b981, #059669);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-calculate:hover {
    background: linear-gradient(135deg, #059669, #047857);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.25);
}

.btn-reset {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-reset:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* Examples Grid */
.form-row--examples {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.examples-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.example-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 0.75rem;
    font-size: 0.8rem;
    text-align: left;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

.example-btn:hover {
    background: var(--bg-tertiary);
    border-color: #10b981;
    color: #10b981;
}

.example-btn__icon {
    font-size: 1.1rem;
}

.example-btn__text {
    font-weight: 500;
}

/* Message Display */
.message-display {
    margin-top: 1rem;
    padding: 0.875rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 500;
}

.message-display.error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
}

.message-display.success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #10b981;
}

/* =====================================================
   RESULTS SECTION
   ===================================================== */
.savings-results {
    padding: 1.5rem;
    background: var(--bg-secondary);
}

.results-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 1.25rem;
}

/* Summary Cards */
.results-summary {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.summary-card {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.summary-card__label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.summary-card__value {
    font-size: 1.35rem;
    font-weight: 700;
    font-family: 'SF Mono', 'Consolas', monospace;
}

.summary-card--deposits .summary-card__value {
    color: #3b82f6;
}

.summary-card--interest .summary-card__value {
    color: #10b981;
}

.summary-card--total .summary-card__value {
    color: var(--text-primary);
}

.summary-card--total {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.1), rgba(59, 130, 246, 0.1));
    border-color: rgba(16, 185, 129, 0.3);
}

/* Chart */
.results-chart {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 1rem;
}

.results-chart canvas {
    max-height: 250px;
}

/* Breakdown Table */
.results-breakdown {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.results-breakdown summary {
    padding: 0.875rem 1rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-tertiary);
}

.results-breakdown summary::-webkit-details-marker {
    display: none;
}

.results-breakdown summary::after {
    content: '+';
    font-size: 1.25rem;
    color: var(--text-tertiary);
}

.results-breakdown[open] summary::after {
    content: '−';
}

.breakdown-table-wrapper {
    max-height: 300px;
    overflow-y: auto;
}

.breakdown-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.breakdown-table th,
.breakdown-table td {
    padding: 0.625rem 0.75rem;
    text-align: right;
    border-bottom: 1px solid var(--border-color);
}

.breakdown-table th {
    background: var(--bg-tertiary);
    font-weight: 600;
    color: var(--text-secondary);
    position: sticky;
    top: 0;
}

.breakdown-table th:first-child,
.breakdown-table td:first-child {
    text-align: left;
}

.breakdown-table td {
    font-family: 'SF Mono', 'Consolas', monospace;
    font-size: 0.8rem;
}

.breakdown-table tbody tr:hover {
    background: var(--bg-tertiary);
}

/* =====================================================
   INFO NOTICE
   ===================================================== */
.savings-info {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    padding: 1rem 1.5rem;
    margin: 0 1.5rem 1.5rem;
    background: rgba(16, 185, 129, 0.05);
    border: 1px solid rgba(16, 185, 129, 0.15);
    border-radius: var(--radius-md);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.savings-info span {
    font-size: 1rem;
}

.savings-info p {
    margin: 0;
    line-height: 1.5;
}

/* =====================================================
   DESIGN THEMES
   ===================================================== */
/* Modern Design */
.savings-form[data-design="modern"] {
    background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-secondary) 100%);
}

.savings-form[data-design="modern"] .input-group {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
}

.savings-form[data-design="modern"] .btn-calculate {
    border-radius: 50px;
    background: linear-gradient(135deg, #10b981 0%, #3b82f6 100%);
}

.savings-form[data-design="modern"] .summary-card {
    border-radius: var(--radius-lg);
}

/* Dark Design */
.savings-form[data-design="dark"] {
    background: #0f172a;
}

.savings-form[data-design="dark"] label {
    color: #94a3b8;
}

.savings-form[data-design="dark"] .input-group {
    background: #1e293b;
    border-color: #334155;
}

.savings-form[data-design="dark"] .input-group input {
    color: #f1f5f9;
}

.savings-form[data-design="dark"] .input-prefix,
.savings-form[data-design="dark"] .input-suffix {
    background: #0f172a;
    color: #64748b;
    border-color: #334155;
}

.savings-form[data-design="dark"] select {
    background: #1e293b;
    border-color: #334155;
    color: #f1f5f9;
}

.savings-form[data-design="dark"] .radio-option {
    background: #1e293b;
    border-color: #334155;
}

.savings-form[data-design="dark"] .radio-option span {
    color: #94a3b8;
}

.savings-form[data-design="dark"] .example-btn {
    background: #1e293b;
    border-color: #334155;
    color: #94a3b8;
}

.savings-form[data-design="dark"] .btn-reset {
    background: #1e293b;
    border-color: #334155;
    color: #94a3b8;
}

/* =====================================================
   SEO CONTENT
   ===================================================== */
.tool-content {
    margin-top: 3rem;
}

.tool-section {
    margin-bottom: 2.5rem;
}

.tool-section h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 1rem;
}

.tool-section > p {
    color: var(--text-secondary);
    line-height: 1.7;
}

/* Features Grid */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    transition: all 0.2s ease;
}

.feature-card:hover {
    border-color: rgba(16, 185, 129, 0.3);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.feature-card__icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
    display: block;
}

.feature-card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.5rem;
}

.feature-card p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
}

/* Steps Grid */
.steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.step-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    position: relative;
}

.step-card__number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #10b981, #3b82f6);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 700;
    border-radius: 50%;
    margin-bottom: 0.75rem;
}

.step-card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.5rem;
}

.step-card p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0;
    line-height: 1.5;
}

/* Formula Box */
.formula-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.formula-intro {
    color: var(--text-secondary);
    margin: 0 0 1rem;
    line-height: 1.6;
}

.formula-code {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 1rem;
    overflow-x: auto;
}

.formula-code code {
    font-family: 'SF Mono', 'Consolas', monospace;
    font-size: 1rem;
    color: #10b981;
}

.formula-legend {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.5rem;
}

.formula-legend li {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.formula-legend strong {
    color: var(--text-primary);
}

/* FAQ */
.faq-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.faq-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.faq-item summary {
    padding: 1rem 1.25rem;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.faq-item summary::-webkit-details-marker {
    display: none;
}

.faq-item summary::after {
    content: '+';
    font-size: 1.25rem;
    color: var(--text-tertiary);
    transition: transform 0.2s ease;
}

.faq-item[open] summary::after {
    content: '−';
}

.faq-item p {
    padding: 0 1.25rem 1rem;
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* =====================================================
   HIDDEN STATE
   ===================================================== */
[hidden] {
    display: none !important;
}

/* =====================================================
   POPUP STYLES
   ===================================================== */
.popup-calculator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10000;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    min-width: 400px;
    max-width: 95vw;
    max-height: 95vh;
    overflow: hidden;
}

.popup-calculator__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    cursor: move;
}

.popup-calculator__title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.popup-calculator__close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 1.25rem;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.popup-calculator__close:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.popup-calculator__body {
    padding: 1.25rem;
    max-height: calc(95vh - 60px);
    overflow-y: auto;
}

.popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 9999;
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 900px) {
    .savings-container {
        grid-template-columns: 1fr;
    }
    
    .savings-form {
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
}

@media (max-width: 640px) {
    .tool-page {
        padding: 1rem;
    }
    
    .tool-header {
        flex-direction: column;
        text-align: center;
    }
    
    .tool-header__text h1 {
        font-size: 1.5rem;
    }
    
    .savings-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .savings-toolbar__left,
    .savings-toolbar__right {
        justify-content: center;
    }
    
    .savings-form,
    .savings-results {
        padding: 1rem;
    }
    
    .form-row--actions {
        flex-direction: column;
    }
    
    .examples-grid {
        grid-template-columns: 1fr;
    }
    
    .radio-group {
        flex-direction: column;
    }
    
    .radio-option {
        justify-content: flex-start;
    }
    
    .btn-popup__text {
        display: none;
    }
    
    .features-grid,
    .steps-grid {
        grid-template-columns: 1fr;
    }
    
    .formula-legend {
        grid-template-columns: 1fr;
    }
    
    .savings-info {
        margin: 0 1rem 1rem;
    }
    
    .summary-card__value {
        font-size: 1.15rem;
    }
    
    .popup-calculator {
        min-width: auto;
        width: 95vw;
    }
}

@media (max-width: 480px) {
    .design-selector label {
        display: none;
    }
    
    .current-date-banner {
        padding: 0.75rem 1rem;
        flex-wrap: wrap;
        text-align: center;
    }
    
    .current-date-banner__text {
        font-size: 0.95rem;
    }
    
    .breakdown-table th,
    .breakdown-table td {
        padding: 0.5rem;
        font-size: 0.75rem;
    }
}
