:root {
    /* Primary Colors - Enterprise Blue */
    --primary: #0066cc;
    --primary-dark: #004499;
    --primary-light: #3385ff;
    --primary-50: #eff6ff;
    --primary-lightest: #e6f3ff;
    --primary-hover: #0052cc;
    --primary-pressed: #003d99;
    
    /* Secondary Colors */
    --secondary: #64748b;
    --secondary-dark: #475569;
    --secondary-light: #94a3b8;
    --secondary-lightest: #f1f5f9;
    
    /* Success/Error States */
    --success: #10b981;
    --success-light: #d1fae5;
    --success-dark: #059669;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --warning-dark: #d97706;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --danger-dark: #dc2626;
    --info: #3b82f6;
    --info-light: #dbeafe;
    --info-dark: #2563eb;
    
    /* Neutral Colors - Professional Gray Scale */
    --white: #ffffff;
    --gray-25: #fcfcfd;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-400: #94a3b8;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --gray-900: #0f172a;
    
    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    --font-family-mono: 'SF Mono', 'Monaco', 'Cascadia Code', 'Roboto Mono', 'Consolas', monospace;
    
    /* Font Sizes - Improved Scale */
    --font-size-xs: 0.75rem;     /* 12px */
    --font-size-sm: 0.875rem;    /* 14px */
    --font-size-base: 1rem;      /* 16px */
    --font-size-lg: 1.125rem;    /* 18px */
    --font-size-xl: 1.25rem;     /* 20px */
    --font-size-2xl: 1.5rem;     /* 24px */
    --font-size-3xl: 1.875rem;   /* 30px */
    
    /* Font Weights */
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    
    /* Line Heights */
    --line-height-tight: 1.25;
    --line-height-normal: 1.5;
    --line-height-relaxed: 1.625;
    
    /* Spacing - 8px Grid System */
    --spacing-0: 0;
    --spacing-1: 0.25rem;   /* 4px */
    --spacing-2: 0.5rem;    /* 8px */
    --spacing-3: 0.75rem;   /* 12px */
    --spacing-4: 1rem;      /* 16px */
    --spacing-5: 1.25rem;   /* 20px */
    --spacing-6: 1.5rem;    /* 24px */
    --spacing-8: 2rem;      /* 32px */
    --spacing-10: 2.5rem;   /* 40px */
    --spacing-12: 3rem;     /* 48px */
    --spacing-16: 4rem;     /* 64px */
    --spacing-lg: 1.5rem;   /* 24px */
    --spacing-xl: 2rem;     /* 32px */
    
    /* Border Radius - Enhanced Scale */
    --border-radius-none: 0;
    --border-radius-sm: 0.25rem;    /* 4px */
    --border-radius: 0.375rem;      /* 6px */
    --border-radius-md: 0.5rem;     /* 8px */
    --border-radius-lg: 0.75rem;    /* 12px */
    --border-radius-xl: 1rem;       /* 16px */
    --border-radius-full: 9999px;
    
    /* Borders */
    --border-width: 1px;
    --border-width-2: 2px;
    --border-color: var(--gray-300);
    --border-color-light: var(--gray-200);
    --border-color-dark: var(--gray-400);
    
    /* Shadows - Professional Enterprise Shadows */
    --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-inner: inset 0 2px 4px 0 rgba(0, 0, 0, 0.06);
    --shadow-focus: 0 0 0 3px rgba(59, 130, 246, 0.1);
    
    /* Transitions */
    --transition-fast: 150ms ease-out;
    --transition: 200ms ease-out;
    --transition-slow: 300ms ease-out;
    --transition-all: all 200ms ease-out;
    
    /* Z-Index Scale */
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal-backdrop: 1040;
    --z-modal: 1050;
    --z-popover: 1060;
    --z-tooltip: 1070;
    --z-toast: 1080;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-family);
    background-color: var(--gray-50);
    min-height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    font-size: var(--font-size-sm);
    line-height: 1.6;
    color: var(--gray-800);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.enterprise-container {
    display: flex;
    min-height: 100vh;
    background: var(--white);
    box-shadow: var(--box-shadow-lg);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .enterprise-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        max-height: 50vh;
    }
}

/* Sidebar */
.sidebar {
    width: 280px;
    min-width: 280px;
    max-width: 280px;
    background: linear-gradient(180deg, #FFFFFF 0%, var(--gray-50) 100%);
    border-right: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    height: 100vh;
    max-height: 100vh;
    position: sticky;
    top: 0;
    transition: width 0.3s ease, min-width 0.3s ease, max-width 0.3s ease;
}

.sidebar.collapsed {
    width: 50px;
    min-width: 50px;
    max-width: 50px;
}

.sidebar.collapsed .sidebar-header,
.sidebar.collapsed .alerts-list,
.sidebar.collapsed .sidebar-footer {
    display: none;
}

.sidebar-toggle-btn {
    position: absolute;
    top: 16px;
    right: -12px;
    width: 24px;
    height: 24px;
    background: var(--primary);
    color: white;
    border: 2px solid white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    font-size: 12px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.sidebar-toggle-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.1);
}

.sidebar.collapsed .sidebar-toggle-btn i {
    transform: rotate(180deg);
}

.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--gray-200);
    background: white;
}

.sidebar-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-900);
    margin: 0 0 4px 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.sidebar-subtitle {
    font-size: 12px;
    color: var(--gray-600);
    margin: 0;
}

.filter-controls {
    margin-top: 8px;
}

.category-dropdown {
    position: relative;
    width: 100%;
}

.category-dropdown-toggle {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    background: white;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: var(--transition);
}

.category-dropdown-toggle:hover {
    border-color: var(--primary);
    background: var(--gray-50);
}

.category-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    box-shadow: var(--box-shadow);
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.category-dropdown-menu.show {
    display: block;
}

.category-actions {
    padding: 8px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    gap: 8px;
    justify-content: center;
}

.btn-small {
    padding: 4px 8px;
    font-size: 11px;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    background: white;
    cursor: pointer;
    transition: var(--transition);
}

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

.category-group {
    border-bottom: 1px solid var(--gray-100);
}

.category-group:last-child {
    border-bottom: none;
}

.group-header {
    padding: 8px;
    background: var(--gray-50);
}

.group-toggle {
    width: 100%;
    padding: 0;
    border: none;
    background: none;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--gray-700);
}

.group-toggle:hover {
    color: var(--primary);
}

.group-toggle i {
    font-size: 14px;
    color: var(--primary);
}

.group-items {
    padding: 4px 8px 8px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.group-items label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    transition: var(--transition);
}

.group-items label:hover {
    background: var(--gray-50);
}

.group-items input[type="checkbox"] {
    margin: 0;
    cursor: pointer;
}

.alerts-list {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
}

.loading-state, .empty-state {
    text-align: center;
    padding: 30px 16px;
    color: var(--gray-500);
}

.alert-item {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--border-radius);
    padding: 10px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: var(--transition);
}

.alert-item:hover {
    border-color: var(--primary);
    box-shadow: var(--box-shadow-sm);
}

.alert-item.active {
    border-color: var(--primary);
    background: var(--gray-50);
}

.alert-category {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 4px;
}

/* AlertMedia Category Colors */
.alert-category.air-quality { background: #E6F4FF; color: #0958D9; }
.alert-category.demonstrations { background: #FFF4E6; color: #D94A00; }
.alert-category.dust-fog { background: #F0F0F0; color: #595959; }
.alert-category.earthquake { background: #F0E5FF; color: #6B46C1; }
.alert-category.fire-weather { background: #FFF1E6; color: #D93900; }
.alert-category.flooding { background: #E6F7FF; color: #1677FF; }
.alert-category.hazmat { background: #FFE6FF; color: #C41D7F; }
.alert-category.health { background: #F6FFED; color: #389E0D; }
.alert-category.heat { background: #FFE6E6; color: #CF1322; }
.alert-category.landslide { background: #FFF0E6; color: #D46B08; }
.alert-category.marine { background: #E6EFFF; color: #2F54EB; }
.alert-category.outages { background: #FFF7E6; color: #D4B106; }
.alert-category.planned-events { background: #F0F5FF; color: #597EF7; }
.alert-category.severe-weather { background: #FFF0F6; color: #EB2F96; }
.alert-category.structure-fire { background: #FFE5E5; color: #CC0000; }
.alert-category.tornado { background: #FFE5F0; color: #CC0066; }
.alert-category.transportation { background: #E6FFFB; color: #13A8A8; }
.alert-category.travel { background: #F9F0FF; color: #722ED1; }
.alert-category.tropical-storm { background: #E5F3FF; color: #0066CC; }
.alert-category.tsunami { background: #E6F4FF; color: #096DD9; }
.alert-category.violence-crime { background: #FFE6E6; color: #A8071A; }
.alert-category.volcanic { background: #FFF1E6; color: #AD4E00; }
.alert-category.wildfire { background: #FFE5E5; color: #CC0000; }
.alert-category.wind { background: #E6FBFF; color: #08979C; }
.alert-category.winter-weather { background: #F0F9FF; color: #0958D9; }
.alert-category.other { background: #F0F0F0; color: #666666; }

.alert-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 2px;
    line-height: 1.3;
}

.alert-location {
    font-size: 11px;
    color: var(--gray-600);
    margin-bottom: 4px;
}

.alert-time {
    font-size: 10px;
    color: var(--gray-500);
}

.sidebar-footer {
    padding: 12px 16px;
    border-top: 1px solid var(--gray-200);
    background: white;
}

.refresh-btn {
    width: 100%;
    padding: var(--spacing-sm) var(--spacing-md);
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white);
    border: none;
    border-radius: var(--border-radius);
    font-weight: 500;
    font-size: var(--font-size-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    box-shadow: var(--box-shadow-sm);
    min-height: 40px;
}

.refresh-btn:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    transform: translateY(-1px);
    box-shadow: var(--box-shadow);
}

.alerts-info {
    font-size: 10px;
    color: var(--gray-500);
    text-align: center;
    margin-top: 6px;
}

/* Main Content Layout */
.main-content {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: var(--gray-50);
    flex: 1;
    min-width: 0;
}

.content-header {
    padding: var(--spacing-md) var(--spacing-lg);
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--box-shadow-sm);
    z-index: 100;
    flex-shrink: 0;
}

.content-title {
    font-size: var(--font-size-xl);
    font-weight: 600;
    color: var(--gray-900);
    margin: 0;
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-xs) var(--spacing-sm);
    background: var(--success-light);
    border-radius: var(--border-radius-xl);
    font-size: var(--font-size-xs);
    font-weight: 500;
    color: var(--success);
    margin-left: var(--spacing-md);
    border: 1px solid rgba(40, 167, 69, 0.2);
}

.status-badge i {
    color: var(--success);
    font-size: 8px;
}

.action-buttons {
    display: flex;
    gap: var(--spacing-sm);
    align-items: center;
}

/* === ENTERPRISE BUTTON SYSTEM === */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-2);
    padding: var(--spacing-3) var(--spacing-4);
    border: var(--border-width) solid transparent;
    border-radius: var(--border-radius);
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    line-height: var(--line-height-tight);
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition-all);
    user-select: none;
    white-space: nowrap;
    position: relative;
    min-height: 40px;
    outline: none;
}

.btn:focus-visible {
    box-shadow: var(--shadow-focus);
    outline: 2px solid transparent;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* Button Sizes */
.btn-sm {
    padding: var(--spacing-2) var(--spacing-3);
    font-size: var(--font-size-xs);
    min-height: 32px;
}

.btn-lg {
    padding: var(--spacing-4) var(--spacing-6);
    font-size: var(--font-size-base);
    min-height: 48px;
}

/* Primary Button - Enterprise Blue */
.btn-primary {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-primary:active {
    background: var(--primary-pressed);
    border-color: var(--primary-pressed);
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

/* Secondary Button - Clean & Professional */
.btn-secondary {
    background: var(--white);
    color: var(--gray-700);
    border-color: var(--border-color);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--gray-50);
    border-color: var(--gray-400);
    color: var(--gray-800);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary:active {
    background: var(--gray-100);
    transform: translateY(0);
    box-shadow: var(--shadow-xs);
}

/* Success Button */
.btn-success {
    background: var(--success);
    color: var(--white);
    border-color: var(--success);
    box-shadow: var(--shadow-sm);
}

.btn-success:hover:not(:disabled) {
    background: var(--success-dark);
    border-color: var(--success-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Warning Button */
.btn-warning {
    background: var(--warning);
    color: var(--white);
    border-color: var(--warning);
    box-shadow: var(--shadow-sm);
}

.btn-warning:hover:not(:disabled) {
    background: var(--warning-dark);
    border-color: var(--warning-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Danger Button */
.btn-danger {
    background: var(--danger);
    color: var(--white);
    border-color: var(--danger);
    box-shadow: var(--shadow-sm);
}

.btn-danger:hover:not(:disabled) {
    background: var(--danger-dark);
    border-color: var(--danger-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Info Button */
.btn-info {
    background: var(--info);
    color: var(--white);
    border-color: var(--info);
    box-shadow: var(--shadow-sm);
}

.btn-info:hover:not(:disabled) {
    background: var(--info-dark);
    border-color: var(--info-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Ghost Button */
.btn-ghost {
    background: transparent;
    color: var(--gray-600);
    border-color: transparent;
}

.btn-ghost:hover:not(:disabled) {
    background: var(--gray-100);
    color: var(--gray-700);
}

/* === ENTERPRISE FORM CONTROLS === */
.form-control {
    display: block;
    width: 100%;
    padding: var(--spacing-3) var(--spacing-4);
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-normal);
    line-height: var(--line-height-normal);
    color: var(--gray-900);
    background-color: var(--white);
    background-image: none;
    border: var(--border-width) solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-xs);
    transition: var(--transition-all);
    outline: none;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: var(--shadow-focus);
}

.form-control:disabled {
    background-color: var(--gray-100);
    color: var(--gray-500);
    cursor: not-allowed;
    opacity: 0.6;
}

.form-control::placeholder {
    color: var(--gray-400);
    opacity: 1;
}

/* Form Groups */
.form-group {
    margin-bottom: var(--spacing-4);
}

.form-label {
    display: block;
    margin-bottom: var(--spacing-2);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--gray-700);
    line-height: var(--line-height-normal);
}

.form-text {
    margin-top: var(--spacing-1);
    font-size: var(--font-size-xs);
    color: var(--gray-500);
    line-height: var(--line-height-normal);
}

/* Form Validation States */
.form-control.is-valid {
    border-color: var(--success);
    box-shadow: 0 0 0 0.2rem rgba(16, 185, 129, 0.25);
}

.form-control.is-invalid {
    border-color: var(--danger);
    box-shadow: 0 0 0 0.2rem rgba(239, 68, 68, 0.25);
}

.valid-feedback {
    display: block;
    width: 100%;
    margin-top: var(--spacing-1);
    font-size: var(--font-size-xs);
    color: var(--success);
}

.invalid-feedback {
    display: block;
    width: 100%;
    margin-top: var(--spacing-1);
    font-size: var(--font-size-xs);
    color: var(--danger);
}

/* === ENTERPRISE LOADING STATES === */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray-200);
    border-top: 2px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-spinner-sm {
    width: 16px;
    height: 16px;
    border-width: 1.5px;
}

.loading-spinner-lg {
    width: 32px;
    height: 32px;
    border-width: 3px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Button Loading State */
.btn.loading {
    pointer-events: none;
    position: relative;
    color: transparent !important;
}

.btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    color: inherit;
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-100) 50%, var(--gray-200) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--border-radius);
}

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

.skeleton-text {
    height: 1rem;
    margin: 0.5rem 0;
}

.skeleton-text.w-75 { width: 75%; }
.skeleton-text.w-50 { width: 50%; }
.skeleton-text.w-25 { width: 25%; }

/* === MICRO-INTERACTIONS === */
.hover-lift {
    transition: var(--transition-all);
}

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

.hover-scale {
    transition: var(--transition-all);
}

.hover-scale:hover {
    transform: scale(1.02);
}

.click-scale {
    transition: var(--transition-fast);
}

.click-scale:active {
    transform: scale(0.98);
}

/* Pulse Animation */
.pulse {
    animation: pulse 2s infinite;
}

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

/* Fade Animations */
.fade-in {
    animation: fadeIn 0.3s ease-out;
}

.fade-out {
    animation: fadeOut 0.3s ease-out;
}

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

@keyframes fadeOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-10px); }
}

/* Slide Animations */
.slide-in-right {
    animation: slideInRight 0.3s ease-out;
}

.slide-in-left {
    animation: slideInLeft 0.3s ease-out;
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideInLeft {
    from { transform: translateX(-100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* === ENTERPRISE NOTIFICATIONS/TOASTS === */
.toast-container {
    position: fixed;
    top: var(--spacing-4);
    right: var(--spacing-4);
    z-index: var(--z-toast);
    max-width: 400px;
    width: 100%;
}

.toast {
    background: var(--white);
    border: var(--border-width) solid var(--border-color-light);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    padding: var(--spacing-4);
    margin-bottom: var(--spacing-3);
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-3);
    animation: slideInRight 0.3s ease-out;
    transition: var(--transition-all);
}

.toast.success {
    border-left: 4px solid var(--success);
}

.toast.warning {
    border-left: 4px solid var(--warning);
}

.toast.error {
    border-left: 4px solid var(--danger);
}

.toast.info {
    border-left: 4px solid var(--info);
}

.toast-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-xs);
    color: var(--white);
}

.toast.success .toast-icon { background: var(--success); }
.toast.warning .toast-icon { background: var(--warning); }
.toast.error .toast-icon { background: var(--danger); }
.toast.info .toast-icon { background: var(--info); }

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: var(--font-weight-semibold);
    font-size: var(--font-size-sm);
    color: var(--gray-900);
    margin-bottom: var(--spacing-1);
}

.toast-message {
    font-size: var(--font-size-sm);
    color: var(--gray-600);
    line-height: var(--line-height-normal);
}

.toast-close {
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    padding: 0;
    margin-left: auto;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.toast-close:hover {
    background: var(--gray-100);
    color: var(--gray-600);
}

/* === ENTERPRISE PROGRESS INDICATORS === */
.progress {
    width: 100%;
    height: 8px;
    background: var(--gray-200);
    border-radius: var(--border-radius-full);
    overflow: hidden;
    position: relative;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: var(--border-radius-full);
    transition: width 0.6s ease;
    position: relative;
}

.progress-bar.animated::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: progress-shine 2s infinite;
}

@keyframes progress-shine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* Progress with label */
.progress-with-label {
    display: flex;
    align-items: center;
    gap: var(--spacing-3);
}

.progress-label {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--gray-700);
    white-space: nowrap;
}

/* === ENHANCED TOOLTIPS === */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip::before,
.tooltip::after {
    position: absolute;
    z-index: var(--z-tooltip);
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
}

.tooltip::before {
    content: attr(data-tooltip);
    background: var(--gray-900);
    color: var(--white);
    padding: var(--spacing-2) var(--spacing-3);
    border-radius: var(--border-radius);
    font-size: var(--font-size-xs);
    white-space: nowrap;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-4px);
}

.tooltip::after {
    content: '';
    border: 4px solid transparent;
    border-top-color: var(--gray-900);
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
}

.tooltip:hover::before,
.tooltip:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(-8px);
}

/* === MAP DRAWING TOOLBAR === */
.map-section {
    display: flex !important;
    flex-direction: column !important;
    background: var(--white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: visible;
    position: relative;
}

.map-header {
    padding: 16px !important;
    background: #f8f9fa !important;
    border-bottom: 2px solid #dee2e6 !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
    position: static;
    z-index: auto;
    display: block !important;
    width: 100% !important;
    min-height: 80px !important;
}

.map-tools {
    display: flex !important;
    gap: 8px !important;
    align-items: center !important;
    justify-content: flex-start !important;
    flex-wrap: nowrap !important;
    padding: 12px !important;
    position: static !important;
    z-index: auto !important;
    background: #f8f9fa !important;
    border: 1px solid #dee2e6 !important;
    border-radius: 8px !important;
    margin: 8px !important;
    min-height: 60px !important;
    width: calc(100% - 16px) !important;
    overflow: visible !important;
    box-sizing: border-box !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
}

.tool-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 44px !important;
    height: 44px !important;
    background: #ffffff !important;
    border: 1.5px solid #6c757d !important;
    border-radius: 6px !important;
    color: #495057 !important;
    font-size: 16px !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    margin: 0 2px !important;
    padding: 0 !important;
    box-sizing: border-box !important;
    position: static !important;
    float: none !important;
    transform: none !important;
    opacity: 1 !important;
    visibility: visible !important;
    overflow: visible !important;
    z-index: auto !important;
    min-width: 44px !important;
    min-height: 44px !important;
    transition: all 0.2s ease !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1) !important;
}

/* Force visibility even if JavaScript tries to hide */
.tool-btn[style*="display: none"] {
    display: inline-block !important;
}

.tool-btn[style*="visibility: hidden"] {
    visibility: visible !important;
}

.tool-btn:hover {
    background: #e3f2fd !important;
    border-color: #0066cc !important;
    color: #0066cc !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15) !important;
}

.tool-btn:active {
    transform: translateY(0) !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1) !important;
}

.tool-btn.active {
    background: #0066cc !important;
    border-color: #0066cc !important;
    color: #ffffff !important;
    box-shadow: 0 2px 4px rgba(0,102,204,0.3) !important;
}

.tool-btn.active:hover {
    background: #0052cc !important;
    border-color: #0052cc !important;
    transform: translateY(-1px) !important;
}

.tool-btn:focus-visible {
    box-shadow: 0 0 0 3px rgba(0,102,204,0.2) !important;
    outline: none !important;
}

.tool-btn:disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
    transform: none !important;
}

.tool-btn i {
    font-size: 16px !important;
    line-height: 1 !important;
}

/* Clean Map Toolbar */
.map-tools-organized {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: white;
    border-bottom: 1px solid var(--gray-200);
}

.map-tools-left {
    display: flex;
    gap: 4px;
    align-items: center;
}

.map-tools-right {
    display: flex;
    gap: 8px;
    align-items: center;
}

.toolbar-divider {
    width: 1px;
    height: 24px;
    background: var(--gray-200);
    margin: 0 4px;
}

/* Compact Tool Buttons */
.tool-btn-compact {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    background: white;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    color: var(--gray-700);
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.tool-btn-compact i {
    font-size: 14px;
    color: var(--gray-600);
}

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

.tool-btn-compact:hover i {
    color: var(--primary);
}

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

.tool-btn-compact.active i {
    color: white;
}

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

.tool-btn-danger:hover i {
    color: var(--danger);
}

/* Compact Toggle */
.toggle-compact {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.toggle-compact input {
    display: none;
}

.toggle-compact .toggle-slider {
    width: 32px;
    height: 18px;
    background-color: var(--gray-300);
    border-radius: 18px;
    position: relative;
    transition: background-color 0.2s ease;
}

.toggle-compact input:checked + .toggle-slider {
    background-color: var(--success);
}

.toggle-compact .toggle-knob {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.toggle-compact input:checked + .toggle-slider .toggle-knob {
    transform: translateX(14px);
}

.toggle-text {
    font-size: 11px;
    font-weight: 500;
    color: var(--gray-700);
}

/* Compact AI Button */
.ai-btn-compact {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 4px;
    color: white;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.ai-btn-compact i {
    font-size: 14px;
}

.ai-btn-compact:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.4);
}

/* Responsive */
@media (max-width: 768px) {
    .map-tools-organized {
        flex-wrap: wrap;
        gap: 8px;
    }

    .map-tools-left,
    .map-tools-right {
        flex-wrap: wrap;
    }
}

/* Map container */
.map-container {
    position: relative;
    background: var(--gray-100);
    border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg);
    overflow: hidden;
}

/* Search input in map */
#locationSearch {
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow-sm);
}

/* Content Body - Responsive Layout */
.content-body {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    padding: var(--spacing-md) var(--spacing-lg);
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
}

@media (max-width: 768px) {
    .content-body {
        padding: var(--spacing-sm) var(--spacing-md);
        gap: var(--spacing-sm);
    }
    
    .content-header {
        padding: var(--spacing-sm) var(--spacing-md);
        flex-wrap: wrap;
        gap: var(--spacing-sm);
    }
    
    .content-title {
        font-size: var(--font-size-lg);
    }
    
    .action-buttons {
        flex-wrap: wrap;
        width: 100%;
        justify-content: flex-end;
    }
    
    .btn {
        min-height: 32px;
        padding: var(--spacing-xs) var(--spacing-sm);
        font-size: var(--font-size-xs);
    }
}

/* Additional mobile optimizations */
@media (max-width: 480px) {
    .sidebar {
        min-height: 250px;
        max-height: 35vh;
    }
    
    .action-buttons {
        justify-content: stretch;
    }
    
    .action-buttons .btn {
        flex: 1;
        min-width: 0;
    }
}

/* Edit mode styling */
.tool-btn.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--white);
    box-shadow: var(--box-shadow);
    transform: translateY(-1px);
}

.tool-btn.active:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
}

/* Form Sections */
.form-section {
    background: white;
    border-radius: var(--border-radius);
    border: 1px solid var(--gray-200);
    box-shadow: var(--box-shadow-sm);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Flexible sections that expand with content */
.headline-section,
.content-section {
    flex: 0 0 auto;
    min-height: 80px;
}

/* Content/Details section can expand */
.content-section {
    position: relative;
    overflow: hidden;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
}

.content-section .section-body {
    min-height: 400px;
    height: 800px;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

/* Corner resize handle for details section */
.corner-resize-handle {
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    cursor: nwse-resize;
    background: var(--gray-300);
    border-radius: 2px;
    transition: all 0.2s;
    z-index: 100;
}

.corner-resize-handle::before,
.corner-resize-handle::after {
    content: '';
    position: absolute;
    background: white;
    border-radius: 1px;
}

.corner-resize-handle::before {
    bottom: 4px;
    left: 4px;
    right: 10px;
    height: 2px;
}

.corner-resize-handle::after {
    top: 4px;
    right: 4px;
    bottom: 10px;
    width: 2px;
}

.corner-resize-handle:hover {
    background: var(--primary);
}

.corner-resize-handle:active {
    background: var(--primary-dark);
}

/* Better resize handle */
.resize-handle {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 12px;
    background: transparent;
    cursor: ns-resize;
    z-index: 10;
}

.resize-handle::before {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: var(--gray-300);
    border-radius: 2px;
    transition: all 0.2s;
}

.resize-handle:hover::before {
    background: var(--primary);
    width: 60px;
    height: 6px;
}

/* Resize Divider between sections */
.resize-divider {
    height: 16px;
    margin: 4px 0;
    cursor: ns-resize;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    user-select: none;
}

.resize-bar {
    width: 100%;
    height: 4px;
    background: var(--gray-200);
    border-radius: 2px;
    position: relative;
    transition: all 0.2s;
    pointer-events: none;
}

.resize-bar::before {
    content: '⋮⋮⋮';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 12px;
    color: var(--gray-400);
    background: white;
    padding: 0 8px;
    font-weight: bold;
}

.resize-divider:hover .resize-bar {
    background: var(--primary);
    height: 6px;
}

.resize-divider:hover .resize-bar::before {
    color: var(--primary);
}

.section-header {
    padding: 8px 12px;
    background: linear-gradient(135deg, var(--gray-50) 0%, white 100%);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-900);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.section-icon {
    color: var(--primary);
    font-size: 12px;
}

.section-body {
    flex: 1;
    padding: 12px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Form Elements */
.form-group {
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
}

.form-label {
    display: block;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 6px;
    font-size: 12px;
}

.form-label.required::after {
    content: ' *';
    color: var(--danger);
}

.form-control, .form-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    font-size: 13px;
    background: white;
    transition: var(--transition);
}

.form-control:focus, .form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(11, 83, 148, 0.1);
}

.char-counter {
    text-align: right;
    font-size: 10px;
    color: var(--gray-500);
    margin-top: 2px;
}

/* Severity Selector */
.severity-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 8px;
}

.severity-btn {
    padding: 10px 12px;
    border: 2px solid var(--gray-300);
    border-radius: var(--border-radius);
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

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

.severity-icon {
    font-size: 24px;
    line-height: 1;
}

.severity-label {
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 0.5px;
    color: var(--gray-900);
}

.severity-btn.selected {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

.severity-low.selected {
    border-color: var(--success);
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
}

.severity-low.selected .severity-label {
    color: var(--success-dark);
}

.severity-medium.selected {
    border-color: var(--warning);
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
}

.severity-medium.selected .severity-label {
    color: var(--warning-dark);
}

.severity-high.selected {
    border-color: var(--danger);
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
}

.severity-high.selected .severity-label {
    color: var(--danger);
}

/* Legacy support for old severity-option class */
.severity-option {
    flex: 1;
    padding: 6px 4px;
    border: 2px solid var(--gray-300);
    border-radius: var(--border-radius);
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: white;
    font-weight: 500;
    font-size: 11px;
}

.severity-option:hover {
    border-color: var(--gray-400);
}

.severity-option.selected {
    border-color: var(--primary);
    background: var(--primary);
    color: white;
}

.severity-option.low.selected {
    border-color: var(--success);
    background: var(--success);
}

.severity-option.medium.selected {
    border-color: var(--warning);
    background: var(--warning);
    color: var(--gray-900);
}

.severity-option.high.selected {
    border-color: var(--danger);
    background: var(--danger);
}

/* Rich Editor */
.rich-editor {
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    overflow: hidden;
    background: white;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.editor-toolbar {
    padding: 6px 8px;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}

.toolbar-select {
    padding: 3px 6px;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    background: white;
    font-size: 11px;
    min-width: 80px;
}

.toolbar-btn {
    width: 24px;
    height: 24px;
    border: 1px solid transparent;
    background: white;
    border-radius: 3px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
}

.toolbar-btn:hover {
    background: var(--gray-100);
    border-color: var(--gray-300);
}

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

.editor-content {
    flex: 1;
    padding: 12px;
    font-size: 14px;
    line-height: 1.6;
    outline: none;
    background: white;
    overflow-y: auto;
    min-height: 300px;
}

/* Placeholder for contenteditable */
.editor-content:empty::before {
    content: attr(data-placeholder);
    color: var(--gray-500);
    font-style: italic;
    pointer-events: none;
}

.editor-content:focus:empty::before {
    color: var(--gray-400);
}

.editor-content:focus {
    box-shadow: inset 0 0 0 2px rgba(11, 83, 148, 0.1);
}

.editor-content a {
    color: var(--primary);
    text-decoration: underline;
    position: relative;
}

.editor-content a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.editor-content a::after {
    content: ' [Ctrl+Click to open]';
    font-size: 10px;
    color: var(--gray-500);
    display: none;
}

.editor-content a:hover::after {
    display: inline;
}

.editor-content h1 {
    font-size: 2em;
    font-weight: 700;
    margin: 0.67em 0;
    line-height: 1.2;
}

.editor-content h2 {
    font-size: 1.5em;
    font-weight: 600;
    margin: 0.75em 0;
    line-height: 1.3;
}

.editor-content h3 {
    font-size: 1.17em;
    font-weight: 600;
    margin: 0.83em 0;
    line-height: 1.4;
}

.editor-content p {
    margin: 0.5em 0;
    line-height: 1.6;
}

/* AI Draft Editor Styles */
.ai-comparison-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 12px;
}

.ai-comparison-pane {
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    overflow: hidden;
    background: white;
}

.ai-comparison-label {
    background: var(--gray-100);
    padding: 8px 12px;
    font-weight: 600;
    font-size: 12px;
    color: var(--gray-700);
    border-bottom: 1px solid var(--gray-300);
}

.ai-comparison-content {
    padding: 16px;
    min-height: 300px;
    max-height: 500px;
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.6;
    color: var(--gray-800);
    white-space: pre-wrap;
    word-wrap: break-word;
}

.ai-comparison-header {
    padding-bottom: 8px;
    border-bottom: 2px solid var(--gray-200);
}

.ai-quick-action {
    font-size: 12px;
    padding: 6px 12px;
    transition: all 0.2s ease;
}

.ai-quick-action:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Responsive: Stack on mobile */
@media (max-width: 768px) {
    .ai-comparison-wrapper {
        grid-template-columns: 1fr;
    }

    .ai-comparison-pane:first-child {
        margin-bottom: 16px;
    }
}

.editor-footer {
    padding: 6px 8px;
    background: var(--gray-50);
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 10px;
    color: var(--gray-600);
}

/* Tabs Styles */
.tabs-container {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1;
}

.tabs-list {
    display: flex;
    gap: 2px;
    align-items: center;
    overflow-x: auto;
    max-width: calc(100% - 40px);
    scrollbar-width: thin;
}

.tabs-list::-webkit-scrollbar {
    height: 4px;
}

.tabs-list::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: 2px;
}

.tab-button {
    padding: 4px 12px;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: var(--gray-600);
    white-space: nowrap;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    position: relative;
}

.tab-button:hover {
    color: var(--gray-800);
    background: var(--gray-50);
}

.tab-button.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    background: white;
}

.tab-button .close-tab {
    margin-left: 4px;
    padding: 2px;
    border-radius: 3px;
    opacity: 0;
    transition: opacity 0.2s;
    font-size: 10px;
}

.tab-button:hover .close-tab {
    opacity: 0.6;
}

.tab-button .close-tab:hover {
    opacity: 1;
    background: var(--gray-200);
}

.add-tab-btn {
    padding: 4px 8px;
    background: transparent;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    color: var(--gray-600);
    transition: all 0.2s;
}

.add-tab-btn:hover {
    background: var(--gray-100);
    border-color: var(--primary);
    color: var(--primary);
}

.tab-content {
    height: 100%;
    position: relative;
}

.tab-pane {
    display: none;
    height: 100%;
}

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

/* Map Container */
.map-container {
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    overflow: hidden;
    background: var(--gray-100);
    position: relative;
}

#alertMap {
    height: 100%;
    width: 100%;
    position: relative;
    z-index: 1;
}

.map-controls {
    margin-bottom: 8px;
}

.search-location {
    display: flex;
    gap: 4px;
    margin-bottom: 6px;
}

/* All duplicate tool-btn rules removed - using main definition above */

/* Layout-specific styles */
.headline-section {
    flex-shrink: 0;
    padding: 0;
    margin: 0;
    border: none;
    box-shadow: none;
    background: transparent;
}

.headline-section .section-body {
    padding: 4px 12px !important;
}

.content-section {
    flex: 0 1 auto;
    min-height: 400px;
    height: 800px;
    transition: height 0.2s ease;
}

.content-section.expanded {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    background: white;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
}

.content-section.expanded .section-body {
    height: calc(100vh - 60px);
}

.content-section.expanded .rich-editor {
    height: 100%;
}

.content-section.expanded .editor-content {
    min-height: calc(100vh - 140px);
}

.bottom-section {
    flex: 0 0 auto;
    min-height: 550px;
    margin-top: auto;
}

.bottom-grid {
    display: flex;
    flex-direction: column;
    gap: 24px;
    height: 100%;
}

.form-fields {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: end;
    margin-bottom: 20px;
}

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

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

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

.form-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-700);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 4px;
}

.form-label.required::after {
    content: " *";
    color: var(--danger);
}

.form-control {
    padding: 10px 14px;
    border: 1px solid var(--gray-300);
    border-radius: 6px;
    background: white;
    font-size: 14px;
    transition: var(--transition);
    width: 100%;
    height: 42px;
    display: flex;
    align-items: center;
}

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px 12px;
    padding-right: 35px;
}

input[type="datetime-local"].form-control {
    padding: 8px 14px;
    line-height: 1.5;
}

.form-control:hover {
    border-color: var(--gray-400);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(11, 83, 148, 0.1);
}

/* Duplicate map-section rule removed - using main definition above */

/* Duplicate map-header rule removed - using main definition above */

.impact-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
}

.impact-toggle input[type="checkbox"] {
    transform: scale(1.2);
}

/* More duplicate tool-btn rules removed - using main definition above */


.resize-handle:active .resize-grip {
    color: white;
}


.content-section .section-body {
    position: relative;
}

/* Template Modal Styles */
.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    max-height: 500px;
    overflow-y: auto;
    padding: 8px;
}

.template-card {
    border: 1px solid var(--gray-300);
    border-radius: var(--border-radius);
    padding: 12px;
    cursor: pointer;
    transition: var(--transition);
    background: white;
}

.template-card:hover {
    border-color: var(--primary);
    box-shadow: var(--box-shadow-sm);
    transform: translateY(-2px);
}

.template-card.selected {
    border-color: var(--primary);
    background: var(--gray-50);
}

.template-icon {
    font-size: 24px;
    color: var(--primary);
    margin-bottom: 8px;
    text-align: center;
}

.template-title {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
    color: var(--gray-900);
}

.template-description {
    font-size: 12px;
    color: var(--gray-600);
    line-height: 1.4;
}

/* Active Storm Template Styles */
.template-card.active-storm {
    background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
    border-color: var(--danger);
    animation: pulse 2s infinite;
}

.template-card.active-storm:hover {
    border-color: var(--danger);
    transform: translateY(-4px);
    box-shadow: 0 8px 16px rgba(220, 53, 69, 0.3);
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(220, 53, 69, 0); }
    100% { box-shadow: 0 0 0 0 rgba(220, 53, 69, 0); }
}


.template-section-header {
    grid-column: 1 / -1;
    text-align: center;
    margin: 10px 0;
}

.template-card.active-storm .template-description {
    text-align: left;
    font-size: 11px;
}

.template-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--success);
    color: white;
    font-size: 9px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
}

.template-card {
    position: relative;
}

/* CSV Import button in header */
#csvImportBtn {
    font-size: 0.875rem;
    padding: 0.25rem 0.75rem;
}

/* Planned Events section */
.mobilize-template-card {
    background: linear-gradient(135deg, #edf2f7 0%, #e2e8f0 100%);
    border-color: #4a5568;
}

.mobilize-template-card:hover {
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 100%);
    border-color: #2d3748;
    transform: translateY(-2px);
}

/* Multi-select dropdown styles */
.dropdown-menu.show {
    display: block;
}

.filter-search {
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.event-list {
    max-height: 400px;
    overflow-y: auto;
}

.event-item {
    transition: background-color 0.2s;
}

.event-item:hover {
    background-color: var(--gray-50);
}

.event-checkbox {
    cursor: pointer;
}

/* CSV Table Styles */
.csv-table-container {
    max-height: 500px;
    overflow: auto;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    margin-bottom: 20px;
}

.csv-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.csv-table th {
    position: sticky;
    top: 0;
    background: var(--gray-100);
    border-bottom: 2px solid var(--gray-300);
    padding: 8px;
    text-align: left;
    font-weight: 600;
    z-index: 2;
}

.csv-table td {
    border-bottom: 1px solid var(--gray-200);
    padding: 6px 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.csv-table tr:hover {
    background-color: var(--gray-50);
}

.csv-table tr.selected {
    background-color: rgba(11, 83, 148, 0.1);
}

.column-selector {
    width: 100%;
    padding: 4px;
    font-size: 11px;
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    background: white;
}

.csv-row-checkbox {
    cursor: pointer;
}

.csv-controls {
    margin-bottom: 15px;
    padding: 10px;
    background: var(--gray-50);
    border-radius: 6px;
}

.csv-import-options {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-top: 10px;
}

/* Responsive Design */
@media (max-width: 1400px) {
    .bottom-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

@media (max-width: 1000px) {
    .enterprise-container {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }
    
    .sidebar {
        height: auto;
        max-height: 150px;
    }
    
    .content-body {
        height: auto;
    }
    
    .form-row {
        flex-direction: column;
        gap: 8px;
    }
}

/* Draft Tabs Container */
.draft-tabs-container {
    position: relative;
    min-height: 42px;
    max-height: 200px;
    height: 42px;
    transition: height 0.2s ease;
    overflow: hidden;
    border-bottom: 1px solid var(--gray-200);
}

/* Draft Tabs */
.draft-tabs {
    background: var(--gray-50);
    padding: 0 16px;
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
}

.tab-list {
    display: flex;
    align-items: center;
    gap: 2px;
    min-height: 42px;
    padding: 4px 0;
}

.tab {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: var(--gray-100);
    border: 1px solid var(--gray-300);
    border-bottom: none;
    border-radius: 6px 6px 0 0;
    cursor: pointer;
    transition: var(--transition);
    margin-right: 2px;
}

.tab.active {
    background: white;
    border-color: var(--gray-200);
    position: relative;
}

.tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: -1px;
    right: -1px;
    height: 2px;
    background: white;
}

.tab:hover:not(.active) {
    background: var(--gray-200);
}

.tab-title {
    font-size: 13px;
    font-weight: 500;
    margin-right: 6px;
    color: var(--gray-700);
}

.tab.active .tab-title {
    color: var(--gray-900);
}

.tab-close {
    background: none;
    border: none;
    color: var(--gray-500);
    font-size: 16px;
    line-height: 1;
    padding: 0;
    margin: 0;
    cursor: pointer;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
}

.tab-close:hover {
    background: var(--gray-300);
    color: var(--gray-700);
}

.add-tab-btn {
    background: var(--gray-100);
    border: 1px solid var(--gray-300);
    border-radius: 4px;
    padding: 6px 8px;
    cursor: pointer;
    transition: var(--transition);
    color: var(--gray-600);
    font-size: 12px;
}

.add-tab-btn:hover {
    background: var(--gray-200);
    color: var(--gray-700);
}

/* Draft Resize Handle */
.draft-resize-handle {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 6px;
    cursor: ns-resize;
    background: transparent;
    z-index: 20;
    transition: background 0.2s ease;
}

.draft-resize-handle:hover {
    background: rgba(0, 0, 0, 0.05);
}

.draft-resize-handle:hover .resize-grip {
    opacity: 1;
}

.resize-grip {
    position: absolute;
    bottom: 1px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    background: var(--gray-400);
    border-radius: 2px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

/* When tabs wrap to multiple rows */
.draft-tabs-container.expanded {
    height: auto;
}

.draft-tabs-container.expanded .tab-list {
    flex-wrap: wrap;
    gap: 4px;
    padding: 8px 0;
}


/* Auto Suggested Resources */
.auto-suggested-resources {
    background: white;
    border-radius: var(--border-radius);
    padding: 16px;
    margin-top: 20px;
    box-shadow: var(--box-shadow-sm);
    border: 1px solid var(--gray-200);
}

.auto-suggested-resources .section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    color: var(--gray-800);
    font-size: 14px;
    font-weight: 600;
}

.auto-suggested-resources .section-title .badge {
    background: var(--primary);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: normal;
    margin-left: auto;
}

.auto-suggested-resources .detected-countries {
    background: var(--gray-50);
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 12px;
    font-size: 12px;
    color: var(--gray-700);
    border-left: 3px solid var(--primary);
}

.auto-suggested-resources .detected-countries strong {
    color: var(--gray-800);
    margin-right: 5px;
}

.auto-suggested-resources .resources-list {
    max-height: 300px;
    overflow-y: auto;
    margin: 0 -8px;
    padding: 0 8px;
}

.auto-suggested-resources .resources-list::-webkit-scrollbar {
    width: 6px;
}

.auto-suggested-resources .resources-list::-webkit-scrollbar-track {
    background: var(--gray-100);
    border-radius: 3px;
}

.auto-suggested-resources .resources-list::-webkit-scrollbar-thumb {
    background: var(--gray-400);
    border-radius: 3px;
}

.auto-suggested-resources .no-resources {
    text-align: center;
    color: var(--gray-500);
    padding: 20px;
    font-size: 13px;
    font-style: italic;
}

.resource-item {
    padding: 8px 0;
    border-bottom: 1px solid var(--gray-100);
    transition: background-color 0.2s;
}

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

.resource-item:hover {
    background: var(--gray-50);
    margin: 0 -8px;
    padding: 8px;
    border-radius: 4px;
}

.resource-info {
    display: flex;
    align-items: center;
    padding: 8px 0;
}

.resource-info > div {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.resource-info strong {
    color: var(--gray-800);
    font-weight: 600;
    font-size: 13px;
}

.resource-item.auto-included {
    background: linear-gradient(to right, rgba(40, 167, 69, 0.05) 0%, transparent 100%);
    padding: 4px 8px;
    margin: 0 -8px;
    border-radius: 4px;
}

.resource-checkbox {
    display: flex;
    align-items: flex-start;
}

.resource-checkbox input[type="checkbox"] {
    margin-right: 10px;
    margin-top: 2px;
    cursor: pointer;
}

.resource-checkbox label {
    flex: 1;
    cursor: pointer;
    font-size: 13px;
    line-height: 1.4;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.resource-checkbox label strong {
    color: var(--gray-800);
    font-weight: 600;
}

.resource-checkbox .country-tag {
    display: inline-block;
    background: var(--gray-200);
    color: var(--gray-700);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
    margin-right: 8px;
}

.resource-checkbox .resource-link {
    display: inline-block;
    color: var(--primary);
    text-decoration: none;
    font-size: 11px;
    transition: color 0.2s;
}

.resource-checkbox .resource-link:hover {
    color: var(--primary-dark);
}

.resource-checkbox input[type="checkbox"]:checked + label strong {
    color: var(--primary);
}

.resource-checkbox input[type="checkbox"]:checked + label .country-tag {
    background: var(--primary);
    color: white;
}

/* Highlight resources when polygon is being drawn */
.auto-suggested-resources.detecting {
    border-color: var(--warning);
    background: linear-gradient(45deg, rgba(255, 193, 7, 0.05) 0%, rgba(255, 255, 255, 1) 100%);
}

.auto-suggested-resources.detecting .section-title {
    color: var(--warning);
}

/* Animation for new resources */
@keyframes slideInResource {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.resource-item.new-resource {
    animation: slideInResource 0.3s ease-out;
}

/* Integration with alert categories */
.resource-item[data-category-match="high"] {
    border-left: 3px solid var(--success);
    padding-left: 8px;
}

.resource-item[data-category-match="medium"] {
    border-left: 3px solid var(--warning);
    padding-left: 8px;
}
