/**
 * Hurricane Cone Colors Frontend Styles
 * 
 * Styles for maps, controls, legends, and responsive design
 */

/* ==========================================================================
   Base Styles
   ========================================================================== */

.hcc-map-container {
    position: relative;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    background: #f9f9f9;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
}

.hcc-map {
    width: 100%;
    height: 100%;
    min-height: 400px;
    position: relative;
    z-index: 1;
}

.hcc-map.hcc-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    z-index: 1000;
    background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDAiIGhlaWdodD0iNDAiIHZpZXdCb3g9IjAgMCA0MCA0MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICAgIDxjaXJjbGUgY3g9IjIwIiBjeT0iMjAiIHI9IjE4IiBmaWxsPSJub25lIiBzdHJva2U9IiMwMDczYWEiIHN0cm9rZS13aWR0aD0iNCIgc3Ryb2tlLWRhc2hhcnJheT0iNTYuNTQ4NjY3NzY0NjE2MjgiIHN0cm9rZS1kYXNob2Zmc2V0PSI1Ni41NDg2Njc3NjQ2MTYyOCIvPgogICAgPGFuaW1hdGVUcmFuc2Zvcm0gYXR0cmlidXRlTmFtZT0idHJhbnNmb3JtIiB0eXBlPSJyb3RhdGUiIHZhbHVlcz0iMCAyMCAyMDszNjAgMjAgMjAiIGR1cj0iMXMiIHJlcGVhdENvdW50PSJpbmRlZmluaXRlIi8+Cjwvc3ZnPg==');
    background-repeat: no-repeat;
    background-position: center;
    background-size: 40px 40px;
}

/* ==========================================================================
   Storm Markers
   ========================================================================== */

.hcc-storm-marker {
    background: transparent;
    border: none;
}

.hcc-storm-icon {
    background: #fff;
    border: 2px solid #333;
    border-radius: 8px;
    padding: 4px 8px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    position: relative;
}

.hcc-storm-icon::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid #333;
}

.hcc-storm-name {
    display: block;
    font-weight: bold;
    font-size: 11px;
    color: #333;
    line-height: 1.2;
}

.hcc-wind-speed {
    display: block;
    font-size: 10px;
    color: #666;
    line-height: 1.2;
}

/* ==========================================================================
   Popups
   ========================================================================== */

.hcc-storm-popup,
.hcc-cone-popup {
    min-width: 250px;
}

.hcc-storm-popup h3,
.hcc-cone-popup h4 {
    margin: 0 0 10px 0;
    color: #333;
    border-bottom: 2px solid #0073aa;
    padding-bottom: 5px;
}

.hcc-popup-details {
    margin-bottom: 15px;
}

.hcc-popup-details > div {
    margin-bottom: 5px;
    font-size: 13px;
}

.hcc-popup-details strong {
    color: #333;
    margin-right: 5px;
}

.hcc-popup-actions {
    text-align: center;
}

.hcc-popup-actions .hcc-btn {
    margin: 0 5px;
}

/* ==========================================================================
   Legend
   ========================================================================== */

.hcc-legend {
    position: absolute;
    bottom: 10px;
    left: 10px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 10px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    max-width: 250px;
}

.hcc-legend h4 {
    margin: 0 0 8px 0;
    font-size: 14px;
    color: #333;
    border-bottom: 1px solid #ddd;
    padding-bottom: 5px;
}

.hcc-legend-items {
    font-size: 12px;
}

.hcc-legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 4px;
}

.hcc-legend-color {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    margin-right: 8px;
    border: 1px solid #999;
    flex-shrink: 0;
}

/* ==========================================================================
   Controls
   ========================================================================== */

.hcc-controls {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1000;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.hcc-btn {
    background: #0073aa;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: background-color 0.2s;
    white-space: nowrap;
}

.hcc-btn:hover {
    background: #005a87;
}

.hcc-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.hcc-basin-filter {
    padding: 6px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 12px;
    background: white;
}

/* ==========================================================================
   Storm List
   ========================================================================== */

.hcc-storm-list {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
}

.hcc-storm-item {
    border-bottom: 1px solid #eee;
    padding: 15px;
    transition: background-color 0.2s;
}

.hcc-storm-item:last-child {
    border-bottom: none;
}

.hcc-storm-item:hover {
    background: #f9f9f9;
}

.hcc-storm-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.hcc-storm-name {
    margin: 0;
    color: #333;
    font-size: 18px;
}

.hcc-category-badge,
.hcc-status-badge {
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: bold;
    text-align: center;
    min-width: 60px;
}

.hcc-storm-details {
    margin-bottom: 15px;
}

.hcc-detail-row {
    display: flex;
    margin-bottom: 5px;
    font-size: 14px;
}

.hcc-detail-label {
    font-weight: bold;
    color: #666;
    min-width: 120px;
    margin-right: 10px;
}

.hcc-detail-value {
    color: #333;
}

.hcc-storm-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.hcc-storm-actions .hcc-btn {
    font-size: 11px;
    padding: 4px 8px;
}

/* Compact list style */
.hcc-storm-list.hcc-compact .hcc-storm-item {
    padding: 10px;
}

.hcc-storm-list.hcc-compact .hcc-storm-name {
    font-size: 16px;
}

.hcc-storm-list.hcc-compact .hcc-storm-details {
    display: none;
}

/* ==========================================================================
   Hurricane Tracker
   ========================================================================== */

.hcc-tracker-container {
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.hcc-tracker-header {
    background: #f5f5f5;
    padding: 15px;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.hcc-tracker-header h3 {
    margin: 0;
    color: #333;
}

.hcc-tracker-status {
    display: flex;
    align-items: center;
    gap: 10px;
}

.hcc-wind-speed {
    font-weight: bold;
    color: #333;
}

.hcc-tracker-map {
    height: 400px;
    position: relative;
}

.hcc-tracker-info {
    background: #f9f9f9;
    padding: 15px;
    border-top: 1px solid #ddd;
}

.hcc-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.hcc-info-item {
    display: flex;
    flex-direction: column;
}

.hcc-info-item label {
    font-weight: bold;
    color: #666;
    font-size: 12px;
    margin-bottom: 2px;
}

.hcc-info-item span {
    color: #333;
    font-size: 14px;
}

/* ==========================================================================
   Alerts
   ========================================================================== */

.hcc-alerts-container {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    overflow: hidden;
}

.hcc-alerts-header {
    background: #f5f5f5;
    padding: 15px;
    border-bottom: 1px solid #ddd;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.hcc-alerts-header h3 {
    margin: 0;
    color: #333;
}

.hcc-auto-refresh {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: #666;
}

.hcc-refresh-indicator {
    width: 8px;
    height: 8px;
    background: #00aa00;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.3; }
    100% { opacity: 1; }
}

.hcc-alerts-list {
    max-height: 400px;
    overflow-y: auto;
}

.hcc-alert-item {
    padding: 15px;
    border-bottom: 1px solid #eee;
    border-left: 4px solid #ccc;
}

.hcc-alert-item:last-child {
    border-bottom: none;
}

.hcc-alert-item.hcc-alert-watch {
    border-left-color: #ff9800;
    background: #fff8e1;
}

.hcc-alert-item.hcc-alert-warning {
    border-left-color: #f44336;
    background: #ffebee;
}

.hcc-alert-item.hcc-alert-advisory {
    border-left-color: #2196f3;
    background: #e3f2fd;
}

.hcc-alert-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 10px;
}

.hcc-alert-type {
    background: #666;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
}

.hcc-alert-region {
    font-weight: bold;
    color: #333;
}

.hcc-alert-time {
    font-size: 12px;
    color: #666;
}

.hcc-alert-content h4 {
    margin: 0 0 8px 0;
    color: #333;
}

.hcc-alert-content p {
    margin: 0 0 10px 0;
    color: #555;
    line-height: 1.4;
}

.hcc-affected-areas {
    font-size: 13px;
    color: #666;
}

.hcc-affected-areas strong {
    color: #333;
}

/* ==========================================================================
   Error and Empty States
   ========================================================================== */

.hcc-error,
.hcc-no-storms,
.hcc-no-alerts {
    text-align: center;
    padding: 40px 20px;
    color: #666;
    background: #f9f9f9;
    border-radius: 6px;
    margin: 20px 0;
}

.hcc-error {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ffcdd2;
}

.hcc-error-message {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: #f44336;
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 12px;
    z-index: 1001;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.hcc-last-refresh {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.9);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    color: #666;
    z-index: 1000;
}

/* ==========================================================================
   Color Preview
   ========================================================================== */

.hcc-color-preview {
    display: inline-block;
    width: 20px;
    height: 20px;
    border-radius: 3px;
    margin-right: 8px;
    vertical-align: middle;
    border: 1px solid #ccc;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 768px) {
    .hcc-controls {
        position: static;
        background: rgba(255, 255, 255, 0.95);
        padding: 10px;
        border-bottom: 1px solid #ddd;
        justify-content: center;
    }
    
    .hcc-legend {
        position: static;
        margin: 10px;
        max-width: none;
    }
    
    .hcc-storm-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    
    .hcc-detail-row {
        flex-direction: column;
    }
    
    .hcc-detail-label {
        min-width: auto;
        margin-right: 0;
        margin-bottom: 2px;
    }
    
    .hcc-info-grid {
        grid-template-columns: 1fr;
    }
    
    .hcc-alert-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .hcc-tracker-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    .hcc-map-container {
        margin: 10px 0;
    }
    
    .hcc-map {
        min-height: 300px;
    }
    
    .hcc-storm-item {
        padding: 10px;
    }
    
    .hcc-storm-name {
        font-size: 16px;
    }
    
    .hcc-storm-actions {
        justify-content: center;
    }
    
    .hcc-tracker-map {
        height: 300px;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .hcc-controls,
    .hcc-storm-actions,
    .hcc-popup-actions {
        display: none;
    }
    
    .hcc-map-container {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .hcc-legend {
        position: static;
        background: white;
        border: 1px solid #000;
        margin: 10px 0;
    }
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

.hcc-btn:focus,
.hcc-basin-filter:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.hcc-storm-item:focus {
    outline: 2px solid #0073aa;
    outline-offset: -2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .hcc-storm-icon {
        border-width: 3px;
    }
    
    .hcc-legend {
        background: white;
        border-width: 2px;
    }
    
    .hcc-btn {
        border: 2px solid #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .hcc-refresh-indicator {
        animation: none;
    }
    
    .hcc-storm-item {
        transition: none;
    }
    
    .hcc-btn {
        transition: none;
    }
}