:root {
    --bg-dark: #070a13;
    --bg-darker: #04060d;
    --card-bg: rgba(18, 24, 41, 0.7);
    --card-border: rgba(255, 255, 255, 0.08);
    --card-glow: rgba(0, 242, 254, 0.15);
    
    --primary: #00f2fe;
    --primary-hover: #4facfe;
    --primary-gradient: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --success: #10b981;
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --text-dark: #64748b;
    
    --font-sans: 'Inter', sans-serif;
    --font-heading: 'Outfit', sans-serif;
    
    --transition-fast: 0.2s ease;
    --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --border-radius-lg: 16px;
    --border-radius-md: 8px;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-sans);
    line-height: 1.5;
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Background Glowing Circles */
.background-decor {
    position: absolute;
    border-radius: 50%;
    filter: blur(140px);
    z-index: -1;
    pointer-events: none;
}

.blur-circle-1 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(0, 242, 254, 0.18) 0%, rgba(79, 172, 254, 0) 70%);
    top: 10%;
    right: 5%;
}

.blur-circle-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(79, 172, 254, 0.15) 0%, rgba(0, 242, 254, 0) 70%);
    bottom: 10%;
    left: -5%;
}

/* Header */
header {
    border-bottom: 1px solid var(--card-border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    background-color: rgba(4, 6, 13, 0.6);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.25rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    width: 2rem;
    height: 2rem;
    color: var(--primary);
    filter: drop-shadow(0 0 8px rgba(0, 242, 254, 0.5));
}

.logo-text {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 1.5rem;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #ffffff 40%, var(--text-muted) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-text span {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.badge {
    background: rgba(0, 242, 254, 0.08);
    border: 1px solid rgba(0, 242, 254, 0.2);
    color: var(--primary);
    padding: 0.35rem 0.85rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

/* Main Container */
.container {
    flex: 1;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2.5rem 2rem;
}

/* Upload Section */
.upload-section {
    width: 100%;
    margin-bottom: 2rem;
}

.drop-zone {
    border: 2px dashed rgba(255, 255, 255, 0.15);
    background-color: var(--card-bg);
    border-radius: var(--border-radius-lg);
    padding: 4rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

.drop-zone:hover, .drop-zone.dragover {
    border-color: var(--primary);
    background-color: rgba(18, 24, 41, 0.85);
    box-shadow: 0 8px 32px 0 rgba(0, 242, 254, 0.1),
                inset 0 0 20px rgba(0, 242, 254, 0.03);
}

.drop-zone-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
}

.icon-wrapper {
    width: 5rem;
    height: 5rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}

.drop-zone:hover .icon-wrapper, .drop-zone.dragover .icon-wrapper {
    background: rgba(0, 242, 254, 0.05);
    border-color: rgba(0, 242, 254, 0.3);
    transform: translateY(-5px);
}

.upload-icon {
    width: 2.5rem;
    height: 2.5rem;
    color: var(--text-muted);
    transition: var(--transition-smooth);
}

.drop-zone:hover .upload-icon, .drop-zone.dragover .upload-icon {
    color: var(--primary);
    filter: drop-shadow(0 0 8px rgba(0, 242, 254, 0.4));
}

.drop-zone h2 {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    font-weight: 600;
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
    max-width: 480px;
    margin: 0 auto;
}

/* Workspace Panels */
.workspace {
    animation: fadeIn var(--transition-smooth);
}

.hidden {
    display: none !important;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

.workspace-grid {
    display: grid;
    grid-template-columns: 1fr 1.4fr;
    gap: 2rem;
    align-items: start;
}

@media (max-width: 900px) {
    .workspace-grid {
        grid-template-columns: 1fr;
    }
}

.panel-left, .panel-right {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Glass Card */
.glass-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius-lg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.25);
    padding: 1.75rem;
    overflow: hidden;
}

.card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 1rem;
}

.card-header h3 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 600;
    flex-grow: 1;
}

.card-header i, .card-header svg {
    color: var(--primary);
    width: 1.5rem;
    height: 1.5rem;
}

.file-badge {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    color: var(--text-main);
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Image Preview */
.image-container {
    width: 100%;
    max-height: 320px;
    background: var(--bg-darker);
    border-radius: var(--border-radius-md);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--card-border);
    position: relative;
}

.image-container img {
    max-width: 100%;
    max-height: 320px;
    object-fit: contain;
}

.file-details {
    display: flex;
    justify-content: space-between;
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Metadata Display scrollable */
.metadata-scroll {
    max-height: 380px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

/* Scrollbar customization */
.metadata-scroll::-webkit-scrollbar, textarea::-webkit-scrollbar {
    width: 6px;
}
.metadata-scroll::-webkit-scrollbar-track, textarea::-webkit-scrollbar-track {
    background: transparent;
}
.metadata-scroll::-webkit-scrollbar-thumb, textarea::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}
.metadata-scroll::-webkit-scrollbar-thumb:hover, textarea::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
    text-align: center;
    gap: 0.75rem;
}

.empty-state svg {
    width: 2.5rem;
    height: 2.5rem;
    opacity: 0.4;
}

.meta-group {
    margin-bottom: 1.25rem;
}

.meta-group-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 0.5rem;
    letter-spacing: 0.5px;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.05);
    padding-bottom: 0.25rem;
}

.meta-row {
    display: flex;
    justify-content: space-between;
    padding: 0.35rem 0;
    font-size: 0.85rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.02);
}

.meta-label {
    color: var(--text-muted);
    font-family: monospace;
}

.meta-value {
    text-align: right;
    word-break: break-all;
    max-width: 60%;
    font-weight: 500;
}

/* Form and Fields */
.quick-actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.flex-grow {
    flex-grow: 1;
}

.form-group-section {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: var(--border-radius-md);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

.section-title {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.section-title svg, .section-title i {
    width: 1.15rem;
    height: 1.15rem;
    color: var(--primary);
}

.section-title-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.section-title-container .section-title {
    margin-bottom: 0;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.col-span-2 {
    grid-column: span 2;
}

.input-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-field label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
}

.input-field input {
    background: var(--bg-darker);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius-md);
    padding: 0.65rem 0.85rem;
    color: var(--text-main);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    transition: var(--transition-fast);
    width: 100%;
}

.input-field input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 10px rgba(0, 242, 254, 0.15);
}

.input-with-action {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.input-with-action input {
    flex-grow: 1;
}

.input-tip {
    font-size: 0.75rem;
    color: var(--text-dark);
    margin-top: 0.25rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.25rem;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: var(--border-radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition-smooth);
    color: #ffffff;
    text-decoration: none;
}

.btn-primary {
    background: var(--primary-gradient);
    border: none;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 242, 254, 0.35);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    color: var(--text-main);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--text-muted);
}

.btn-glow {
    background: rgba(0, 242, 254, 0.1);
    border: 1px solid rgba(0, 242, 254, 0.3);
    color: var(--primary);
}

.btn-glow:hover {
    background: var(--primary-gradient);
    color: #04060d;
    box-shadow: 0 4px 15px rgba(0, 242, 254, 0.25);
    border-color: transparent;
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger);
}

.btn-danger:hover {
    background: var(--danger);
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.2);
}

.btn-small {
    padding: 0.5rem 0.85rem;
    font-size: 0.8rem;
    border-radius: 6px;
    height: 100%;
}

.btn-large {
    padding: 1rem 2rem;
    font-size: 1.05rem;
    border-radius: var(--border-radius-md);
}

/* Map CSS */
.map-container-wrapper {
    position: relative;
    margin-top: 1rem;
    border-radius: var(--border-radius-md);
    overflow: hidden;
    border: 1px solid var(--card-border);
}

#map {
    height: 230px;
    width: 100%;
    background-color: var(--bg-darker);
    z-index: 1; /* Keep leaflet controls correctly layered */
}

/* Leaflet dark custom tiles inversion (for sleek look) */
.leaflet-tile-container {
    filter: invert(100%) hue-rotate(180deg) brightness(95%) contrast(90%);
}

.leaflet-bar {
    border: 1px solid var(--card-border) !important;
    box-shadow: none !important;
}

.leaflet-bar a {
    background-color: var(--bg-darker) !important;
    color: var(--text-main) !important;
    border-bottom: 1px solid var(--card-border) !important;
    transition: var(--transition-fast);
}

.leaflet-bar a:hover {
    background-color: rgba(255, 255, 255, 0.05) !important;
}

.map-overlay-instructions {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(4, 6, 13, 0.85);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(8px);
    padding: 0.35rem 0.75rem;
    border-radius: 50px;
    font-size: 0.75rem;
    color: var(--text-muted);
    z-index: 1000;
    pointer-events: none;
    text-align: center;
}

/* Diff / Summary Table */
.diff-table-container {
    overflow-x: auto;
    margin-bottom: 1.5rem;
}

.diff-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    text-align: left;
}

.diff-table th, .diff-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--card-border);
}

.diff-table th {
    font-family: var(--font-heading);
    color: var(--text-muted);
    font-weight: 600;
}

.diff-table td {
    word-break: break-all;
    max-width: 250px;
}

.highlight-new {
    color: var(--primary);
    font-weight: 500;
    background: rgba(0, 242, 254, 0.03);
}

.action-footer {
    display: flex;
    justify-content: flex-end;
}

.action-footer button {
    width: 100%;
}

/* History Log Styles */
.panel-full-width {
    grid-column: span 2;
}

@media (max-width: 900px) {
    .panel-full-width {
        grid-column: span 1;
    }
}

.history-card {
    padding: 1.5rem;
}

.history-table-container {
    overflow-x: auto;
    max-height: 250px;
    margin-top: 0.5rem;
}

.history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    text-align: left;
}

.history-table th, .history-table td {
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid var(--card-border);
}

.history-table th {
    font-family: var(--font-heading);
    color: var(--text-muted);
    font-weight: 600;
    position: sticky;
    top: 0;
    background: #0f1422;
    z-index: 2;
}

.history-table td {
    color: var(--text-main);
    word-break: break-word;
}

.text-center {
    text-align: center !important;
}

.text-muted {
    color: var(--text-muted) !important;
}

/* Footer */
footer {
    border-top: 1px solid var(--card-border);
    padding: 1.5rem 2rem;
    text-align: center;
    background-color: var(--bg-darker);
    font-size: 0.8rem;
    color: var(--text-dark);
    margin-top: auto;
}

/* Animations */
.animate-pulse {
    animation: pulse 2.5s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; filter: drop-shadow(0 0 4px rgba(0, 242, 254, 0.5)); }
    50% { transform: scale(1.05); opacity: 0.85; filter: drop-shadow(0 0 15px rgba(0, 242, 254, 0.8)); }
    100% { transform: scale(1); opacity: 1; filter: drop-shadow(0 0 4px rgba(0, 242, 254, 0.5)); }
}
