:root {
    --primary: #3b82f6;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    height: 100vh;
    overflow: hidden;
    background: #f5f7fa;
}

.container {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 380px;
    background: white;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transition: transform 0.3s ease;
    position: relative;
}

.sidebar.collapsed {
    transform: translateX(-100%);
}

.sidebar-header {
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.sidebar-header h1 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 5px;
}

.sidebar-header p {
    font-size: 14px;
    opacity: 0.9;
}

.sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

/* Toggle Button */
.sidebar-toggle {
    position: absolute;
    top: 80px;
    left: 400px;
    z-index: 1001;
    background: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.sidebar-toggle.collapsed {
    left: 70px;
    top: 20px;
}

.sidebar-toggle:hover {
    background: #f5f7fa;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e5e7eb;
}

.tab {
    padding: 10px 15px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #6b7280;
    position: relative;
    transition: color 0.3s;
}

.tab:hover {
    color: #374151;
}

.tab.active {
    color: #667eea;
}

.tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: #667eea;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Form Styles */
.form-section {
    margin-bottom: 25px;
}

.form-section h3 {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-section h3 i {
    color: #667eea;
    font-size: 18px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #4b5563;
    margin-bottom: 6px;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s, box-shadow 0.3s;
}

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

.form-group textarea {
    resize: vertical;
    min-height: 80px;
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 13px;
}

.coordinate-input {
    display: flex;
    gap: 10px;
}

.coordinate-input input {
    flex: 1;
}

/* Buttons */
.btn {
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

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

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

.btn-secondary {
    background: #f3f4f6;
    color: #4b5563;
}

.btn-secondary:hover {
    background: #e5e7eb;
}

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

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

.btn-success {
    background: #10b981;
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-group {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.btn-group .btn {
    flex: 1;
}

/* Areas List */
.areas-list {
    margin-top: 20px;
}

.area-item {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 12px;
    transition: all 0.3s;
}

.area-item:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

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

.area-item-title {
    font-weight: 600;
    color: #1f2937;
    font-size: 15px;
}

.area-item-actions {
    display: flex;
    gap: 8px;
}

.area-item-actions button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    color: #6b7280;
    transition: color 0.3s;
}

.area-item-actions button:hover {
    color: #667eea;
}

.area-item-actions button.delete:hover {
    color: #ef4444;
}

.area-item-details {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.5;
}

.area-color-indicator {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 8px;
}

/* Map Container */
.map-container {
    flex: 1;
    position: relative;
    transition: margin-left 0.3s ease;
}

.container.sidebar-collapsed .map-container {
    margin-left: -380px;
}

#map {
    width: 100%;
    height: 100%;
}

/* Map Controls */
.map-controls {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.control-btn {
    background: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.control-btn:hover {
    background: #f5f7fa;
    transform: translateY(-2px);
}

.control-btn.active {
    background: #667eea;
    color: white;
}

/* Help text */
.help-text {
    font-size: 12px;
    color: #6b7280;
    margin-top: 5px;
    line-height: 1.4;
}

.info-box {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 15px;
    font-size: 13px;
    color: #1e40af;
}

.info-box i {
    margin-right: 8px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #9ca3af;
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 15px;
    color: #e5e7eb;
}

.empty-state p {
    font-size: 14px;
}

/* Color Picker */
.color-picker {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
}

.color-option {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.3s;
}

.color-option:hover {
    transform: scale(1.1);
}

.color-option.selected {
    border-color: #374151;
    box-shadow: 0 0 0 2px rgba(55, 65, 81, 0.2);
}

/* Drawing Tool Buttons */
.tool-buttons {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.tool-btn {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.tool-btn:hover {
    border-color: var(--primary);
    background: #f8fafc;
}

.tool-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.tool-btn i {
    font-size: 16px;
}

/* Coordinate Editor Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 0;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

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

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.modal-body {
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

.coordinate-editor {
    margin-bottom: 20px;
}

.coordinate-list {
    margin-bottom: 20px;
}

.coordinate-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 8px;
}

.coordinate-item:hover {
    background: #f3f4f6;
}

.coordinate-number {
    background: #667eea;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
}

.coordinate-inputs {
    display: flex;
    gap: 8px;
    flex: 1;
}

.coordinate-inputs input {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    font-family: 'Monaco', 'Courier New', monospace;
}

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

.coordinate-actions {
    display: flex;
    gap: 5px;
}

.coordinate-actions button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    color: #6b7280;
    border-radius: 4px;
    transition: all 0.3s;
}

.coordinate-actions button:hover {
    background: #e5e7eb;
    color: #374151;
}

.coordinate-actions button.delete:hover {
    background: #fef2f2;
    color: #dc2626;
}

.coordinate-actions button.add:hover {
    background: #f0f9ff;
    color: #0284c7;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.coordinate-info {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 15px;
    font-size: 13px;
    color: #1e40af;
}

/* Area Hover Tooltip */
.area-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    pointer-events: none;
    z-index: 1500;
    white-space: nowrap;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(4px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.area-tooltip.show {
    opacity: 1;
    transform: translateY(0);
}

.area-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.8);
}

/* Vertex Tooltip */
.vertex-tooltip {
    position: absolute;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    pointer-events: none;
    z-index: 1600;
    white-space: nowrap;
    opacity: 0;
    transform: translateY(10px) scale(0.9);
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(6px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.vertex-tooltip.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.vertex-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #667eea;
}

.vertex-tooltip .vertex-number {
    display: block;
    font-size: 11px;
    opacity: 0.9;
    margin-bottom: 2px;
}

.vertex-tooltip .vertex-coords {
    font-family: 'Monaco', 'Courier New', monospace;
    font-size: 11px;
    line-height: 1.3;
}

/* Vertex Highlight Marker */
.vertex-highlight {
    position: absolute;
    width: 12px;
    height: 12px;
    background: #667eea;
    border: 3px solid white;
    border-radius: 50%;
    pointer-events: none;
    z-index: 1550;
    opacity: 0;
    transform: scale(0.5);
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

.vertex-highlight.show {
    opacity: 1;
    transform: scale(1);
}

.vertex-highlight::before {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    border: 2px solid #667eea;
    border-radius: 50%;
    opacity: 0.6;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 0.6;
    }

    50% {
        transform: scale(1.3);
        opacity: 0.3;
    }

    100% {
        transform: scale(1);
        opacity: 0.6;
    }
}

/* Conflict Area Styling */
.conflict-area {
    fill: rgba(220, 38, 38, 0.7) !important;
    stroke: #dc2626 !important;
    stroke-width: 2px !important;
    stroke-dasharray: 5, 5;
    animation: conflictPulse 2s infinite;
}

@keyframes conflictPulse {

    0%,
    100% {
        fill-opacity: 0.7;
    }

    50% {
        fill-opacity: 0.5;
    }
}

/* Conflict Tooltip */
.conflict-tooltip {
    position: absolute;
    background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
    color: white;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    pointer-events: none;
    z-index: 1650;
    white-space: nowrap;
    opacity: 0;
    transform: translateY(10px) scale(0.9);
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(6px);
    box-shadow: 0 6px 20px rgba(220, 38, 38, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.conflict-tooltip.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.conflict-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #dc2626;
}

.conflict-tooltip .conflict-title {
    display: block;
    font-size: 11px;
    opacity: 0.9;
    margin-bottom: 3px;
}

.conflict-tooltip .conflict-areas {
    font-size: 10px;
    line-height: 1.3;
}

/* Conflict Areas Section */
.conflict-section {
    margin-top: 25px;
    border-top: 1px solid #e5e7eb;
    padding-top: 20px;
}

.conflict-section h3 {
    font-size: 16px;
    font-weight: 600;
    color: #dc2626;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.conflict-section h3 i {
    color: #dc2626;
    font-size: 18px;
}

.conflict-item {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 12px;
    transition: all 0.3s;
}

.conflict-item:hover {
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.1);
    transform: translateY(-2px);
}

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

.conflict-item-title {
    font-weight: 600;
    color: #991b1b;
    font-size: 15px;
}

.conflict-item-actions {
    display: flex;
    gap: 8px;
}

.conflict-item-actions button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
    color: #6b7280;
    transition: color 0.3s;
}

.conflict-item-actions button:hover {
    color: #dc2626;
}

.conflict-item-details {
    font-size: 12px;
    color: #7f1d1d;
    line-height: 1.5;
}

.conflict-areas-list {
    background: white;
    border-radius: 6px;
    padding: 8px;
    margin-top: 8px;
    font-size: 11px;
}

.conflict-stats {
    display: flex;
    gap: 15px;
    font-size: 12px;
    color: #7f1d1d;
    margin-top: 5px;
}

.no-conflicts {
    text-align: center;
    padding: 30px;
    color: #10b981;
}

.no-conflicts i {
    font-size: 36px;
    margin-bottom: 10px;
    color: #d1fae5;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        position: absolute;
    }

    .sidebar-toggle {
        left: auto;
        right: 20px;
    }

    .sidebar-toggle.collapsed {
        left: 20px;
        right: auto;
    }

    .modal-content {
        width: 95%;
        margin: 10px;
    }

    .coordinate-inputs {
        flex-direction: column;
    }
}
