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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #f5f5f5;
}

.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 20px;
}

header {
    background: linear-gradient(135deg, #0f3460 0%, #16213e 100%);
    color: white;
    padding: 20px 30px;
    border-radius: 10px;
    margin-bottom: 30px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.header-content {
    display: flex;
    align-items: center;
    gap: 20px;
}

#showAllParcelsBtn {
    white-space: nowrap;
    padding: 10px 20px;
    font-size: 14px;
}

.logo {
    height: 60px;
    width: auto;
    border-radius: 5px;
}

.header-text {
    flex: 1;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 5px;
    color: #4ecca3;
}

header p {
    font-size: 1.2em;
    opacity: 0.9;
    margin: 0;
}

.main-content {
    display: flex;
    height: calc(100vh - 150px);
    position: relative;
}

.left-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px;
    background: #f5f5f5;
    overflow-y: auto;
    width: 600px;
    min-width: 400px;
    max-width: 1200px;
    flex-shrink: 0;
}

.resizer {
    width: 6px;
    background: #ddd;
    cursor: col-resize;
    flex-shrink: 0;
    transition: background 0.2s;
    position: relative;
}

.resizer:hover {
    background: #667eea;
}

.resizer:active {
    background: #5568d3;
}

.right-panel {
    position: relative;
    height: 100%;
    flex: 1;
    min-width: 0;
}

.grid-section {
    background: white;
    padding: 8px;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    min-height: 0;
    position: relative;
    z-index: 10;
}

.grid-section h2 {
    margin-bottom: 6px;
    color: #333;
    font-size: 1em;
    font-weight: 600;
}

.grid-section .ag-theme-alpine {
    flex: 1;
    min-height: 150px;
}

.map-section {
    height: 100%;
    display: flex;
    flex-direction: column;
}

#map {
    flex: 1;
    width: 100%;
    position: relative;
}

.map-footer {
    padding: 8px;
    background: rgba(0, 0, 0, 0.7);
}

.disclaimer {
    font-size: 0.85em;
    color: #ccc;
    text-align: center;
}

.map-legend {
    position: fixed;
    bottom: 80px;
    left: calc(600px + 26px);
    background: rgba(255, 255, 255, 0.98);
    padding: 10px;
    border-radius: 5px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    z-index: 999998;
    font-size: 12px;
    min-width: 180px;
}

.map-legend h4 {
    margin: 0 0 8px 0;
    font-size: 13px;
    font-weight: 600;
    border-bottom: 1px solid #ddd;
    padding-bottom: 4px;
}

.legend-item {
    display: flex;
    align-items: center;
    margin: 4px 0;
    gap: 8px;
}

.legend-color {
    width: 20px;
    height: 12px;
    border-radius: 2px;
    border: 1px solid #666;
}

.legend-marker {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid;
}

.legend-zoom {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #ddd;
    font-weight: 600;
}

.controls-panel {
    background: white;
    padding: 8px;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 100;
}

.controls-panel h3 {
    margin: 0 0 6px 0;
    font-size: 0.9em;
    font-weight: 600;
    color: #333;
}

.parcel-details-section {
    background: white;
    padding: 10px;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow-y: auto;
    flex: 1;
    min-height: 300px;
    position: relative;
    z-index: 10;
}

.parcel-details-section h3 {
    margin: 0 0 10px 0;
    font-size: 1em;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #667eea;
    padding-bottom: 6px;
}

.document-list-container {
    max-height: 150px;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    border-radius: 5px;
    padding: 8px;
    background: #f9fafb;
}

#drawingControls {
    background: white;
    padding: 12px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex !important;
    flex-direction: column;
    gap: 8px;
    position: relative;
    z-index: 200;
}

.btn {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
    z-index: 300;
}

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

.btn-primary:hover {
    background-color: #5568d3;
}

.btn-success {
    background-color: #48bb78;
    color: white;
}

.btn-success:hover {
    background-color: #38a169;
}

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

.btn-danger:hover {
    background-color: #e53e3e;
}

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

.btn-secondary:hover {
    background-color: #4a5568;
}

#parcelDetails {
    margin-top: 20px;
    padding: 20px;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

#parcelDetails h3 {
    margin-bottom: 15px;
    color: #333;
}

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

.form-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 8px;
}

.form-group label {
    font-weight: 500;
    margin-bottom: 3px;
    color: #4a5568;
    font-size: 0.85em;
}

.form-group input,
.form-group textarea,
.form-group select {
    padding: 6px 8px;
    border: 1px solid #cbd5e0;
    border-radius: 4px;
    font-size: 13px;
}

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

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.inline-toast {
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 16px;
    display: none;
    animation: fadeIn 0.3s ease-out;
}

.inline-toast.success {
    background-color: #48bb78;
    color: white;
}

.inline-toast.error {
    background-color: #f56565;
    color: white;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 0;
}

#documentList {
    margin-top: 10px;
}

.document-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 5px;
    margin-bottom: 5px;
}

.document-item a {
    color: #667eea;
    text-decoration: none;
}

.document-item a:hover {
    text-decoration: underline;
}

#selectedExitInfo {
    font-size: 0.9em;
    color: #718096;
    font-weight: normal;
}

.toast {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    padding: 16px 32px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 18px;
    z-index: 999999;
    display: none;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
    animation: slideDown 0.3s ease-out;
    pointer-events: none;
}

.toast.success {
    background-color: #48bb78;
    color: white;
}

.toast.error {
    background-color: #f56565;
    color: white;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.ag-theme-alpine {
    --ag-header-background-color: #f7fafc;
    --ag-header-foreground-color: #2d3748;
    --ag-odd-row-background-color: #f9fafb;
}
