/* General Body & Layout */
:root {
    --border-color: #e5e7eb;
    --background-color: #f8fafc;
    --card-background: #ffffff;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --primary-color: #0d6efd;
}

body {
    background-color: var(--background-color);
    font-family: 'Inter', sans-serif;
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Main Layout Columns */
.calculator-column {
    background-color: var(--card-background);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    padding: 2rem;
    border-right: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    max-height: 100vh;
    overflow-y: auto;
}

.content-column {
    padding: 3rem 4rem;
    overflow-y: auto;
    height: 100vh;
}

.calculator-wrapper {
    max-width: 500px;
    margin: 0 auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    padding-top: 4rem;
    transition: padding-top 0.3s ease-in-out;
}

.calculator-wrapper.results-shown {
    padding-top: 1rem;
}

.content-wrapper {
    max-width: 700px;
    margin: auto;
}

/* Mobile Responsive */
@media (max-width: 767px) {
    .calculator-column {
        min-height: auto;
        max-height: none;
        height: auto;
        border-right: none;
        position: relative;
        overflow-y: visible;
    }
    .content-column {
        min-height: auto;
        height: auto;
        padding: 2rem 1.5rem;
    }
    .results-section {
        margin-top: 2rem;
    }
    .transfer-guidance {
        /* Height adapts to content on mobile */
    }
    .calculator-wrapper {
        padding-top: 2rem;
    }
    .calculator-wrapper.results-shown {
        padding-top: 0.5rem;
    }
}

/* Calculator Form */
.calculator-header {
    margin-bottom: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease-in-out;
}
.calculator-header h1 {
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.calculator-chevron {
    transition: transform 0.3s ease-in-out;
    font-size: 1rem;
}

.calculator-form-container {
    max-height: 1000px;
    overflow: hidden;
    transition: max-height 0.3s ease-in-out;
}

.calculator-form-container.collapsed {
    max-height: 0;
}

.calculator-header.collapsed .calculator-chevron {
    transform: rotate(180deg);
}

.form-control {
    padding: 0.75rem 1rem;
    font-size: 1rem;
    background-color: #f9fafb;
    border: 1px solid var(--border-color);
}
.form-control:focus {
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.15);
    border-color: var(--primary-color);
}

.btn-primary {
    padding: 0.75rem 1rem;
    font-weight: 600;
}
.btn-primary .spinner-border {
    width: 1rem;
    height: 1rem;
}

/* Content Sections */
.content-column section {
    margin-bottom: 3rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 2rem;
}
.content-column section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}
.content-column h2 {
    font-weight: 700;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}
.content-column p, .content-column li {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Comparison Table */
.comparison-table {
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    overflow: hidden;
}
.comparison-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
}
.comparison-row:last-child {
    border-bottom: none;
}
.comparison-row.header {
    font-weight: 600;
    background-color: #f9fafb;
}
.comparison-row.savings-row {
    background-color: #f0f9ff;
    font-weight: 600;
}
.comparison-row .bi {
    margin-right: 0.5rem;
}

/* API Documentation */
.api-example {
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-top: 1rem;
}

.api-example h6 {
    color: #495057;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.api-url {
    background-color: #e9ecef;
    color: #495057;
    padding: 0.75rem 1rem;
    border-radius: 0.375rem;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    display: block;
    word-break: break-all;
    border: 1px solid #ced4da;
}

.api-details ul {
    margin: 0;
    padding-left: 1.25rem;
}

.api-details li {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

.api-details code {
    background-color: #e9ecef;
    color: #495057;
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
}

/* FAQ */
.faq-item {
    margin-bottom: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 0 1rem;
    background-color: #fff;
}
.faq-item + .faq-item {
    margin-top: 0.75rem;
}
.faq-question {
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
}
.faq-question .bi {
    transition: transform 0.2s ease-in-out;
}
.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-in-out;
    padding: 0;
}
.faq-answer p {
    padding: 0.75rem 0 1rem 0;
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.6;
}
.faq-item.open .faq-answer {
    max-height: 300px; /* Increased for better content fit */
    padding-top: 0.5rem;
}
.faq-item.open .faq-question .bi {
    transform: rotate(180deg);
}


/* Results Section */
.results-section {
    margin-bottom: 2rem;
    transition: all 0.3s ease-in-out;
}

.results-section:empty {
    display: none;
}

/* Results Card */
#resultsContainer {
    transition: all 0.3s ease-in-out;
}

.results-card {
    background-color: #f0f9ff;
    border: 2px solid #0284c7;
    border-radius: 0.75rem;
    padding: 1.5rem;
    animation: slideDown 0.5s ease;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Wallet Details Table */
.wallet-details-table {
    margin-bottom: 1rem;
}

.wallet-details-table .table {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    overflow: hidden;
    font-size: 0.875rem;
}

.wallet-details-table th {
    background: #f9fafb;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid #e5e7eb;
    padding: 0.5rem;
}

.wallet-details-table td {
    padding: 0.5rem;
    vertical-align: middle;
}

.address-compact {
    font-size: 0.75rem;
    color: #4b5563;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideDown {
    from { 
        opacity: 0; 
        transform: translateY(-20px);
        max-height: 0;
    }
    to { 
        opacity: 1; 
        transform: translateY(0);
        max-height: 1000px;
    }
}

.results-status {
    display: flex;
    align-items: center;
    font-weight: 600;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
}
.results-status .bi {
    margin-right: 0.75rem;
    font-size: 1.25rem;
}
.results-status.status-success {
    background-color: #d1e7dd;
    color: #0f5132;
}
.results-status.status-warning {
    background-color: #fff3cd;
    color: #664d03;
}
.results-status.status-danger {
    background-color: #f8d7da;
    color: #842029;
}

.results-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.metric-card {
    background-color: #f9fafb;
    border-radius: 0.5rem;
    padding: 1rem;
    text-align: center;
}
.metric-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
.metric-label .bi {
    margin-right: 0.5rem;
}
.metric-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}
.metric-sub {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.cost-breakdown {
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
}

.cost-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    padding: 0.75rem 0;
}

.cost-row + .cost-item {
    border-top: 1px solid #f3f4f6;
}

.cost-item {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
}
.cost-item + .cost-item {
    border-top: 1px solid #f3f4f6;
}

.cost-row .cost-item {
    padding: 0;
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    padding: 0.5rem;
    background-color: #f9fafb;
}
.cost-item span {
    color: var(--text-secondary);
}
.cost-item strong {
    font-weight: 600;
}
.cost-item.recommended strong {
    color: #198754;
}
.cost-item.rental-price {
    font-size: 0.875rem;
}
.cost-item.rental-price strong {
    color: #0284c7;
}

.savings-banner {
    text-align: center;
    font-weight: 600;
    padding: 0.75rem;
    background-color: #dcfce7;
    color: #166534;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
}

.savings-banner.free-transfer {
    background-color: #f0f9ff;
    color: #0369a1;
    border: 2px solid #0284c7;
}

.issues-list, .recommendations-list {
    font-size: 0.875rem;
}
.issues-list ul, .recommendations-list ul {
    padding-left: 1.25rem;
    margin: 0.5rem 0 0;
}
.issues-list li, .recommendations-list li {
    margin-bottom: 0.25rem;
}
.issues-list {
    background-color: #fffbeb;
    color: #92400e;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    margin-top: 1rem;
}
.recommendations-list {
    margin-top: 1rem;
}
.recommendations-list h6, .issues-list h6 {
    font-weight: 700;
    margin: 0 0 0.5rem;
}
.btn-success {
    background-color: #198754;
    border-color: #198754;
}
.btn-success:hover {
    background-color: #157347;
    border-color: #146c43;
}

/* Transfer Guidance */
.transfer-guidance {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid #dee2e6;
    border-radius: 0.75rem;
    padding: 1rem;
    animation: fadeIn 0.3s ease-in-out;
    overflow-y: auto;
}

.transfer-guidance h6 {
    color: #495057;
    font-weight: 600;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
}

.transfer-guidance .guidance-text {
    color: #6c757d;
    font-size: 0.9rem;
    line-height: 1.5;
}

.transfer-guidance .guidance-text ul {
    margin: 0.5rem 0;
    padding-left: 1.2rem;
}

.transfer-guidance .guidance-text li {
    margin-bottom: 0.3rem;
}

.transfer-guidance .highlight {
    color: #0d6efd;
    font-weight: 600;
}

.transfer-guidance .cost-option {
    background: rgba(13, 110, 253, 0.1);
    padding: 0.5rem;
    border-radius: 0.375rem;
    margin: 0.5rem 0;
    border-left: 3px solid #0d6efd;
}

.transfer-guidance .cost-option a {
    color: #0d6efd;
    text-decoration: none;
    font-weight: 600;
}

.transfer-guidance .cost-option a:hover {
    text-decoration: underline;
}