/**
 * Advanced Annuity Calculator - Frontend Styles
 * 
 * Main styling for the calculator frontend
 * 
 * @package AdvancedAnnuityCalculator
 * @since 1.0.0
 */

/* Main Container */
.aac-container {
    width: 95% !important;
    max-width: 1200px;
    margin: 0 auto;
    padding: 15px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    box-sizing: border-box;
}

/* Calculator Card */
.aac-calculator {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    border: 1px solid #e1e5e9;
}

/* Header */
.aac-header {
    background: linear-gradient(135deg, #007cba 0%, #005a87 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

.aac-title {
    margin: 0 0 10px 0;
    font-size: 2em;
    font-weight: 700;
}

.aac-description {
    margin: 0;
    font-size: 1.1em;
    opacity: 0.9;
}

/* Form Grid */
.aac-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    padding: 20px;
}

/* Section Titles */
.aac-section-title {
    margin: 0 0 20px 0;
    font-size: 1.3em;
    font-weight: 600;
    border-bottom: 2px solid #007cba;
    padding-bottom: 10px;
}

/* Form Groups */
.aac-form-group {
    margin-bottom: 18px;
}

.aac-form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #495057;
    font-size: 0.9em;
    line-height: 1.4;
}

.aac-input,
.aac-select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 1em;
    transition: all 0.3s ease;
    background: white;
    box-sizing: border-box;
    font-family: inherit;
}

.aac-input:focus,
.aac-select:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 3px rgba(0, 124, 186, 0.1);
    transform: translateY(-1px);
}

.aac-input:hover,
.aac-select:hover {
    border-color: #007cba;
}

.aac-help {
    display: block;
    margin-top: 5px;
    font-size: 0.85em;
    color: #6c757d;
    font-style: italic;
}

/* Input Sections */
.aac-input-section,
.aac-results-section {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
    border: 1px solid #e9ecef;
    box-sizing: border-box;
    overflow: hidden;
}

/* Results Display */
.aac-results {
    background: white;
    border-radius: 6px;
    padding: 15px;
    border: 1px solid #dee2e6;
    box-sizing: border-box;
    min-height: 200px;
}

.aac-results-summary {
    display: grid;
    gap: 12px;
}

.aac-result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 4px solid #007cba;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 50px;
}

.aac-result-label {
    font-weight: 600;
    color: #495057;
}

.aac-result-value {
    font-weight: 700;
    color: #007cba;
    font-size: 1.1em;
}

/* Charts */
.aac-charts-section {
    margin-top: 20px;
}

.aac-chart-container {
    position: relative;
    height: 250px;
    width: 100%;
    overflow: hidden;
    margin-bottom: 20px;
    background: white;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    padding: 15px;
    box-sizing: border-box;
}

.aac-chart-container canvas {
    max-width: 100%;
    height: auto !important;
}

/* Breakdown Section */
.aac-breakdown-section {
    margin-top: 20px;
    padding: 15px;
    background: white;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    box-sizing: border-box;
}

.aac-breakdown-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    font-size: 0.85em;
    table-layout: fixed;
}

.aac-breakdown-table th,
.aac-breakdown-table td {
    padding: 8px 6px;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
    word-wrap: break-word;
    min-width: 60px;
}

.aac-breakdown-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #495057;
}

/* Export Section */
.aac-export-section {
    margin-top: 20px;
    padding: 15px;
    background: white;
    border-radius: 6px;
    border: 1px solid #dee2e6;
    box-sizing: border-box;
}

.aac-export-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Buttons */
.aac-btn {
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
    min-height: 44px;
    box-sizing: border-box;
}

.aac-btn-primary {
    background: #007cba;
    color: white;
}

.aac-btn-primary:hover {
    background: #005a87;
    transform: translateY(-1px);
}

.aac-btn-secondary {
    background: #6c757d;
    color: white;
}

.aac-btn-secondary:hover {
    background: #545b62;
    transform: translateY(-1px);
}

.aac-toggle-btn {
    background: #28a745;
    color: white;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    font-size: 0.9em;
    cursor: pointer;
    margin-left: 10px;
}

/* Loading */
.aac-loading {
    text-align: center;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 6px;
    margin: 20px 0;
}

.aac-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Variable Rates Table */
.aac-variable-rates-table {
    margin-top: 15px;
    padding: 15px;
    background: #e7f3ff;
    border-radius: 6px;
    border: 1px solid #b3d9ff;
}

.aac-variable-rates-table h4 {
    margin: 0 0 15px 0;
    color: #0066cc;
    font-size: 1.1em;
}

.aac-rate-input-group {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    gap: 10px;
}

.aac-rate-input-group label {
    min-width: 80px;
    font-size: 0.9em;
    margin: 0;
}

.aac-rate-input {
    flex: 1;
    max-width: 150px;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .aac-form-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

@media (max-width: 768px) {
    .aac-container {
        width: 95% !important;
        padding: 10px;
    }
    
    .aac-header {
        padding: 20px 15px;
    }
    
    .aac-title {
        font-size: 1.6em;
    }
    
    .aac-form-grid {
        padding: 15px;
        gap: 12px;
    }
    
    .aac-input-section,
    .aac-results-section {
        padding: 15px;
    }
    
    .aac-result-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .aac-result-label,
    .aac-result-value {
        width: 100%;
    }
    
    .aac-chart-container {
        height: 200px;
        padding: 10px;
    }
    
    .aac-chart-container canvas {
        max-width: 100% !important;
        height: auto !important;
    }
    
    .aac-breakdown-table {
        font-size: 0.75em;
    }
    
    .aac-breakdown-table th,
    .aac-breakdown-table td {
        padding: 6px 4px;
        min-width: 50px;
    }
    
    .aac-export-buttons {
        flex-direction: column;
    }
    
    .aac-export-buttons .aac-btn {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .aac-container {
        width: 95% !important;
        padding: 5px;
        margin: 0 auto;
    }
    
    .aac-header {
        padding: 15px 10px;
    }
    
    .aac-title {
        font-size: 1.4em;
        line-height: 1.2;
    }
    
    .aac-description {
        font-size: 0.9em;
    }
    
    .aac-form-grid {
        padding: 8px;
        gap: 12px;
    }
    
    .aac-input-section,
    .aac-results-section {
        padding: 12px;
    }
    
    .aac-form-group {
        margin-bottom: 15px;
    }
    
    .aac-input,
    .aac-select {
        padding: 10px 12px;
        font-size: 16px; /* Prevents zoom on iOS */
    }
    
    .aac-result-item {
        padding: 8px;
        gap: 4px;
    }
    
    .aac-result-label {
        font-size: 0.85em;
    }
    
    .aac-result-value {
        font-size: 0.95em;
    }
    
    .aac-rate-input-group {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    .aac-rate-input-group label {
        min-width: auto;
        font-size: 0.9em;
    }
    
    .aac-rate-input {
        max-width: 100%;
        width: 100%;
    }
    
    .aac-chart-container {
        height: 200px;
        padding: 8px;
        margin-bottom: 15px;
    }
    
    .aac-chart-container canvas {
        max-width: 100% !important;
        height: auto !important;
        max-height: 200px !important;
    }
    
    .aac-charts-section h4 {
        font-size: 1.1em;
        margin-bottom: 10px;
    }
    
    .aac-breakdown-table {
        font-size: 0.65em;
    }
    
    .aac-breakdown-table th,
    .aac-breakdown-table td {
        padding: 4px 2px;
        min-width: 50px;
    }
}

/* Print Styles */
@media print {
    .aac-container {
        width: 100% !important;
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .aac-header {
        background: #f0f0f0 !important;
        color: #000 !important;
    }
    
    .aac-charts-section,
    .aac-export-section {
        display: none;
    }
    
    .aac-result-item {
        border-left: 4px solid #000;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .aac-input,
    .aac-select,
    .aac-btn {
        transition: none;
    }
    
    .aac-spinner {
        animation: none;
    }
}

/* Additional Mobile Optimizations */
@media (max-width: 768px) {
    .aac-variable-rates-table {
        padding: 15px;
        margin-top: 15px;
    }
    
    .aac-variable-rates-table h4 {
        font-size: 1em;
        margin-bottom: 12px;
    }
    
    .aac-rate-input-group {
        margin-bottom: 8px;
    }
    
    .aac-rate-input-group label {
        font-size: 0.85em;
        margin-bottom: 4px;
    }
    
    .aac-rate-input {
        padding: 8px 10px;
        font-size: 14px;
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    .aac-btn {
        min-height: 44px;
        padding: 12px 20px;
    }
    
    .aac-input,
    .aac-select {
        min-height: 44px;
        padding: 12px 15px;
    }
    
    .aac-toggle-btn {
        min-height: 44px;
        padding: 12px 16px;
    }
}

/* High DPI display optimizations */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .aac-calculator {
        border: 0.5px solid #e1e5e9;
    }
    
    .aac-input,
    .aac-select {
        border-width: 1px;
    }
}