/* Viska Connect - Agricultural Farm Management UI
   Professional earthy farming theme inspired by leading ag software
   Color research: Organic Farm, Farm Field, Green Agriculture palettes */

/* ===== CSS VARIABLES ===== */
:root {
    /* Primary Green Palette - Earthy Agriculture tones
       Inspired by Organic Farm and Farm Field palettes */
    --primary-900: #1D4F06;  /* Lincoln Green - deep forest */
    --primary-800: #2B601E;  /* Mughal Green - rich green */
    --primary-700: var(--secondary-color);  /* Forest green */
    --primary-600: var(--primary-color);  /* Avocado - main brand green */
    --primary-500: #5A9A1B;  /* Fresh crop green */
    --primary-400: #72A06A;  /* Oxley - muted sage */
    --primary-300: #9ABF8C;  /* Light sage */
    --primary-200: #C5DDB8;  /* Pale sage */
    --primary-100: #E2EFDC;  /* Very light green */
    --primary-50: #F4F9F2;   /* Off-white green */

    /* Custom Branding (can be overridden by farm settings) */
    --primary-color: #488A0F;
    --secondary-color: #2B601E;
    --accent-color: #C7A54E;

    /* Accent Colors - Farm-inspired Earth Tones */
    --accent-gradient: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    --accent-green: var(--primary-color);      /* Avocado */
    --accent-green-light: #5A9A1B;
    --accent-orange: #B5651D;     /* Autumn orange */
    --accent-orange-light: #CD853F;
    --accent-red: #A52A2A;        /* Barn red */
    --accent-cyan: #5F9EA0;       /* Cadet blue - water/irrigation */
    --accent-blue: #4682B4;       /* Steel blue - sky */
    --accent-purple: #6B5B95;     /* Muted purple */
    --accent-yellow: var(--accent-color);     /* Aztec Gold - wheat/harvest */
    --accent-brown: #725438;      /* Mud - rich soil */
    --accent-wheat: #D9BE97;      /* Golden wheat */
    --accent-soil: #8B4513;       /* Saddle brown - earth */
    --accent-taupe: #A88D66;      /* Light Taupe - natural */

    /* Background Colors - Warm, natural feel */
    --bg-primary: #FEFDFB;        /* Warm white */
    --bg-secondary: #F9F7F4;      /* Cream */
    --bg-tertiary: #F3F1ED;       /* Light taupe */
    --bg-accent: #F4F9F2;         /* Light green tint */

    /* Card and Surface Colors */
    --bg-dark: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f8fafc;
    --bg-input: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --border-focus: rgba(22, 163, 74, 0.5);

    /* Neutral Colors (used across dashboard pages) */
    --neutral-50: #f9fafb;
    --neutral-100: #f3f4f6;
    --neutral-200: #e5e7eb;
    --neutral-300: #d1d5db;
    --neutral-400: #9ca3af;
    --neutral-500: #6b7280;
    --neutral-600: #4b5563;
    --neutral-700: #374151;
    --neutral-800: #1f2937;
    --neutral-900: #111827;

    /* Surface Effects */
    --glass-bg: rgba(255, 255, 255, 0.95);
    --glass-border: #e2e8f0;
    --glass-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --card-shadow-hover: 0 10px 25px rgba(0, 0, 0, 0.1);

    /* Spacing */
    --sidebar-width: 260px;
    --header-height: 70px;
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --border-radius-lg: 16px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* ===== RESET & BASE ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-secondary);
    background-image:
        radial-gradient(ellipse at top left, rgba(72, 138, 15, 0.03) 0%, transparent 50%),
        radial-gradient(ellipse at bottom right, rgba(199, 165, 78, 0.02) 0%, transparent 50%),
        url('images/backgrounds/topographic.png');
    background-size: auto, auto, 600px;
    background-attachment: fixed;
    background-blend-mode: normal, normal, soft-light;
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ===== TYPOGRAPHY ===== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 0.5em;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.125rem; }

p { margin-bottom: 1rem; }

/* ===== LAYOUT ===== */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-card);
    border-right: 1px solid var(--border-color);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform var(--transition-normal);
    box-shadow: 2px 0 8px rgba(0, 0, 0, 0.05);
}

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

.sidebar-logo {
    width: 45px;
    height: 45px;
    border-radius: 12px;
    object-fit: contain;
    background: var(--primary-100);
    padding: 8px;
}

.sidebar-brand {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-700);
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
    overflow-y: auto;
}

.nav-section {
    padding: 0 0.75rem;
    margin-bottom: 1.5rem;
}

.nav-section-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    padding: 0 0.75rem;
    margin-bottom: 0.5rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-bottom: 2px;
}

.nav-item:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(22, 163, 74, 0.3);
}

.nav-item svg, .nav-item i {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.nav-item-badge {
    margin-left: auto;
    background: var(--accent-red);
    color: white;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}

/* ===== MAIN CONTENT ===== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

/* ===== HEADER ===== */
.header {
    height: var(--header-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 50;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.header-title {
    font-size: 1.5rem;
    font-weight: 600;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-search {
    position: relative;
}

.header-search input {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 25px;
    padding: 0.5rem 1rem 0.5rem 2.5rem;
    color: var(--text-primary);
    width: 250px;
    transition: all var(--transition-fast);
}

.header-search input:focus {
    outline: none;
    border-color: var(--border-focus);
    width: 300px;
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.5rem 1rem;
    background: var(--bg-card);
    border-radius: 25px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.user-menu:hover {
    background: var(--bg-card-hover);
}

.user-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
}

/* ===== PAGE CONTENT ===== */
.page-content {
    padding: 2rem;
}

/* ===== CARDS ===== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: all var(--transition-normal);
    box-shadow: var(--card-shadow);
}

.card:hover {
    border-color: var(--primary-300);
    box-shadow: var(--card-shadow-hover);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-title-icon {
    width: 35px;
    height: 35px;
    border-radius: 10px;
    background: var(--primary-100);
    color: var(--primary-600);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== STATS CARDS ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    transition: all var(--transition-normal);
    box-shadow: var(--card-shadow);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--card-shadow-hover);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.stat-icon.green { background: var(--primary-100); color: var(--primary-600); }
.stat-icon.blue { background: #dbeafe; color: var(--accent-blue); }
.stat-icon.orange { background: #ffedd5; color: var(--accent-orange); }
.stat-icon.purple { background: #ede9fe; color: var(--accent-purple); }

.stat-content h3 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.stat-content p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin: 0;
}

.stat-trend {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 4px;
    margin-top: 0.5rem;
    display: inline-block;
}

.stat-trend.up { background: rgba(16, 185, 129, 0.2); color: var(--accent-green); }
.stat-trend.down { background: rgba(239, 68, 68, 0.2); color: var(--accent-red); }

/* ===== FORMS ===== */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-size: 0.9375rem;
    transition: all var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary-400);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
    padding-right: 2.5rem;
}

.form-select option {
    background: var(--primary-800);
    color: var(--text-primary);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0.75rem 1.5rem;
    font-size: 0.9375rem;
    font-weight: 500;
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(22, 163, 74, 0.25);
}

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

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-secondary);
    border-color: var(--primary-500);
    color: var(--primary-700);
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8125rem;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1rem;
}

.btn-icon {
    padding: 0.5rem;
    border-radius: 8px;
}

/* ===== TABLES ===== */
.table-container {
    overflow-x: auto;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table th {
    background: var(--bg-tertiary);
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.table tr:hover td {
    background: var(--bg-card-hover);
}

.table tr:last-child td {
    border-bottom: none;
}

/* ===== STATUS BADGES ===== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.badge-success {
    background: var(--primary-100);
    color: var(--primary-700);
}

.badge-warning {
    background: #fef3c7;
    color: #b45309;
}

.badge-danger {
    background: #fee2e2;
    color: #dc2626;
}

.badge-info {
    background: #cffafe;
    color: #0891b2;
}

.badge-neutral {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-badge.status-online {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.status-badge.status-offline {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.status-badge.status-warning {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

/* ===== TABS ===== */
.tabs {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    margin-bottom: 1.5rem;
    overflow-x: auto;
}

.tab {
    padding: 0.75rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.tab:hover {
    color: var(--text-primary);
    background: var(--bg-card);
}

.tab.active, .active-tab {
    color: white;
    background: var(--accent-gradient);
    box-shadow: 0 2px 8px rgba(22, 163, 74, 0.25);
}

/* ===== MAP CONTAINER ===== */
#map {
    height: 500px !important;
    min-height: 450px !important;
    width: 100% !important;
    border-radius: var(--border-radius);
    overflow: hidden;
    border: 1px solid var(--border-color);
    background: var(--bg-card);
}

/* ===== CHECKBOXES & TOGGLES ===== */
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0.5rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.checkbox-item:hover {
    border-color: var(--primary-400);
}

.checkbox-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-400);
}

/* ===== GRID LAYOUTS ===== */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.grid-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.25rem;
    transition: all var(--transition-normal);
}

.grid-item:hover {
    border-color: var(--primary-400);
    transform: translateY(-2px);
}

/* ===== ALERTS ===== */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--border-radius-sm);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-success {
    background: var(--primary-50);
    border: 1px solid var(--primary-200);
    color: var(--primary-800);
}

.alert-warning {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
}

.alert-danger {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.alert-info {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
}

/* ===== LOADING STATES ===== */
.skeleton {
    background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--border-radius-sm);
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-400);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== LEGACY SUPPORT ===== */
/* Support for existing tab-based navigation */
#tabContainer {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 1rem 2rem;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    margin-top: 0;
}

.content {
    padding: 2rem;
    display: none;
}

.content.active {
    display: block;
}

/* Legacy header support */
.header-container {
    display: flex;
    align-items: center;
    padding: 1rem 2rem;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    gap: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.header-container h1 {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
    color: var(--primary-700);
}

.logo-container {
    flex-shrink: 0;
}

.logo {
    height: 50px;
    width: auto;
}

/* Legacy form elements */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-size: 0.9375rem;
    transition: all var(--transition-fast);
    margin-bottom: 0.75rem;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary-400);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
    padding-right: 2.5rem;
}

select option {
    background: var(--bg-card);
    color: var(--text-primary);
}

button, .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0.75rem 1.5rem;
    font-size: 0.9375rem;
    font-weight: 500;
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 0 4px 15px rgba(22, 163, 74, 0.25);
}

button:hover, .button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(22, 163, 74, 0.35);
}

/* Legacy table styling */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1rem;
}

table th {
    background: var(--bg-tertiary);
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

table tr:hover td {
    background: var(--bg-card-hover);
}

/* Legacy fieldset */
fieldset {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

legend {
    padding: 0 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .header {
        padding: 0 1rem;
    }

    .page-content {
        padding: 1rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    #tabContainer {
        padding: 0.75rem 1rem;
    }

    .tab {
        padding: 0.5rem 0.75rem;
        font-size: 0.8125rem;
    }
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.3s ease forwards;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

.slide-in {
    animation: slideIn 0.3s ease forwards;
}

/* ===== UTILITY CLASSES ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--accent-green); }
.text-danger { color: var(--accent-red); }
.text-warning { color: var(--accent-orange); }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }

/* ===== LEAFLET MAP CUSTOMIZATIONS ===== */
.drone-marker-icon {
    background: transparent;
    border: none;
}

.polygon-tooltip {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.875rem;
    padding: 6px 10px;
    box-shadow: var(--card-shadow);
}

.polygon-tooltip::before {
    border-top-color: var(--bg-card) !important;
}

/* Leaflet popup styling */
.leaflet-popup-content-wrapper {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    box-shadow: var(--card-shadow-hover);
}

.leaflet-popup-content {
    margin: 12px 14px;
    font-size: 0.875rem;
}

.leaflet-popup-tip {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
}

.leaflet-popup-close-button {
    color: var(--text-secondary) !important;
}

.leaflet-popup-close-button:hover {
    color: var(--text-primary) !important;
}

/* Leaflet control styling */
.leaflet-control-zoom a {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color) !important;
}

.leaflet-control-zoom a:hover {
    background: var(--bg-tertiary) !important;
}

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

/* ===== NAVBAR ===== */
.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    height: 64px;
    background: linear-gradient(180deg, #ffffff 0%, #fefefe 100%);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06), 0 0 0 1px rgba(0, 0, 0, 0.02);
    overflow: visible;
}

.navbar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-900) 0%, var(--primary-color) 50%, var(--accent-color) 100%);
}

.nav-brand {
    display: flex;
    align-items: center;
}

.logo-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--text-primary);
}

.nav-logo {
    width: 32px;
    height: 32px;
    color: var(--primary-600);
}

.nav-logo-img {
    height: 40px;
    width: auto;
    object-fit: contain;
}

.landing-logo-img {
    height: 64px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 0 20px rgba(22, 163, 74, 0.2));
}

.logo-link span {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-700);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.875rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: 500;
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-fast);
    position: relative;
    white-space: nowrap;
}

.nav-link:hover {
    color: var(--primary-800);
    background: var(--primary-50);
}

.nav-link.active {
    color: white;
    background: var(--accent-gradient);
    box-shadow: 0 2px 10px rgba(43, 96, 30, 0.3);
    font-weight: 600;
}

.nav-link svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.8;
}

.nav-link.active svg {
    opacity: 1;
}

.nav-link .nav-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.7;
}

.nav-link:hover .nav-icon,
.nav-link.active .nav-icon {
    opacity: 1;
}

.nav-link .nav-icon-img {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.7;
    vertical-align: middle;
    margin-right: 0.5rem;
}

.nav-link:hover .nav-icon-img,
.nav-link.active .nav-icon-img {
    opacity: 1;
}

/* ===== MAIN CONTAINER ===== */
.main-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

/* ===== PAGE HEADER ===== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.header-content h1 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.75rem;
    margin-bottom: 0.25rem;
}

.header-content h1 svg {
    color: var(--primary-600);
}

.header-subtitle {
    color: var(--text-secondary);
    font-size: 0.9375rem;
    margin: 0;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.select-modern {
    min-width: 220px;
    padding: 0.75rem 2.5rem 0.75rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-primary);
    font-size: 0.9375rem;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
    transition: all var(--transition-fast);
}

.select-modern:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.15);
}

/* ===== TABS ===== */
.tabs-container {
    margin-bottom: 1.5rem;
}

.tabs {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem;
    background: var(--bg-card);
    border-radius: var(--border-radius);
    overflow-x: auto;
}

.tab-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    font-family: inherit;
}

.tab-btn:hover {
    color: var(--text-primary);
    background: var(--bg-card-hover);
}

.tab-btn.active {
    color: white;
    background: var(--accent-gradient);
}

.tab-btn svg {
    width: 18px;
    height: 18px;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

/* ===== GRID LAYOUTS ===== */
.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

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

/* ===== DATA TABLE ===== */
.table-container {
    overflow-x: auto;
    border-radius: var(--border-radius);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background: var(--bg-tertiary);
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.data-table tr:hover td {
    background: var(--bg-card-hover);
}

/* ===== ANALYSIS OPTIONS GRID ===== */
.analysis-options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

/* ===== WAYPOINTS CONTAINER ===== */
.waypoints-container {
    max-height: 300px;
    overflow-y: auto;
}

/* ===== CARD ENHANCEMENTS ===== */
.card-header h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    margin: 0;
}

.card-header h3 svg {
    color: var(--primary-600);
}

.card-body {
    padding: 1.25rem;
}

/* Ensure map containers inside cards display properly */
.card-body .map-container {
    height: 450px;
    min-height: 400px;
}

.card-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
}

/* ===== BUTTONS ===== */
.btn-lg {
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
}

/* ===== MAP CONTAINER ===== */
.map-container {
    width: 100%;
    border-radius: var(--border-radius);
    overflow: hidden;
    border: 1px solid var(--border-color);
}

/* ===== SUBSCRIPTION BADGES ===== */
.subscription-display {
    text-align: center;
    padding: 1rem;
}

.subscription-badge {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    font-weight: 600;
}

.subscription-badge.none {
    background: rgba(100, 116, 139, 0.2);
    color: var(--text-muted);
}

.subscription-badge.bronze {
    background: linear-gradient(135deg, #cd7f32, #b87333);
    color: white;
}

.subscription-badge.silver {
    background: linear-gradient(135deg, #c0c0c0, #a8a8a8);
    color: #333;
}

.subscription-badge.gold {
    background: linear-gradient(135deg, #ffd700, #daa520);
    color: #333;
}

.tier-name {
    font-size: 1rem;
}

/* ===== CUSTOMER INFO ===== */
.customer-info-container {
    padding: 1rem;
}

.customer-info-container .info-item {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

.customer-info-container .info-item:last-child {
    border-bottom: none;
}

.customer-info-container .info-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.customer-info-container .info-value {
    color: var(--text-primary);
    font-weight: 500;
}

/* ===== UTILITY CLASSES ===== */
.text-center {
    text-align: center;
}

.mt-3 {
    margin-top: 1rem;
}

/* ===== ENHANCED DASHBOARD COMPONENTS ===== */

/* Stat cards with colored left border accent */
.stat-card {
    background: white;
    border-radius: var(--border-radius-lg);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--card-shadow);
    transition: all var(--transition-normal);
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--accent-gradient);
    border-radius: 4px 0 0 4px;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--card-shadow-hover);
}

.stat-card.accent-gold::before {
    background: var(--accent-color);
}

.stat-card.accent-blue::before {
    background: var(--accent-cyan);
}

.stat-card.accent-red::before {
    background: var(--accent-red);
}

.stat-card.accent-brown::before {
    background: var(--accent-brown);
}

/* Dashboard grid layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.dashboard-grid-2 {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

.dashboard-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

/* Stats row */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

/* Section headers */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.section-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-title .section-icon {
    width: 24px;
    height: 24px;
    opacity: 0.8;
}

/* Empty state */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    text-align: center;
}

.empty-state img {
    width: 180px;
    height: auto;
    margin-bottom: 1.5rem;
    opacity: 0.9;
}

.empty-state h3 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--text-muted);
    max-width: 320px;
}

/* Weather widget */
.weather-widget {
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-blue));
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    color: white;
    position: relative;
    overflow: hidden;
}

.weather-widget::after {
    content: '';
    position: absolute;
    top: -20px;
    right: -20px;
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.weather-icon {
    width: 48px;
    height: 48px;
}

/* Machine status badge */
.machine-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.machine-badge.active {
    background: rgba(72, 138, 15, 0.12);
    color: var(--primary-color);
}

.machine-badge.idle {
    background: rgba(199, 165, 78, 0.12);
    color: var(--accent-color);
}

.machine-badge.offline {
    background: rgba(148, 163, 184, 0.12);
    color: var(--text-muted);
}

.machine-badge.error {
    background: rgba(165, 42, 42, 0.12);
    color: var(--accent-red);
}

.machine-badge-icon {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.machine-badge.active .machine-badge-icon { background: var(--primary-color); }
.machine-badge.idle .machine-badge-icon { background: var(--accent-color); }
.machine-badge.offline .machine-badge-icon { background: var(--text-muted); }
.machine-badge.error .machine-badge-icon { background: var(--accent-red); }

/* Professional button styles */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    box-shadow: 0 2px 4px rgba(43, 96, 30, 0.2);
}

.btn-primary:hover {
    box-shadow: 0 4px 12px rgba(43, 96, 30, 0.35);
    transform: translateY(-1px);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    background: white;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.btn-secondary:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: var(--primary-50);
}

/* Activity item */
.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.875rem 0;
    border-bottom: 1px solid var(--bg-tertiary);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-top: 6px;
    flex-shrink: 0;
}

.activity-dot.green { background: var(--primary-color); }
.activity-dot.gold { background: var(--accent-color); }
.activity-dot.blue { background: var(--accent-cyan); }
.activity-dot.red { background: var(--accent-red); }

.activity-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.activity-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Quick action cards */
.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
}

.quick-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1.25rem 0.75rem;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    text-align: center;
}

.quick-action:hover {
    border-color: var(--primary-color);
    background: var(--primary-50);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.quick-action img {
    width: 32px;
    height: 32px;
    opacity: 0.85;
}

.quick-action span {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* ===== NAVBAR DROPDOWN MENUS ===== */
.nav-dropdown {
    position: relative;
}

.nav-dropdown-trigger {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.875rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: 500;
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-fast);
    cursor: pointer;
    white-space: nowrap;
    background: none;
    border: none;
    font-family: inherit;
}

.nav-dropdown-trigger:hover {
    color: var(--primary-800);
    background: var(--primary-50);
}

.nav-dropdown-trigger.active,
.nav-dropdown.has-active-child .nav-dropdown-trigger {
    color: white;
    background: var(--accent-gradient);
    box-shadow: 0 2px 10px rgba(43, 96, 30, 0.3);
    font-weight: 600;
}

.nav-dropdown-trigger .nav-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.7;
}

.nav-dropdown-trigger:hover .nav-icon,
.nav-dropdown-trigger.active .nav-icon,
.nav-dropdown.has-active-child .nav-dropdown-trigger .nav-icon {
    opacity: 1;
}

.nav-dropdown-arrow {
    width: 12px;
    height: 12px;
    transition: transform var(--transition-fast);
    margin-left: 2px;
}

.nav-dropdown:hover .nav-dropdown-arrow {
    transform: rotate(180deg);
}

.nav-dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%);
    min-width: 200px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transition: all 0.15s ease;
    z-index: 1001;
    padding: 0.5rem;
}

.nav-dropdown:hover .nav-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.nav-dropdown-menu::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid var(--border-color);
}

.nav-dropdown-menu::after {
    content: '';
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid white;
}

.nav-dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.875rem;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: 500;
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.nav-dropdown-item:hover {
    background: var(--primary-50);
    color: var(--primary-800);
}

.nav-dropdown-item.active {
    background: var(--primary-100);
    color: var(--primary-700);
    font-weight: 600;
}

.nav-dropdown-item .nav-icon {
    width: 16px;
    height: 16px;
    opacity: 0.7;
    flex-shrink: 0;
}

.nav-dropdown-item:hover .nav-icon,
.nav-dropdown-item.active .nav-icon {
    opacity: 1;
}

.nav-dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0.375rem 0;
}

/* Language Selector */
.nav-language-selector {
    position: relative;
    margin-left: 0.5rem;
}

.nav-lang-trigger {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.75rem;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.875rem;
    transition: all var(--transition-fast);
}

.nav-lang-trigger:hover {
    background: var(--primary-50);
    border-color: var(--primary-200);
    color: var(--primary-700);
}

.nav-lang-trigger .nav-icon {
    width: 18px;
    height: 18px;
}

.nav-lang-trigger .lang-flag {
    font-size: 1rem;
}

.nav-lang-menu {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    min-width: 140px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.15s ease;
    z-index: 1000;
    padding: 0.375rem;
}

.nav-lang-menu.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.nav-lang-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: transparent;
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-align: left;
    transition: all var(--transition-fast);
}

.nav-lang-option:hover {
    background: var(--primary-50);
    color: var(--primary-700);
}

.nav-lang-option.active {
    background: var(--primary-100);
    color: var(--primary-700);
    font-weight: 600;
}

.nav-lang-option .lang-flag {
    font-size: 1.125rem;
}

/* Staff-only simplified navbar */
.navbar.staff-navbar .nav-links {
    gap: 0.75rem;
}

.navbar.staff-navbar .nav-link {
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
}

/* Mobile menu toggle button */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    border-radius: var(--border-radius-sm);
    transition: all var(--transition-fast);
}

.mobile-menu-toggle:hover {
    background: var(--primary-50);
    color: var(--primary-700);
}

.mobile-menu-toggle.active {
    background: var(--primary-100);
    color: var(--primary-700);
}

/* ===== RESPONSIVE NAVBAR ===== */
@media (max-width: 1200px) {
    .nav-link span:not(.nav-icon),
    .nav-dropdown-trigger span:not(.nav-icon):not(.nav-dropdown-arrow) {
        display: none;
    }

    .nav-link,
    .nav-dropdown-trigger {
        padding: 0.5rem 0.625rem;
    }

    .nav-dropdown-arrow {
        display: none;
    }
}

@media (max-width: 768px) {
    .navbar {
        padding: 0 1rem;
        height: 60px;
    }

    .mobile-menu-toggle {
        display: flex;
        margin-left: auto;
    }

    .nav-links {
        display: none;
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        bottom: 0;
        background: white;
        flex-direction: column;
        padding: 1rem;
        overflow-y: auto;
        z-index: 999;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    }

    .nav-links.mobile-open {
        display: flex;
    }

    .nav-link,
    .nav-dropdown-trigger {
        padding: 0.875rem 1rem;
        border-radius: var(--border-radius-sm);
        width: 100%;
        justify-content: flex-start;
    }

    .nav-link span:not(.nav-icon),
    .nav-dropdown-trigger span:not(.nav-icon):not(.nav-dropdown-arrow) {
        display: inline;
    }

    .nav-dropdown {
        width: 100%;
    }

    .nav-dropdown-arrow {
        display: block;
        margin-left: auto;
    }

    .nav-dropdown-menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        border: none;
        background: var(--neutral-50);
        margin-top: 0.25rem;
        padding: 0.25rem;
        border-radius: var(--border-radius-sm);
        display: none;
    }

    .nav-dropdown.mobile-expanded .nav-dropdown-menu {
        display: block;
    }

    .nav-dropdown-menu::before,
    .nav-dropdown-menu::after {
        display: none;
    }

    .nav-dropdown-item {
        padding: 0.75rem 1rem;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .header-actions {
        width: 100%;
    }

    .select-modern {
        width: 100%;
    }
}

/* ===== OFFLINE INDICATOR ===== */
.offline-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    background: var(--neutral-100);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    margin-left: 0.75rem;
}

.offline-indicator.hidden {
    display: none;
}

.offline-indicator.visible {
    display: flex;
}

/* Online state - green */
.offline-indicator.online {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.3);
    color: #059669;
}

.offline-indicator.online .offline-icon {
    color: #10b981;
}

/* Offline state - amber/warning */
.offline-indicator.offline {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.3);
    color: #b45309;
}

.offline-indicator.offline .offline-icon {
    color: #f59e0b;
}

/* Syncing state - blue with animation */
.offline-indicator.syncing {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.3);
    color: #1d4ed8;
}

.offline-indicator.syncing .offline-icon {
    color: #3b82f6;
    animation: spin 1s linear infinite;
}

.offline-icon {
    font-size: 0.875rem;
    line-height: 1;
    transition: color var(--transition-fast);
}

.offline-text {
    white-space: nowrap;
}

.sync-pending {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding-left: 0.5rem;
    border-left: 1px solid currentColor;
    opacity: 0.8;
}

.sync-count {
    font-weight: 600;
}

/* Pulse animation for offline icon when there are pending syncs */
.offline-indicator.offline .offline-icon.has-pending {
    animation: pulse-warning 2s ease-in-out infinite;
}

@keyframes pulse-warning {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Mobile responsive for offline indicator */
@media (max-width: 768px) {
    .offline-indicator {
        padding: 0.25rem 0.5rem;
    }

    .offline-text {
        display: none;
    }

    .sync-pending {
        padding-left: 0.375rem;
        font-size: 0.6875rem;
    }
}

/* ===== REAL-TIME ANALYTICS PANEL ===== */
.analytics-panel {
    position: absolute;
    top: 80px;
    right: 20px;
    width: 320px;
    max-height: calc(100vh - 120px);
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.analytics-panel.collapsed {
    max-height: 48px;
}

.analytics-panel .panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-700) 100%);
    color: var(--white);
    cursor: pointer;
}

.analytics-panel .panel-header h3 {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.analytics-panel .panel-header .toggle-icon {
    transition: transform var(--transition-fast);
}

.analytics-panel.collapsed .panel-header .toggle-icon {
    transform: rotate(180deg);
}

.analytics-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

/* Analytics Toggle Switch */
.analytics-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem;
    background: var(--neutral-50);
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
}

.analytics-toggle span {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--neutral-700);
}

.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--neutral-300);
    border-radius: 24px;
    transition: var(--transition-fast);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: var(--white);
    border-radius: 50%;
    transition: var(--transition-fast);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--primary-500);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(20px);
}

.toggle-switch input:focus + .toggle-slider {
    box-shadow: 0 0 0 2px var(--primary-200);
}

/* Analytics Stats Grid */
.analytics-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.stat-item {
    background: var(--neutral-50);
    padding: 0.75rem;
    border-radius: var(--radius-md);
    text-align: center;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--neutral-900);
    line-height: 1.2;
}

.stat-value.ndvi-low {
    color: var(--error-500);
}

.stat-value.ndvi-medium {
    color: var(--warning-500);
}

.stat-value.ndvi-high {
    color: var(--success-500);
}

.stat-label {
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--neutral-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 0.25rem;
}

/* Analytics Section Headers */
.analytics-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--neutral-600);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 1rem 0 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.analytics-section-header span:last-child {
    font-weight: 400;
    text-transform: none;
    color: var(--neutral-400);
}

/* Analytics Thumbnails */
.analytics-thumbnails {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}

.thumbnail-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--neutral-100);
    cursor: pointer;
    transition: transform var(--transition-fast);
}

.thumbnail-item:hover {
    transform: scale(1.05);
    z-index: 1;
}

.thumbnail-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thumbnail-item .thumb-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.6) 0%, transparent 50%);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.thumbnail-item:hover .thumb-overlay {
    opacity: 1;
}

.thumb-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.375rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.ndvi-badge,
.health-badge {
    font-size: 0.625rem;
    font-weight: 600;
    padding: 0.125rem 0.375rem;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.9);
}

.ndvi-badge.ndvi-low,
.health-badge.ndvi-low {
    color: var(--error-600);
    background: rgba(254, 226, 226, 0.95);
}

.ndvi-badge.ndvi-medium,
.health-badge.ndvi-medium {
    color: var(--warning-700);
    background: rgba(254, 243, 199, 0.95);
}

.ndvi-badge.ndvi-high,
.health-badge.ndvi-high {
    color: var(--success-700);
    background: rgba(209, 250, 229, 0.95);
}

.thumb-time {
    font-size: 0.5625rem;
    color: var(--white);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Analytics Alerts */
.analytics-alerts {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 200px;
    overflow-y: auto;
}

.anomaly-alert {
    display: flex;
    align-items: flex-start;
    gap: 0.625rem;
    padding: 0.625rem;
    border-radius: var(--radius-md);
    background: var(--neutral-50);
    border-left: 3px solid var(--neutral-300);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.anomaly-alert.severity-low {
    background: rgba(254, 243, 199, 0.3);
    border-left-color: var(--warning-400);
}

.anomaly-alert.severity-medium {
    background: rgba(255, 237, 213, 0.3);
    border-left-color: #f97316;
}

.anomaly-alert.severity-high {
    background: rgba(254, 226, 226, 0.3);
    border-left-color: var(--error-500);
}

.anomaly-alert.severity-critical {
    background: rgba(254, 226, 226, 0.5);
    border-left-color: #dc2626;
    animation: slideIn 0.3s ease-out, pulse-alert 2s ease-in-out infinite;
}

@keyframes pulse-alert {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.3);
    }
    50% {
        box-shadow: 0 0 0 4px rgba(220, 38, 38, 0);
    }
}

.alert-icon {
    font-size: 1rem;
    flex-shrink: 0;
}

.severity-low .alert-icon {
    color: var(--warning-500);
}

.severity-medium .alert-icon {
    color: #f97316;
}

.severity-high .alert-icon,
.severity-critical .alert-icon {
    color: var(--error-500);
}

.alert-content {
    flex: 1;
    min-width: 0;
}

.alert-type {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--neutral-800);
    margin-bottom: 0.125rem;
}

.alert-details {
    font-size: 0.6875rem;
    color: var(--neutral-600);
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.alert-time {
    font-size: 0.625rem;
    color: var(--neutral-400);
    white-space: nowrap;
}

.alert-action {
    background: none;
    border: none;
    padding: 0.25rem;
    cursor: pointer;
    color: var(--neutral-400);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.alert-action:hover {
    background: var(--neutral-200);
    color: var(--primary-600);
}

/* Map Markers for Analytics */
.anomaly-marker-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--white);
    border: 2px solid var(--error-500);
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    color: var(--error-500);
    font-size: 0.875rem;
    animation: markerPulse 2s ease-in-out infinite;
}

@keyframes markerPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
    }
}

.image-marker-icon {
    width: 20px;
    height: 20px;
    background: var(--primary-500);
    border: 2px solid var(--white);
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.image-marker-icon.analyzed {
    background: var(--success-500);
}

/* Highlight Animation */
.highlight {
    animation: highlight 1s ease-out;
}

@keyframes highlight {
    0% {
        background-color: rgba(59, 130, 246, 0.3);
    }
    100% {
        background-color: transparent;
    }
}

/* Empty State for Analytics */
.analytics-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--neutral-500);
}

.analytics-empty i {
    font-size: 2rem;
    margin-bottom: 0.75rem;
    opacity: 0.5;
}

.analytics-empty p {
    font-size: 0.8125rem;
    margin: 0;
}

/* Analytics Panel Mobile */
@media (max-width: 768px) {
    .analytics-panel {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        max-height: 50vh;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    }

    .analytics-panel.collapsed {
        max-height: 48px;
    }

    .analytics-stats {
        grid-template-columns: repeat(4, 1fr);
    }

    .analytics-thumbnails {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* ===== MAP MEASUREMENT TOOLS ===== */
.map-measure-toolbar {
    position: absolute;
    top: 10px;
    left: 50px;
    z-index: 1000;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 0.25rem;
}

.measure-toolbar-inner {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.measure-btn {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.75rem;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--neutral-600);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.measure-btn:hover {
    background: var(--neutral-100);
    color: var(--neutral-800);
}

.measure-btn.active {
    background: var(--primary-500);
    color: var(--white);
}

.measure-btn i {
    font-size: 0.875rem;
}

.measure-btn-clear {
    color: var(--neutral-400);
}

.measure-btn-clear:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error-500);
}

.measure-divider {
    width: 1px;
    height: 24px;
    background: var(--border-color);
    margin: 0 0.25rem;
}

/* Measurement Results Panel */
.measure-results-panel {
    position: absolute;
    top: 60px;
    left: 50px;
    z-index: 1000;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    min-width: 220px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-fast);
}

.measure-results-panel.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.results-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--neutral-800);
}

.results-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--neutral-400);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.results-close:hover {
    color: var(--neutral-600);
}

.results-content {
    padding: 0.75rem 1rem;
}

.result-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.5rem 0;
}

.result-item + .result-item {
    border-top: 1px solid var(--border-color);
    padding-top: 0.75rem;
    margin-top: 0.5rem;
}

.result-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--neutral-100);
    border-radius: var(--radius-md);
    color: var(--primary-500);
    flex-shrink: 0;
}

.result-distance .result-icon {
    color: #3b82f6;
}

.result-area .result-icon {
    color: #10b981;
}

.result-point .result-icon {
    color: #f59e0b;
}

.result-data {
    flex: 1;
}

.result-data + .result-data {
    margin-top: 0.5rem;
}

.result-label {
    display: block;
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--neutral-500);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.125rem;
}

.result-value {
    display: block;
    font-size: 1rem;
    font-weight: 600;
    color: var(--neutral-900);
}

.result-value.preview {
    color: var(--neutral-500);
    font-style: italic;
}

.results-footer {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border-color);
}

.results-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.5rem;
    background: var(--neutral-100);
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--neutral-600);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.results-btn:hover {
    background: var(--neutral-200);
    color: var(--neutral-800);
}

.results-btn-finish {
    background: var(--primary-500);
    color: var(--white);
}

.results-btn-finish:hover {
    background: var(--primary-600);
    color: var(--white);
}

/* Distance Labels on Map */
.distance-label {
    background: transparent;
    border: none;
}

.distance-label span {
    display: block;
    background: rgba(255, 255, 255, 0.95);
    padding: 0.125rem 0.5rem;
    border-radius: 10px;
    font-size: 0.6875rem;
    font-weight: 600;
    color: #3b82f6;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    white-space: nowrap;
}

/* Point Info Marker */
.point-info-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #f59e0b;
    font-size: 1.5rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

/* Toast Notification */
.measure-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--neutral-800);
    color: var(--white);
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 10000;
}

.measure-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .map-measure-toolbar {
        left: 10px;
        right: 10px;
        top: auto;
        bottom: 70px;
    }

    .measure-toolbar-inner {
        justify-content: center;
    }

    .measure-btn span {
        display: none;
    }

    .measure-btn {
        padding: 0.625rem;
    }

    .measure-results-panel {
        left: 10px;
        right: 10px;
        bottom: 130px;
        top: auto;
    }
}

/* ===== ANNOTATION SYSTEM ===== */
.annotation-toolbar {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 0.25rem;
}

.toolbar-inner {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 0.125rem;
}

.toolbar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--neutral-600);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.toolbar-btn:hover {
    background: var(--neutral-100);
    color: var(--neutral-800);
}

.toolbar-btn.active {
    background: var(--primary-500);
    color: var(--white);
}

.toolbar-btn-danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error-500);
}

.toolbar-divider {
    width: 1px;
    height: 24px;
    background: var(--border-color);
    margin: 0 0.375rem;
}

.category-filter {
    padding: 0.375rem 0.625rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.8125rem;
    color: var(--neutral-700);
    background: var(--white);
    cursor: pointer;
}

.category-filter:focus {
    outline: none;
    border-color: var(--primary-500);
}

/* Annotation Marker Icon */
.annotation-marker-icon {
    background: transparent;
    border: none;
}

.marker-pin {
    width: 30px;
    height: 42px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 6px;
    background: currentColor;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    color: var(--white);
}

.marker-pin i {
    transform: rotate(45deg);
    font-size: 0.75rem;
}

/* Annotation Text Label */
.annotation-text-label {
    background: transparent;
    border: none;
    white-space: nowrap;
}

.annotation-text-label span {
    display: block;
    background: rgba(255, 255, 255, 0.95);
    padding: 0.25rem 0.625rem;
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    font-weight: 500;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

/* Annotation Popup */
.annotation-popup {
    min-width: 200px;
}

.annotation-popup .popup-header {
    margin-bottom: 0.5rem;
}

.annotation-popup h4 {
    margin: 0 0 0.375rem;
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--neutral-900);
}

.annotation-popup p {
    margin: 0 0 0.75rem;
    font-size: 0.8125rem;
    color: var(--neutral-600);
    line-height: 1.5;
}

.annotation-popup .popup-photo {
    width: 100%;
    max-height: 150px;
    object-fit: cover;
    border-radius: var(--radius-md);
    margin-bottom: 0.75rem;
}

.category-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.125rem 0.5rem;
    border-radius: 20px;
    font-size: 0.6875rem;
    font-weight: 500;
    color: var(--white);
}

.popup-actions {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.popup-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    padding: 0.375rem 0.5rem;
    background: var(--neutral-100);
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    color: var(--neutral-600);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.popup-btn:hover {
    background: var(--neutral-200);
    color: var(--neutral-800);
}

.popup-btn-danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error-500);
}

.popup-meta {
    padding-top: 0.375rem;
    border-top: 1px solid var(--border-color);
}

.popup-meta small {
    font-size: 0.6875rem;
    color: var(--neutral-400);
}

/* Annotation Dialog */
.annotation-dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 1rem;
}

.annotation-dialog {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 400px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.dialog-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--neutral-900);
}

.dialog-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--neutral-400);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.dialog-close:hover {
    color: var(--neutral-600);
}

.dialog-body {
    padding: 1.25rem;
    overflow-y: auto;
}

.dialog-body .form-group {
    margin-bottom: 1rem;
}

.dialog-body .form-group:last-child {
    margin-bottom: 0;
}

.dialog-body label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--neutral-700);
    margin-bottom: 0.375rem;
}

.dialog-body input[type="text"],
.dialog-body input[type="color"],
.dialog-body select,
.dialog-body textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    color: var(--neutral-800);
    background: var(--white);
    transition: border-color var(--transition-fast);
}

.dialog-body input:focus,
.dialog-body select:focus,
.dialog-body textarea:focus {
    outline: none;
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px var(--primary-100);
}

.dialog-body input[type="color"] {
    height: 40px;
    padding: 0.25rem;
    cursor: pointer;
}

.dialog-footer {
    display: flex;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-color);
    background: var(--neutral-50);
}

.dialog-footer button {
    flex: 1;
    padding: 0.625rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-cancel {
    background: var(--white);
    border: 1px solid var(--border-color);
    color: var(--neutral-600);
}

.btn-cancel:hover {
    background: var(--neutral-100);
    color: var(--neutral-800);
}

.btn-save {
    background: var(--primary-500);
    border: none;
    color: var(--white);
}

.btn-save:hover {
    background: var(--primary-600);
}

/* Annotation Notification */
.annotation-notification {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 10001;
}

.annotation-notification.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.annotation-notification.info {
    background: var(--primary-600);
    color: var(--white);
}

.annotation-notification.success {
    background: var(--success-600);
    color: var(--white);
}

.annotation-notification.warning {
    background: var(--warning-600);
    color: var(--white);
}

.annotation-notification.error {
    background: var(--error-600);
    color: var(--white);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .annotation-toolbar {
        left: 10px;
        right: 10px;
        transform: none;
        top: auto;
        bottom: 70px;
    }

    .toolbar-inner {
        justify-content: center;
        flex-wrap: wrap;
    }

    .category-filter {
        width: 100%;
        margin-top: 0.5rem;
    }

    .annotation-dialog {
        max-width: none;
        margin: 0;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        max-height: 80vh;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
    }
}

/* ===== QUICK ACTIONS SYSTEM ===== */

/* Context Menu */
.quick-context-menu {
    position: fixed;
    z-index: 10000;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    min-width: 180px;
    overflow: hidden;
    animation: contextMenuIn 0.15s ease-out;
}

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

.context-menu-list {
    list-style: none;
    margin: 0;
    padding: 0.375rem 0;
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    color: var(--neutral-700);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.context-menu-item:hover {
    background: var(--neutral-100);
    color: var(--neutral-900);
}

.context-menu-item.danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error-600);
}

.context-menu-item i {
    width: 16px;
    text-align: center;
    color: var(--neutral-500);
}

.context-menu-item:hover i {
    color: var(--primary-500);
}

.context-menu-item.danger:hover i {
    color: var(--error-500);
}

.context-menu-item span {
    flex: 1;
}

.context-menu-item kbd {
    font-size: 0.625rem;
    padding: 0.125rem 0.375rem;
    background: var(--neutral-100);
    border-radius: var(--radius-sm);
    color: var(--neutral-500);
    font-family: inherit;
}

/* Floating Action Button */
.quick-fab {
    position: fixed;
    z-index: 9999;
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    gap: 0.75rem;
}

.quick-fab.bottom-right {
    bottom: 24px;
    right: 24px;
}

.quick-fab.bottom-left {
    bottom: 24px;
    left: 24px;
}

.quick-fab.bottom-center {
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
}

.fab-main {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--primary-500);
    color: var(--white);
    border: none;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    transition: all var(--transition-fast);
}

.fab-main:hover {
    background: var(--primary-600);
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.5);
}

.quick-fab.open .fab-main {
    transform: rotate(45deg);
    background: var(--neutral-600);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.fab-menu {
    display: none;
    flex-direction: column;
    gap: 0.5rem;
}

.quick-fab.open .fab-menu {
    display: flex;
}

.fab-action {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--white);
    border: none;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    cursor: pointer;
    white-space: nowrap;
    animation: fabActionIn 0.2s ease-out backwards;
    transition: all var(--transition-fast);
}

@keyframes fabActionIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.fab-action:hover {
    background: var(--neutral-50);
    transform: translateX(-4px);
    box-shadow: var(--shadow-lg);
}

.fab-action i {
    width: 20px;
    text-align: center;
    color: var(--primary-500);
}

.fab-action span {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--neutral-700);
}

/* Quick Search Dialog */
.quick-search-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 15vh;
    z-index: 10001;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.quick-search-overlay.visible {
    opacity: 1;
}

.quick-search-overlay.closing {
    opacity: 0;
}

.quick-search-dialog {
    background: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 600px;
    overflow: hidden;
    transform: translateY(-20px);
    transition: transform 0.2s ease;
}

.quick-search-overlay.visible .quick-search-dialog {
    transform: translateY(0);
}

.search-input-wrapper {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.search-input-wrapper i {
    color: var(--neutral-400);
    font-size: 1rem;
}

.search-input-wrapper input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1rem;
    color: var(--neutral-800);
    background: transparent;
}

.search-input-wrapper input::placeholder {
    color: var(--neutral-400);
}

.search-input-wrapper kbd {
    font-size: 0.6875rem;
    padding: 0.25rem 0.5rem;
    background: var(--neutral-100);
    border-radius: var(--radius-sm);
    color: var(--neutral-500);
}

.search-results {
    max-height: 400px;
    overflow-y: auto;
}

.search-hint {
    padding: 2rem 1.25rem;
    text-align: center;
    color: var(--neutral-500);
}

.search-hint p {
    margin: 0 0 1rem;
}

.search-shortcuts {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    font-size: 0.75rem;
}

.search-shortcuts kbd {
    font-size: 0.625rem;
    padding: 0.125rem 0.375rem;
    background: var(--neutral-100);
    border-radius: var(--radius-sm);
    margin-right: 0.25rem;
}

.search-loading {
    padding: 2rem 1.25rem;
    text-align: center;
    color: var(--neutral-500);
}

.search-section {
    padding: 0.5rem 0;
}

.search-section-title {
    padding: 0.5rem 1.25rem;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--neutral-500);
}

.search-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.search-item:hover {
    background: var(--neutral-50);
}

.search-item i {
    width: 20px;
    text-align: center;
    color: var(--neutral-400);
}

.search-item span {
    font-size: 0.875rem;
    color: var(--neutral-700);
}

/* Help Dialog */
.quick-help-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 10001;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.quick-help-overlay.visible {
    opacity: 1;
}

.quick-help-overlay.closing {
    opacity: 0;
}

.quick-help-dialog {
    background: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 500px;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(0.95);
    transition: transform 0.2s ease;
}

.quick-help-overlay.visible .quick-help-dialog {
    transform: scale(1);
}

.help-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.help-header h2 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--neutral-900);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.help-header h2 i {
    color: var(--primary-500);
}

.help-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--neutral-400);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.help-close:hover {
    color: var(--neutral-600);
}

.help-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.25rem;
}

.help-section {
    margin-bottom: 1.5rem;
}

.help-section:last-child {
    margin-bottom: 0;
}

.help-section h3 {
    margin: 0 0 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--neutral-500);
}

.shortcut-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.shortcut-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.shortcut-list li:last-child {
    border-bottom: none;
}

.shortcut-list kbd {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    background: var(--neutral-100);
    border-radius: var(--radius-sm);
    color: var(--neutral-600);
    font-family: inherit;
    font-weight: 500;
}

.shortcut-list span {
    font-size: 0.875rem;
    color: var(--neutral-700);
}

.help-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-color);
    background: var(--neutral-50);
    text-align: center;
}

.help-footer p {
    margin: 0;
    font-size: 0.8125rem;
    color: var(--neutral-600);
}

.help-footer kbd {
    font-size: 0.6875rem;
    padding: 0.125rem 0.375rem;
    background: var(--neutral-200);
    border-radius: var(--radius-sm);
    color: var(--neutral-600);
    font-family: inherit;
}

/* Quick Toast */
.quick-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--neutral-800);
    color: var(--white);
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 10002;
}

.quick-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .quick-fab {
        bottom: 80px;
        right: 16px;
    }

    .quick-fab.bottom-left {
        left: 16px;
    }

    .fab-main {
        width: 48px;
        height: 48px;
        font-size: 1rem;
    }

    .quick-search-overlay {
        padding: 0;
        align-items: flex-end;
    }

    .quick-search-dialog {
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
        max-width: none;
    }

    .quick-help-dialog {
        max-width: none;
        max-height: 90vh;
        border-radius: var(--radius-xl) var(--radius-xl) 0 0;
        margin: 0;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
    }
}

/* ===== MODAL STYLES ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal {
    background: var(--bg-card, #fff);
    border-radius: var(--border-radius-lg, 16px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: modalSlideIn 0.3s ease;
}

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

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color, #e2e8f0);
    background: var(--bg-secondary, #f9f7f4);
}

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary, #1e293b);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted, #64748b);
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.modal-close:hover {
    background: var(--neutral-100, #f3f4f6);
    color: var(--text-primary, #1e293b);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color, #e2e8f0);
    background: var(--bg-secondary, #f9f7f4);
}

/* Import tabs styling */
.import-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.import-tabs .btn {
    flex: 1;
    min-width: 120px;
}

.import-tabs .btn.active {
    background: var(--primary-color, #488A0F);
    color: white;
    border-color: var(--primary-color, #488A0F);
}

/* File upload area */
.file-upload-area {
    border: 2px dashed var(--border-color, #e2e8f0);
    border-radius: var(--border-radius, 12px);
    padding: 2rem;
    text-align: center;
    transition: all 0.3s ease;
    background: var(--bg-secondary, #f9f7f4);
}

.file-upload-area:hover,
.file-upload-area.dragover {
    border-color: var(--primary-color, #488A0F);
    background: var(--primary-50, #f4f9f2);
}

.file-upload-area svg {
    display: block;
    margin: 0 auto 1rem;
    color: var(--neutral-400, #9ca3af);
}

.file-upload-area p {
    margin-bottom: 0.75rem;
    color: var(--text-secondary, #475569);
}

/* Responsive modal */
@media (max-width: 640px) {
    .modal-overlay {
        padding: 0;
        align-items: flex-end;
    }

    .modal {
        max-width: none;
        border-radius: var(--border-radius-lg, 16px) var(--border-radius-lg, 16px) 0 0;
        max-height: 85vh;
    }

    .import-tabs .btn {
        min-width: auto;
        flex: none;
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }
}
