/**
 * eAgents Nautical Plugin Styles
 * Responsive maritime mapping interface
 */

/* Container Styles */
.eagents-nautical-container {
    position: relative;
    width: 100%;
    height: 500px;
    margin: 20px 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: #f8f9fa;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Map Styles */
.eagents-nautical-map {
    position: relative;
    width: 100%;
    height: 100%;
    z-index: 1;
    border-radius: 0 0 8px 8px;
}

.eagents-nautical-map .leaflet-container {
    font-family: inherit;
}

/* Controls Bar */
.eagents-nautical-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    flex-wrap: wrap;
    gap: 10px;
}

.control-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.info-group {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

/* Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn:active {
    transform: translateY(0);
}

.btn-primary {
    background: #007bff;
    color: white;
}

.btn-primary:hover {
    background: #0056b3;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #545b62;
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover {
    background: #1e7e34;
}

.btn-info {
    background: #17a2b8;
    color: white;
}

.btn-info:hover {
    background: #117a8b;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-danger:hover {
    background: #c82333;
}

/* Info Items */
.info-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    background: rgba(255, 255, 255, 0.1);
    padding: 6px 10px;
    border-radius: 4px;
}

.info-item .label {
    font-weight: 600;
    opacity: 0.9;
}

.info-item .value {
    font-family: 'Courier New', monospace;
    font-weight: 500;
}

/* Mobile Toggle Button */
.mobile-controls-toggle {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 1001;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    font-size: 18px;
    color: #2c3e50;
}

/* Speed and Location Info Panels */
.eagents-nautical-location-info,
.eagents-nautical-speed-info {
    position: absolute;
    left: 10px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    color: #2c3e50;
    border-left: 3px solid #3498db;
    backdrop-filter: blur(5px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    min-width: 120px;
}

.eagents-nautical-location-info {
    bottom: 60px;
}

.eagents-nautical-speed-info {
    bottom: 10px;
}

.speed-display {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.speed-value {
    font-weight: bold;
    color: #27ae60;
}

/* Weather Widget */
.eagents-nautical-weather {
    position: absolute;
    top: 60px;
    right: 10px;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    padding: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 200px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.weather-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.weather-icon {
    font-size: 24px;
}

.weather-temp {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
}

.weather-details {
    font-size: 12px;
    color: #666;
}

.weather-wind {
    margin-bottom: 4px;
}

.weather-wind .label {
    font-weight: 600;
}

/* Route Info */
.eagents-nautical-route-info {
    position: absolute;
    top: 70px;
    left: 10px;
    z-index: 1000;
    max-width: 250px;
    background: rgba(255, 255, 255, 0.95);
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    color: #2c3e50;
    border-left: 3px solid #3498db;
    backdrop-filter: blur(5px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* User Location Marker */
.user-location-marker {
    background: transparent;
    border: none;
}

.user-location-dot {
    width: 20px;
    height: 20px;
    background: #3498db;
    border: 3px solid white;
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(52, 152, 219, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(52, 152, 219, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(52, 152, 219, 0);
    }
}

/* Homeport Marker */
.homeport-marker {
    background: transparent;
    border: none;
    font-size: 30px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

/* User Marker */
.user-marker {
    background: transparent;
    border: none;
    font-size: 25px;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.5);
}

/* Route Markers */
.route-marker {
    background: transparent;
    border: none;
    font-size: 20px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}

/* Modal Styles */
.eagents-nautical-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 8px;
    max-width: 500px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #dee2e6;
    background: #f8f9fa;
    border-radius: 8px 8px 0 0;
}

.modal-header h3 {
    margin: 0;
    font-size: 18px;
    color: #2c3e50;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #6c757d;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: #e9ecef;
    color: #495057;
}

.modal-body {
    padding: 20px;
}

/* Form Styles */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #2c3e50;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.route-info {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 4px;
    margin: 16px 0;
}

.info-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 14px;
}

.info-row:last-child {
    margin-bottom: 0;
}

.info-row .label {
    font-weight: 600;
    color: #495057;
}

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #dee2e6;
}

/* Routes List */
.routes-list {
    max-height: 400px;
    overflow-y: auto;
}

.route-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    margin-bottom: 8px;
    background: #f8f9fa;
    transition: all 0.2s ease;
}

.route-item:hover {
    background: #e9ecef;
    border-color: #007bff;
}

.route-info-item {
    flex: 1;
}

.route-name {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 4px;
}

.route-details {
    font-size: 12px;
    color: #6c757d;
}

.route-actions {
    display: flex;
    gap: 6px;
}

.btn-sm {
    padding: 4px 8px;
    font-size: 12px;
}

/* Custom Map Controls */
.leaflet-control-custom {
    background: white;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    padding: 8px;
    margin: 10px;
}

/* Leaflet Overrides */
.leaflet-control-layers {
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(5px);
    border-radius: 8px !important;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1) !important;
}

.leaflet-control-layers-expanded {
    padding: 10px !important;
}

.leaflet-control-layers-list {
    max-height: 300px;
    overflow-y: auto;
}

.leaflet-control-zoom {
    border-radius: 8px !important;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1) !important;
}

.leaflet-control-zoom a {
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(5px);
    color: #2c3e50 !important;
    font-weight: bold;
}

.leaflet-control-zoom a:hover {
    background: rgba(255, 255, 255, 1) !important;
}

/* Popup Styles */
.leaflet-popup-content-wrapper {
    border-radius: 8px !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15) !important;
}

.leaflet-popup-content {
    font-size: 12px !important;
    line-height: 1.4 !important;
    color: #2c3e50 !important;
}

.leaflet-popup-tip {
    box-shadow: 0 2px 10px rgba(0,0,0,0.1) !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .eagents-nautical-container {
        height: 400px;
        border-radius: 0;
        border: none;
        margin: 0;
    }
    
    /* Make layer control smaller and less intrusive on mobile */
    .leaflet-control-layers {
        background: rgba(255, 255, 255, 0.9) !important;
        border-radius: 4px !important;
        box-shadow: 0 1px 5px rgba(0,0,0,0.2) !important;
        font-size: 12px !important;
    }
    
    .leaflet-control-layers-toggle {
        width: 30px !important;
        height: 30px !important;
        background-size: 16px 16px !important;
    }
    
    .leaflet-control-layers-expanded {
        padding: 6px 8px !important;
        max-width: 200px !important;
        max-height: 250px !important;
        overflow-y: auto !important;
    }
    
    .leaflet-control-layers label {
        font-size: 11px !important;
        margin-bottom: 2px !important;
    }
    
    /* Show mobile toggle button */
    .mobile-controls-toggle {
        display: flex;
    }
    
    .eagents-nautical-controls {
        position: fixed;
        top: 60px;
        left: 10px;
        right: 10px;
        max-width: none;
        padding: 15px;
        font-size: 14px;
        transform: translateY(-100vh);
        transition: transform 0.3s ease;
        max-height: 70vh;
        overflow-y: auto;
        z-index: 1002;
        border-radius: 8px;
    }
    
    .eagents-nautical-controls.show {
        transform: translateY(0);
    }
    
    .control-group,
    .info-group {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .btn {
        flex: 1;
        justify-content: center;
        min-width: 120px;
        padding: 12px 16px;
        font-size: 14px;
    }
    
    .info-item {
        flex: 1;
        justify-content: center;
        text-align: center;
        padding: 10px 12px;
        font-size: 13px;
    }
    
    .eagents-nautical-location-info,
    .eagents-nautical-speed-info {
        left: 5px;
        right: 5px;
        max-width: none;
    }
    
    .eagents-nautical-speed-info {
        bottom: 5px;
    }
    
    .eagents-nautical-location-info {
        bottom: 55px;
    }
    
    .eagents-nautical-weather {
        top: 5px;
        left: 5px;
        right: 60px;
        max-width: none;
    }
    
    .eagents-nautical-route-info {
        top: 60px;
        left: 5px;
        right: 5px;
        max-width: none;
    }
    
    .speed-display {
        justify-content: center;
        gap: 15px;
    }
    
    .weather-display {
        justify-content: center;
        gap: 8px;
    }
    
    .modal-content {
        margin: 10px;
        max-width: none;
        width: calc(100% - 20px);
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
    }
    
    .route-item {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .route-actions {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .eagents-nautical-container {
        height: 350px;
    }
    
    .btn {
        padding: 10px 14px;
        font-size: 13px;
        min-width: 100px;
    }
    
    .btn .text {
        display: none;
    }
    
    .btn .icon {
        font-size: 16px;
    }
    
    .info-item {
        font-size: 12px;
        padding: 8px 10px;
    }
    
    .eagents-nautical-weather {
        padding: 8px;
        font-size: 12px;
    }
    
    .weather-temp {
        font-size: 16px;
    }
    
    .modal-body {
        padding: 15px;
    }
    
    .user-location-dot {
        width: 16px;
        height: 16px;
    }
    
    .homeport-marker {
        font-size: 24px;
    }
    
    .user-marker {
        font-size: 20px;
    }
    
    .route-marker {
        font-size: 16px;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    .btn {
        min-height: 44px;
        padding: 10px 16px;
    }
    
    .modal-close {
        min-width: 44px;
        min-height: 44px;
    }
    
    .leaflet-control-zoom a {
        width: 44px;
        height: 44px;
        line-height: 44px;
    }
    
    .leaflet-popup-close-button {
        width: 44px;
        height: 44px;
    }
}

/* Loading States */
.loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 1000;
}

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

/* Error States */
.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 10px 12px;
    border-radius: 4px;
    border: 1px solid #f5c6cb;
    margin: 10px 0;
}

.success-message {
    background: #d4edda;
    color: #155724;
    padding: 10px 12px;
    border-radius: 4px;
    border: 1px solid #c3e6cb;
    margin: 10px 0;
}

/* Hidden class */
.hidden {
    display: none !important;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .eagents-nautical-container {
        border: 2px solid #000;
    }
    
    .btn {
        border: 2px solid currentColor;
    }
    
    .eagents-nautical-weather {
        border: 2px solid #000;
        background: #fff;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .btn,
    .modal-close,
    .route-item,
    .form-group input,
    .form-group select,
    .form-group textarea {
        transition: none;
    }
    
    .loading::after {
        animation: none;
    }
    
    .user-location-dot {
        animation: none;
    }
}

/* Print Styles */
@media print {
    .eagents-nautical-controls,
    .eagents-nautical-weather,
    .eagents-nautical-modal,
    .mobile-controls-toggle {
        display: none !important;
    }
    
    .eagents-nautical-map {
        border: 1px solid #000;
    }
}