/**
 * Costaboard Live Frontend Styles
 * 
 * Modern, responsive styling for cost of living comparison widgets
 */

/* Reset and base styles */
.costaboard-widget * {
    box-sizing: border-box;
}

.costaboard-widget {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    max-width: 1200px;
    margin: 0 auto;
}

/* Header styles */
.costaboard-header {
    text-align: center;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.costaboard-header h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.8rem;
    font-weight: 600;
}

.costaboard-header p {
    margin: 0;
    opacity: 0.9;
    font-size: 1rem;
}

/* Search container styles */
.costaboard-search-container {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    margin-bottom: 2rem;
}

.costaboard-search-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.costaboard-search-field {
    flex: 1;
    position: relative;
}

.costaboard-search-field label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #555;
    font-size: 0.9rem;
}

.costaboard-location-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
}

.costaboard-location-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.costaboard-swap-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1.5rem;
}

.costaboard-swap-btn button {
    background: #f8f9fa;
    border: 2px solid #e1e5e9;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.costaboard-swap-btn button:hover {
    background: #667eea;
    border-color: #667eea;
    color: white;
    transform: rotate(180deg);
}

.costaboard-search-actions {
    text-align: center;
}

.costaboard-btn {
    display: inline-block;
    padding: 0.75rem 2rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    text-align: center;
}

.costaboard-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.costaboard-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

/* Search results styles */
.costaboard-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #e1e5e9;
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.costaboard-search-result {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid #f1f3f4;
    transition: background-color 0.2s ease;
}

.costaboard-search-result:hover {
    background-color: #f8f9fa;
}

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

.costaboard-result-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 0.25rem;
}

.costaboard-result-type {
    font-size: 0.8rem;
    color: #666;
    text-transform: capitalize;
    margin-bottom: 0.25rem;
}

.costaboard-result-cost {
    font-size: 0.8rem;
    color: #667eea;
    font-weight: 600;
}

/* Results styles */
.costaboard-results {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    margin-bottom: 2rem;
}

.costaboard-loading {
    text-align: center;
    padding: 3rem;
}

.costaboard-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

/* Summary styles */
.costaboard-summary {
    margin-bottom: 2rem;
}

.costaboard-summary-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
}

.costaboard-summary-card h4 {
    margin: 0 0 1rem 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.costaboard-summary-value {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

/* Category styles */
.costaboard-categories {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.costaboard-category {
    background: white;
    border: 2px solid #e1e5e9;
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
}

.costaboard-category:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.costaboard-category-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.costaboard-category-info h5 {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: #333;
}

.costaboard-category-diff {
    font-size: 1.1rem;
    font-weight: 600;
}

/* Chart styles */
.costaboard-charts {
    margin-bottom: 2rem;
}

.costaboard-chart-container {
    background: white;
    border: 2px solid #e1e5e9;
    border-radius: 12px;
    padding: 1.5rem;
}

.costaboard-chart-container h4 {
    margin: 0 0 1rem 0;
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
}

/* Map styles */
.costaboard-map {
    margin-bottom: 2rem;
}

.costaboard-map h4 {
    margin: 0 0 1rem 0;
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
}

#costaboard-map-container {
    height: 400px;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid #e1e5e9;
}

/* Calculator styles */
.costaboard-calculator-form {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    margin-bottom: 2rem;
}

.costaboard-calculator-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.costaboard-calculator-field {
    position: relative;
}

.costaboard-calculator-field label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #555;
    font-size: 0.9rem;
}

.costaboard-salary-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.costaboard-salary-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.costaboard-calculator-actions {
    text-align: center;
}

.costaboard-calculator-results {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.costaboard-calculator-summary {
    margin-bottom: 2rem;
}

.costaboard-calculator-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
}

.costaboard-calculator-card h4 {
    margin: 0 0 1rem 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.costaboard-calculator-value {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.costaboard-calculator-diff {
    font-size: 1.1rem;
    font-weight: 600;
}

.costaboard-calculator-breakdown h4 {
    margin: 0 0 1rem 0;
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
}

.costaboard-breakdown-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

/* Popular locations styles */
.costaboard-popular-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.costaboard-popular-item {
    background: white;
    border: 2px solid #e1e5e9;
    border-radius: 12px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.costaboard-popular-item:hover {
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.costaboard-popular-info h4 {
    margin: 0 0 0.25rem 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
}

.costaboard-popular-info p {
    margin: 0;
    font-size: 0.9rem;
    color: #666;
}

.costaboard-popular-cost {
    text-align: right;
}

.costaboard-cost-index {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: #667eea;
}

.costaboard-cost-label {
    display: block;
    font-size: 0.8rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Map widget styles */
.costaboard-map-widget .costaboard-map-container {
    background: white;
    border: 2px solid #e1e5e9;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.costaboard-map-controls {
    background: white;
    border: 2px solid #e1e5e9;
    border-radius: 12px;
    padding: 1rem;
}

.costaboard-map-legend {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.costaboard-legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: #555;
}

.costaboard-legend-color {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.costaboard-legend-color.costaboard-low {
    background-color: #00ff00;
}

.costaboard-legend-color.costaboard-medium {
    background-color: #ffff00;
}

.costaboard-legend-color.costaboard-high {
    background-color: #ff0000;
}

/* Color indicators */
.costaboard-higher {
    color: #dc3545;
}

.costaboard-lower {
    color: #28a745;
}

.costaboard-same {
    color: #6c757d;
}

/* Loading and error states */
.costaboard-loading,
.costaboard-no-results,
.costaboard-error {
    text-align: center;
    padding: 2rem;
    color: #666;
}

.costaboard-error {
    color: #dc3545;
}

/* Responsive design */
@media (max-width: 768px) {
    .costaboard-search-row {
        flex-direction: column;
        gap: 1rem;
    }
    
    .costaboard-swap-btn {
        margin-top: 0;
    }
    
    .costaboard-categories {
        grid-template-columns: 1fr;
    }
    
    .costaboard-calculator-row {
        grid-template-columns: 1fr;
    }
    
    .costaboard-popular-list {
        grid-template-columns: 1fr;
    }
    
    .costaboard-map-legend {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }
    
    .costaboard-header h3 {
        font-size: 1.5rem;
    }
    
    .costaboard-summary-value,
    .costaboard-calculator-value {
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .costaboard-search-container,
    .costaboard-results,
    .costaboard-calculator-form,
    .costaboard-calculator-results {
        padding: 1rem;
    }
    
    .costaboard-header {
        padding: 1rem;
    }
    
    .costaboard-header h3 {
        font-size: 1.3rem;
    }
    
    .costaboard-summary-value,
    .costaboard-calculator-value {
        font-size: 1.8rem;
    }
}

/* Dark theme support */
.costaboard-widget[data-theme="dark"] {
    color: #e1e5e9;
    background: #1a1a1a;
}

.costaboard-widget[data-theme="dark"] .costaboard-search-container,
.costaboard-widget[data-theme="dark"] .costaboard-results,
.costaboard-widget[data-theme="dark"] .costaboard-calculator-form,
.costaboard-widget[data-theme="dark"] .costaboard-calculator-results,
.costaboard-widget[data-theme="dark"] .costaboard-category,
.costaboard-widget[data-theme="dark"] .costaboard-chart-container,
.costaboard-widget[data-theme="dark"] .costaboard-popular-item,
.costaboard-widget[data-theme="dark"] .costaboard-map-container,
.costaboard-widget[data-theme="dark"] .costaboard-map-controls {
    background: #2d2d2d;
    border-color: #404040;
}

.costaboard-widget[data-theme="dark"] .costaboard-location-input,
.costaboard-widget[data-theme="dark"] .costaboard-salary-input {
    background: #2d2d2d;
    border-color: #404040;
    color: #e1e5e9;
}

.costaboard-widget[data-theme="dark"] .costaboard-search-results {
    background: #2d2d2d;
    border-color: #404040;
}

.costaboard-widget[data-theme="dark"] .costaboard-search-result:hover {
    background-color: #404040;
}

/* Accessibility improvements */
.costaboard-btn:focus,
.costaboard-location-input:focus,
.costaboard-salary-input:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.costaboard-search-result:focus {
    outline: 2px solid #667eea;
    outline-offset: -2px;
}

/* Print styles */
@media print {
    .costaboard-widget {
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .costaboard-btn,
    .costaboard-swap-btn {
        display: none;
    }
}
