/* Forward vs. Trailing Yield Calculator - Responsive Design */
/* Base styles for mobile */
.forward-trailing-yield-calculator {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

/* Mobile optimizations (up to 640px) */
@media (max-width: 640px) {
    .forward-trailing-yield-calculator {
        padding: 0;
        margin: 0;
    }
    
    .calculator-sidebar {
        margin-bottom: 1rem;
        order: 2;
    }
    
    .calculator-results {
        order: 1;
        margin-bottom: 1rem;
    }
    
    .sticky-sidebar {
        position: relative !important;
        top: 0 !important;
    }
    
    /* Form optimizations */
    .yield-calc-input {
        font-size: 16px !important; /* Prevents zoom on iOS */
        padding: 12px 16px !important;
    }
    
    select {
        font-size: 16px !important; /* Prevents zoom on iOS */
    }
    
    /* Chart responsiveness */
    .chart-container {
        height: 250px !important;
        min-height: 250px !important;
    }
    
    /* Table responsiveness */
    .results-table {
        font-size: 0.75rem;
        overflow-x: auto;
    }
    
    .results-table th,
    .results-table td {
        padding: 0.5rem 0.25rem;
        white-space: nowrap;
    }
    
    /* Summary cards */
    .summary-cards {
        grid-template-columns: 1fr !important;
        gap: 0.75rem !important;
    }
    
    /* Header adjustments */
    .calculator-header h1 {
        font-size: 1.5rem !important;
        line-height: 1.2 !important;
    }
    
    .calculator-header p {
        font-size: 0.875rem !important;
        line-height: 1.4 !important;
    }
}

/* Tablet optimizations (641px to 1024px) */
@media (min-width: 641px) and (max-width: 1024px) {
    .chart-container {
        height: 300px !important;
        min-height: 300px !important;
    }
    
    /* Summary cards layout */
    .summary-cards {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem !important;
    }
    
    /* Form adjustments */
    .yield-calc-input {
        font-size: 14px;
        padding: 0.875rem;
    }
}

/* Desktop optimizations (1025px and above) */
@media (min-width: 1025px) {
    .chart-container {
        height: 400px !important;
        min-height: 400px !important;
    }
    
    /* Summary cards layout */
    .summary-cards {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 1.5rem !important;
    }
    
    /* Form adjustments */
    .yield-calc-input, select {
        font-size: 16px;
        padding: 1rem;
    }
    
    .sticky-sidebar {
        position: sticky !important;
        top: 1rem !important;
    }
}

/* Flex utilities */
.flex-1.min-w-0 {
    flex: 1 1 0%;
    min-width: 0;
}

.flex-1.min-w-0 h4,
.flex-1.min-w-0 p {
    margin: 0;
}

/* Fix Astra scroll-to-top icon centering */
.ast-scroll-top-icon.ast-scroll-to-top-right {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999;
}

.ast-scroll-top-icon.ast-scroll-to-top-right::before,
.ast-scroll-top-icon.ast-scroll-to-top-right::after {
    margin: auto !important;
}

/* Forward vs. Trailing Yield Calculator specific styles */
.forward-trailing-yield-calculator.yield-calc {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    min-height: 100vh;
}

.calculator-results::-webkit-scrollbar {
    width: 8px;
}

.calculator-results::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.calculator-results::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

.calculator-results::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Global styles */
* {
    box-sizing: border-box;
}

.yield-calc-input:focus, select:focus, textarea:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
    border-color: #3498db;
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.calculator-results.active {
    animation: fadeInUp 0.6s ease-out;
}

/* Forward vs. Trailing Yield Calculator specific header styles */
.yield-calc .bg-gradient-to-br h1 {
    background: linear-gradient(135deg, #ffffff 0%, #fef3c7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Select styling */
select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
}

select:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

select option {
    background-color: white;
    color: #374151;
    padding: 0.5rem;
    font-size: 0.875rem;
}

select::-ms-expand {
    display: none;
}

/* Specific select styling for yield calculator */
select#payout_frequency {
    background-color: white;
    color: #374151;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    line-height: 1.25rem;
    padding: 0.75rem 1rem;
    width: 100%;
    background-image: none !important;
    padding-right: 1rem !important;
}

select#payout_frequency option {
    background-color: white;
    color: #374151;
    padding: 0.5rem;
}

/* Number input styling */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

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

/* Button styling for yield calculator */
.yield-calc-btn {
    background: linear-gradient(135deg, #3498db 0%, #8e44ad 100%);
    color: white;
    border: none;
    border-radius: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.yield-calc-btn:hover {
    background: linear-gradient(135deg, #2980b9 0%, #7d3c98 100%);
    transform: translateY(-1px);
}

/* Card styling for yield calculator */
.yield-calc-card {
    transition: all 0.3s ease;
}

.yield-calc-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Orange color fixes for yield calculator */
.bg-orange-500 {
    background-color: #f97316 !important;
}

.text-orange-600 {
    color: #ea580c !important;
}

.border-orange-200 {
    border-color: #fed7aa !important;
}

.from-orange-50 {
    background: linear-gradient(to bottom right, #fff7ed, #ffedd5) !important;
}

.to-orange-100 {
    background: linear-gradient(to bottom right, #ffedd5, #fed7aa) !important;
}

/* Fix gradient background for orange cards */
.bg-gradient-to-br.from-orange-50.to-orange-100 {
    background: linear-gradient(to bottom right, #fff7ed, #fed7aa) !important;
}

/* Override theme margin for calculator headers */
.yield-calc .bg-white h2,
.yield-calc .bg-white p {
    margin-bottom: 0 !important;
}

/* Global form input padding */
input[type="text"], 
input[type="number"], 
input[type="email"], 
input[type="url"], 
input[type="password"], 
input[type="search"], 
input[type="reset"], 
input[type="tel"], 
input[type="date"], 
select, 
textarea {
    padding: 12px 16px !important;
}

/* Remove padding from specific input class */
.yield-calc-input {
    padding: 0 15px !important;
}

/* Yield Comparison Section Styles */
#yield-comparison-section {
    transition: all 0.3s ease;
}

#yield-comparison-section.show {
    display: block !important;
}

/* Enhanced Yield Selection Dropdown */
#payout_frequency {
    font-weight: 500;
}

#payout_frequency option {
    font-weight: normal;
}

/* Yield Calculator Loading Animation */
.yield-calc-input.loading {
    opacity: 0.7;
    pointer-events: none;
}

/* Yield Comparison Chart Enhancements */
#yield-comparison-chart {
    position: relative;
}

/* Responsive Yield Comparison Table */
.yield-comparison-table {
    overflow-x: auto;
    margin-top: 1rem;
}

.yield-comparison-table table {
    min-width: 600px;
}

/* Yield Calculator Info Display */
.yield-calc-info {
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1px solid #bae6fd;
    border-radius: 0.5rem;
    padding: 0.75rem;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: #0369a1;
}

/* Enhanced Mobile Responsiveness for Yield Calculator */
@media (max-width: 640px) {
    .yield-calc-card {
        margin-bottom: 1rem;
    }
    
    .yield-calc-card .grid {
        grid-template-columns: 1fr !important;
    }
    
    #yield-comparison-section {
        margin-top: 1rem;
    }
    
    .yield-calc-info {
        font-size: 0.75rem;
        padding: 0.5rem;
    }
}

/* Yield Calculator Specific Animations */
@keyframes yieldSlideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.yield-calc-card {
    animation: yieldSlideIn 0.4s ease-out;
}

/* Yield Comparison Chart Responsive */
@media (max-width: 768px) {
    #yield-comparison-chart {
        height: 300px !important;
    }
}

/* Enhanced Form Validation Styles */
.yield-calc-input.error {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;
}

.yield-calc-input.success {
    border-color: #10b981 !important;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1) !important;
}

/* Yield Calculator Loading States */
.yield-calc-loading {
    opacity: 0.6;
    pointer-events: none;
}

.yield-calc-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #3498db;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Yield Calculator Print Styles */
@media print {
    .forward-trailing-yield-calculator {
        background: white !important;
    }
    
    .yield-calc-card {
        break-inside: avoid;
        box-shadow: none !important;
        border: 1px solid #d1d5db !important;
    }
    
    .yield-calc-btn,
    .reset-btn {
        display: none !important;
    }
}

/* Formula explanation styles */
.formula-explanation {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: 0.5rem;
    padding: 1rem;
    margin-top: 1rem;
}

.formula-explanation h5 {
    color: #1f2937;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.formula-explanation p {
    color: #4b5563;
    font-size: 0.875rem;
    line-height: 1.5;
}

/* Enhanced tooltip styles */
.tooltip {
    position: absolute;
    background: #1f2937;
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    line-height: 1.25;
    z-index: 1000;
    max-width: 200px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.tooltip::before {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: #1f2937;
}

/* Mobile optimized tooltips */
@media (max-width: 640px) {
    .tooltip {
        max-width: 150px;
        font-size: 0.625rem;
        padding: 0.375rem 0.5rem;
    }
}

/* Enhanced accessibility for yield calculator */
.yield-calc-input:focus-visible {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

.yield-calc-btn:focus-visible {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .yield-calc-card {
        border-width: 2px;
    }
    
    .yield-calc-input {
        border-width: 2px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .yield-calc-card {
        transition: none;
    }
    
    .calculator-results.active {
        animation: none;
    }
    
    .yield-calc-card {
        animation: none;
    }
}

/* Dark mode support (if needed) */
@media (prefers-color-scheme: dark) {
    .forward-trailing-yield-calculator {
        background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    }
    
    .yield-calc-card {
        background: #374151;
        color: #f9fafb;
    }
}

/* Enhanced error message styling */
.error-message {
    color: #ef4444;
    font-size: 0.75rem;
    margin-top: 0.25rem;
    font-weight: 500;
}

/* Success message styling */
.success-message {
    color: #10b981;
    font-size: 0.75rem;
    margin-top: 0.25rem;
    font-weight: 500;
}

/* Mobile optimization for formula grid */
@media (max-width: 768px) {
    .formula-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
}

/* Enhanced table responsiveness */
@media (max-width: 640px) {
    #yield-comparison-table {
        font-size: 0.75rem;
    }
    
    #yield-comparison-table th,
    #yield-comparison-table td {
        padding: 0.5rem 0.25rem;
    }
}

/* Chart container optimization */
#yield-comparison-chart {
    max-height: 400px;
    min-height: 300px;
}

@media (max-width: 768px) {
    #yield-comparison-chart {
        max-height: 300px;
        min-height: 250px;
    }
}

/* Enhanced summary card animations */
.yield-calc-card:hover .summary-value {
    transform: scale(1.05);
    transition: transform 0.2s ease;
}

/* Remove margin-bottom from form section headers */
.forward-trailing-yield-calculator h3.font-semibold {
    margin-bottom: 0 !important;
}

/* Loading state for yield calculator */
.yield-calc-loading-state {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: #6b7280;
}

.yield-calc-loading-state::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #d1d5db;
    border-top: 2px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 0.5rem;
} 