/* Grid Map Tool - Scoped Styles */
/* All styles are prefixed with 'gmt-' to prevent conflicts */

#grid-map-tool-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
    box-sizing: border-box;
    max-width: 100%;
    margin: 0 auto;
}

#grid-map-tool-container *,
#grid-map-tool-container *::before,
#grid-map-tool-container *::after {
    box-sizing: border-box;
}

.gmt-wrapper {
    background: #f5f5f5;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.gmt-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    text-align: center;
}

.gmt-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
}

.gmt-content {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 0;
    background: white;
}

@media (max-width: 968px) {
    .gmt-content {
        grid-template-columns: 1fr;
    }
}

/* Controls Panel */
.gmt-controls {
    padding: 20px;
    background: #fafafa;
    border-right: 1px solid #e0e0e0;
    overflow-y: auto;
    max-height: 600px;
}

@media (max-width: 968px) {
    .gmt-controls {
        border-right: none;
        border-bottom: 1px solid #e0e0e0;
        max-height: none;
    }
}

.gmt-control-section {
    margin-bottom: 24px;
    padding-bottom: 24px;
    border-bottom: 1px solid #e0e0e0;
}

.gmt-control-section:last-child {
    border-bottom: none;
}

.gmt-control-section h3 {
    margin: 0 0 12px 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.gmt-help-text {
    margin: 0;
    font-size: 13px;
    color: #666;
    line-height: 1.4;
}

/* Radio Groups */
.gmt-radio-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.gmt-radio-label {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.gmt-radio-label:hover {
    border-color: #667eea;
    background: #f8f9ff;
}

.gmt-radio-label input[type="radio"] {
    margin: 0 8px 0 0;
    cursor: pointer;
}

.gmt-radio-label input[type="radio"]:checked + span {
    font-weight: 600;
    color: #667eea;
}

/* Input Groups */
.gmt-dimension-inputs {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.gmt-input-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.gmt-input-group label {
    font-size: 13px;
    font-weight: 500;
    color: #555;
}

.gmt-input-group input[type="number"] {
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.2s;
}

.gmt-input-group input[type="number"]:focus {
    outline: none;
    border-color: #667eea;
}

/* Info Box */
.gmt-info-box {
    padding: 12px;
    background: #e3f2fd;
    border-left: 4px solid #2196f3;
    border-radius: 4px;
    font-size: 14px;
}

.gmt-info-box strong {
    display: block;
    margin-bottom: 4px;
}

.gmt-info-box #cellCount {
    font-size: 18px;
    font-weight: 600;
    color: #1976d2;
}

/* Warning */
.gmt-warning {
    margin-top: 8px;
    padding: 8px;
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    border-radius: 4px;
    color: #856404;
    font-size: 13px;
    font-weight: 500;
}

/* Buttons */
.gmt-button {
    width: 100%;
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.gmt-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.gmt-button-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    margin-bottom: 8px;
}

.gmt-button-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.gmt-button-secondary {
    background: #f44336;
    color: white;
}

.gmt-button-secondary:hover:not(:disabled) {
    background: #d32f2f;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(244, 67, 54, 0.4);
}

.gmt-export-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.gmt-button-export {
    background: #4caf50;
    color: white;
}

.gmt-button-export:hover:not(:disabled) {
    background: #45a049;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

/* Map Container */
.gmt-map-container {
    position: relative;
    height: 600px;
    background: #e0e0e0;
}

#gmt-map {
    width: 100%;
    height: 100%;
}

/* Leaflet overrides within the tool */
#grid-map-tool-container .leaflet-container {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

#grid-map-tool-container .leaflet-popup-content-wrapper {
    border-radius: 8px;
}

#grid-map-tool-container .leaflet-popup-content {
    margin: 12px;
    font-size: 13px;
}

/* Ensure drawing toolbar is visible */
#grid-map-tool-container .leaflet-draw-toolbar {
    margin-top: 10px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .gmt-header h2 {
        font-size: 20px;
    }
    
    .gmt-controls {
        padding: 16px;
    }
    
    .gmt-map-container {
        height: 400px;
    }
}

