/* HubSpot Style Dashboard CSS */
/* Removed Google Fonts import; using system Helvetica Neue stack */

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

:root {
    --hubspot-bg: var(--base-bg, #F2F3F5);
    --hubspot-sidebar: #1e293b;
    --hubspot-orange: var(--color-blue-primary); /* repurpose orange as IES blue */
    --hubspot-blue: var(--color-blue-primary);
    --text-primary: var(--color-text, #1f2937);
    --text-secondary: var(--color-grey, #6b7280);
    --border-color: var(--color-grey, #e5e7eb);
    --card-bg: var(--base-bg, #F2F3F5);
    --hover-bg: #f9fafb;
}

body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-weight: 400;
    color: #1e1e1e;
    line-height: 1.5;
    letter-spacing: 0.01em;
    background-color: var(--hubspot-bg);
    /* Allow horizontal scrolling on pages that need it (calendar). A stricter
       overflow-x rule here was clipping horizontal scroll in the main content.
       Individual components can still control their own overflow. */
    overflow-x: visible;
}

/* Typography hierarchy */
h1, h2, h3 { font-weight: 600; }
h4, h5, h6 { font-weight: 500; }
p, td, li, button, input, label { font-weight: 400; }

/* Layout */
.layout-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar - Enterprise Level Design */
.sidebar {
    background-color: #3182ce; /* Primary blue */
    background-image: url('../images/sideBarImageEurope.jpg?v=2'); /* Fixed path with cache buster */
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    color: #ffffff;
    width: 250px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    transition: all 0.3s ease;
    overflow: hidden; /* delegate scroll to .sidebar-nav */
    overscroll-behavior: contain;
}

/* Overlay to make background subtle */
.sidebar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(49, 130, 206, 0.8); /* Stronger blue overlay for better text readability */
    z-index: 1;
}

/* Ensure all sidebar content appears above the overlay */
.sidebar > * {
    position: relative;
    z-index: 2;
}

.sidebar.collapsed {
    width: 64px;
}

.sidebar-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 24px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    position: relative;
}

.brand-link {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    text-decoration: none;
    color: inherit;
    transition: opacity 0.2s ease;
}

.brand-link:hover {
    opacity: 0.9;
}

.sidebar-title {
    font-size: 0.9rem;
    font-weight: 500;
    color: #ffffff;
    letter-spacing: 0.5px;
    margin: 0;
    line-height: 1.2;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.sidebar-toggle {
    position: absolute;
    top: 24px;
    right: 24px;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: background-color 0.2s;
}

.sidebar-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.sidebar-nav {
    flex: 1;
    padding: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* smooth scrolling on iOS/macOS */
    overscroll-behavior: contain;
}

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

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #ffffff;
    text-decoration: none;
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 500;
    transition: background-color 0.2s ease;
    margin: 0 16px 4px;
    font-size: 14px;
    border: none;
    background: none;
    cursor: pointer;
    width: calc(100% - 32px);
    text-align: left;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.nav-item:hover {
    background-color: #3E4A52;
}

.nav-item.active {
    background-color: rgba(255,255,255,0.15);
}

.icon {
    font-size: 18px;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.nav-divider {
    margin: 16px 0 8px 0;
    padding: 0 24px;
}

.nav-section-label {
    color: #9ca3af;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.sidebar.collapsed .sidebar-header {
    padding: 16px 8px;
    align-items: center;
}

.sidebar.collapsed .brand-link {
    align-items: center;
}

.sidebar.collapsed .sidebar-title {
    display: none;
}

.sidebar.collapsed .sidebar-toggle {
    position: static;
    margin-top: 8px;
}

.sidebar.collapsed .nav-item {
    justify-content: center;
    padding: 12px 8px;
    margin: 0 8px 4px;
    width: calc(100% - 16px);
}

.sidebar.collapsed .nav-item span {
    display: none;
}

.sidebar.collapsed .nav-divider {
    display: none;
}

/* User Info Card Section */
.sidebar-user-section {
    padding: 16px 24px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    position: relative;
}

.sidebar-user-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    text-decoration: none;
    color: inherit;
}

.sidebar-user-card:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.sidebar-user-avatar {
    width: 40px;
    height: 40px;
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
    color: #ffffff;
    flex-shrink: 0;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
}

.sidebar-user-name {
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 2px;
    line-height: 1.2;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.sidebar-user-role {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.2;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.sidebar-user-arrow {
    flex-shrink: 0;
    color: rgba(255, 255, 255, 0.7);
    transition: transform 0.2s ease;
}

.sidebar-user-card:hover .sidebar-user-arrow {
    color: rgba(255, 255, 255, 0.9);
}

/* Collapsed state for user card */
.sidebar.collapsed .sidebar-user-section {
    padding: 16px 8px;
    display: flex;
    justify-content: center;
}

.sidebar.collapsed .sidebar-user-card {
    justify-content: center;
    padding: 8px;
    width: 48px;
    height: 48px;
}

.sidebar.collapsed .sidebar-user-info {
    display: none;
}

.sidebar.collapsed .sidebar-user-arrow {
    display: none;
}

.sidebar.collapsed .sidebar-user-avatar {
    width: 32px;
    height: 32px;
    font-size: 14px;
}

/* Mobile overlay */
.mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    display: none;
    pointer-events: none; /* don't block clicks when hidden */
}

.mobile-overlay.active {
    display: block;
    pointer-events: auto; /* only capture clicks when active */
}

/* Top Bar */
.topbar {
    background-color: var(--base-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 24px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-secondary);
}

.mobile-menu-btn:hover {
    background-color: var(--hover-bg);
}

.search-bar {
    display: flex;
    align-items: center;
    background-color: var(--hover-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 12px;
    width: 300px;
}

.search-bar input {
    border: none;
    background: none;
    outline: none;
    flex: 1;
    padding: 4px 8px;
    font-size: 14px;
}

.search-bar .search-icon {
    width: 16px;
    height: 16px;
    color: var(--text-secondary);
}

.user-menu {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
}

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

.user-avatar {
    width: 32px;
    height: 32px;
    background-color: var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-secondary);
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: 256px;
    transition: margin-left 0.3s ease;
    min-height: 100vh;
    overscroll-behavior: contain;
    overflow-x: visible; /* allow horizontal scrolling within nested containers */
}

.main-content.sidebar-collapsed {
    margin-left: 64px;
}

.content-header {
    background-color: var(--base-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 24px;
}

.content-title {
    font-size: 32px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.content-subtitle {
    color: var(--text-secondary);
    font-size: 16px;
}

.content-body {
    padding: 24px;
}

/* Cards */
.card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.card-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 400;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    gap: 8px;
}

.btn-primary {
    background-color: var(--color-blue-primary);
    color: #ffffff;
}

.btn-primary:hover {
    background-color: var(--color-blue-dark);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: var(--text-secondary);
    color: white;
}

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

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--color-blue-primary);
    color: var(--color-blue-primary);
}

.btn-outline:hover {
    background-color: var(--color-blue-dark);
    color: #ffffff;
}

.btn-success {
    background-color: var(--color-success);
    color: white;
}

.btn-success:hover {
    background-color: #12863d;
}

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

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

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 400;
    color: var(--text-primary);
    font-size: 14px;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s;
    background-color: var(--base-bg);
}

.form-input:focus {
    outline: none;
    border-color: var(--hubspot-orange);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.1);
}

.form-inline {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    flex-wrap: wrap;
}

.form-inline .form-group {
    flex: 1;
    min-width: 200px;
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
}

.form-inline .form-group .form-hint {
    margin-top: 4px;
    min-height: 16px; /* Ensure consistent height for alignment */
}

/* Button container alignment */
.form-group-buttons {
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
}

.form-buttons-container {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

/* Tables */
.table-container {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

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

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

.table th {
    background-color: var(--hover-bg);
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
}

.table tbody tr:hover {
    background-color: var(--hover-bg);
}

/* Status badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-safe {
    background-color: #dcfce7;
    color: #166534;
}

.status-warning {
    background-color: #fef3c7;
    color: #92400e;
}

.status-danger {
    background-color: #fee2e2;
    color: #991b1b;
}

/* Progress bars */
.progress-bar {
    width: 100%;
    height: 8px;
    background-color: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-fill {
    height: 100%;
    transition: width 0.3s ease;
}

/* Grid layouts */
.grid {
    display: grid;
    gap: 24px;
}

.grid-2 {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.modal.active {
    display: flex;
}

.modal-content {
    background-color: var(--card-bg);
    border-radius: 12px;
    padding: 32px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    margin-bottom: 24px;
}

.modal-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

/* Login page specific */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #3182ce; /* Primary blue */
    background-image: url('../images/sideBarImageEurope.jpg?v=2'); /* Same image as sidebar */
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    padding: 20px;
    position: relative;
}

/* Overlay to make background subtle */
.login-page::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(49, 130, 206, 0.8); /* Stronger blue overlay for better text readability */
    z-index: 1;
}

/* Ensure all login content appears above the overlay */
.login-page > * {
    position: relative;
    z-index: 2;
}

/* Login Navigation */
.login-nav {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
}

.login-nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--color-blue-primary);
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(76, 115, 159, 0.2);
}

.login-nav-link:hover {
    background: rgba(255, 255, 255, 1);
    color: var(--color-blue-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(76, 115, 159, 0.15);
}

.login-nav-link svg {
    flex-shrink: 0;
}

.login-container {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 48px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.login-title {
    font-size: 32px;
    font-weight: 700;
    color: var(--color-blue-primary);
    text-align: center;
    margin-bottom: 8px;
}

.login-subtitle {
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 32px;
    font-size: 16px;
}

/* Error message styles moved to components.css for consistency */
/* Using standardized .error-message, .success-message, .warning-message, .info-message classes */

/* Responsive Design */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        width: 250px;
        z-index: 1001;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .mobile-overlay.active {
        display: block;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .main-content.sidebar-collapsed {
        margin-left: 0;
    }
    
    .mobile-menu-btn {
        display: block;
    }
    
    .search-bar {
        display: none;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 220px;
    }
    
    .sidebar-title {
        font-size: 0.8rem;
    }
    
    .sidebar-user-section {
        padding: 12px 20px;
    }
    
    .sidebar-user-avatar {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
    
    .sidebar-user-name {
        font-size: 13px;
    }
    
    .sidebar-user-role {
        font-size: 11px;
    }
    
    .nav-item {
        padding: 8px 20px;
        font-size: 13px;
    }
    
    .icon {
        font-size: 16px;
        width: 16px;
        height: 16px;
    }
}

@media (max-width: 768px) {
    .content-body {
        padding: 12px 8px;
    }
    
    .card {
        padding: 12px;
        margin-bottom: 16px;
    }
    
    .form-inline {
        flex-direction: column;
        align-items: stretch;
    }
    
    .form-inline .form-group {
        min-width: auto;
    }
    
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table {
        font-size: 12px;
    }
    
    .table th,
    .table td {
        padding: 8px 6px;
        white-space: nowrap;
    }
    
    .modal-content {
        padding: 20px;
        margin: 12px;
    }
    
    /* Hide Help text on mobile, show only icon */
    .help-text {
        display: none;
    }
    
    .topbar-right .btn-outline {
        padding: 8px !important;
    }
    
    .content-title {
        font-size: 20px;
    }
    
    .content-subtitle {
        font-size: 14px;
    }
    
    /* Make buttons wrap on mobile */
    .card-header {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .card-header h2 {
        width: 100%;
    }
}

/* Extra small screens */
@media (max-width: 480px) {
    .sidebar {
        width: 200px;
    }
    
    .sidebar-user-section {
        padding: 10px 16px;
    }
    
    .sidebar-user-avatar {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }
    
    .sidebar-user-name {
        font-size: 12px;
    }
    
    .sidebar-user-role {
        font-size: 10px;
    }
    
    .table {
        font-size: 11px;
    }
    
    .table th,
    .table td {
        padding: 6px 4px;
    }
    
    .btn {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    .card {
        padding: 10px;
    }
    
    .content-body {
        padding: 8px 4px;
    }
    
    footer {
        margin-bottom: 60px !important; /* Account for mobile browser UI */
    }
    
    /* Hide table view on very small screens, force card view */
    #tableView {
        display: none !important;
    }
    
    #cardView {
        display: grid !important;
    }
    
    #tableBtn, #cardsBtn {
        display: none !important;
    }
    
    .grid-2 {
        grid-template-columns: 1fr;
    }
}

/* Hide view toggle buttons on mobile */
@media (max-width: 768px) {
    #tableBtn, #cardsBtn {
        display: none !important;
    }
}

/* Utility classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-secondary); }
.mb-4 { margin-bottom: 16px; }
.mt-4 { margin-top: 16px; }
.hidden { display: none; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-4 { gap: 16px; }

/* ===========================================
   PHASE 1 USABILITY FIXES - ENHANCED STYLES
   =========================================== */

/* 1. STANDARDIZED BUTTON SYSTEM */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    user-select: none;
    white-space: nowrap;
    min-height: 40px;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-primary {
    background: #3b82f6;
    color: white;
    border-color: #3b82f6;
}

.btn-primary:hover:not(:disabled) {
    background: #2563eb;
    border-color: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

.btn-secondary {
    background: #6b7280;
    color: white;
    border-color: #6b7280;
}

.btn-secondary:hover:not(:disabled) {
    background: #4b5563;
    border-color: #4b5563;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(107, 114, 128, 0.3);
}

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

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
    border-color: #dc2626;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(239, 68, 68, 0.3);
}

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

.btn-success:hover:not(:disabled) {
    background: #059669;
    border-color: #059669;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(16, 185, 129, 0.3);
}

.btn-outline {
    background: transparent;
    color: #3b82f6;
    border-color: #3b82f6;
}

.btn-outline:hover:not(:disabled) {
    background: #3b82f6;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    min-height: 32px;
}

.btn-lg {
    padding: 14px 24px;
    font-size: 16px;
    min-height: 48px;
}

/* 2. ENHANCED FORM COMPONENTS */
.form-group {
    margin-bottom: 20px;
    position: relative;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    margin-bottom: 6px;
    line-height: 1.4;
}

.form-label.required::after {
    content: ' *';
    color: #ef4444;
    font-weight: 600;
}

.form-input, .form-select {
    width: 100%;
    padding: 12px 16px;
    font-size: 14px;
    line-height: 1.4;
    color: #1f2937;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    transition: all 0.2s ease;
    font-family: inherit;
}

.form-input:focus, .form-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-input.error, .form-select.error {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.form-input:disabled, .form-select:disabled {
    background: #f9fafb;
    color: #9ca3af;
    cursor: not-allowed;
}

.form-hint {
    font-size: 12px;
    color: #6b7280;
    margin-top: 4px;
    line-height: 1.3;
}

.form-error {
    font-size: 12px;
    color: #ef4444;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.form-error::before {
    content: '⚠';
    font-size: 14px;
}

/* 3. ALERT/NOTIFICATION SYSTEM */
.alert {
    padding: 16px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 14px;
    line-height: 1.5;
    border: 1px solid;
}

.alert-error {
    background: #fef2f2;
    color: #991b1b;
    border-color: #fecaca;
}

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

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

.alert-success {
    background: #f0fdf4;
    color: #166534;
    border-color: #bbf7d0;
}

.alert-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    margin-top: 2px;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.alert-dismiss {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.alert-dismiss:hover {
    opacity: 1;
}

/* 4. ENHANCED MODAL SYSTEM */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    max-width: 90vw;
    max-height: 90vh;
    overflow: hidden;
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-container {
    transform: scale(1);
}

.modal-header {
    padding: 24px 24px 0 24px;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 20px;
}

.modal-title {
    font-size: 20px;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
}

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

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

/* 5. PROGRESS INDICATORS */
.progress-container {
    width: 100%;
    background: #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    height: 8px;
    margin: 12px 0;
}

.progress-bar {
    height: 100%;
    background: #3b82f6;
    border-radius: 8px;
    transition: width 0.3s ease;
    position: relative;
}

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

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

.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #e5e7eb;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

@keyframes progressIndeterminate {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(400%); }
}

@keyframes progressDots {
    0%, 80%, 100% { 
        transform: scale(0);
        opacity: 0.5;
    }
    40% { 
        transform: scale(1);
        opacity: 1;
    }
}

/* 6. ENHANCED TOOLTIP SYSTEM */
.tooltip {
    position: absolute;
    background: #1f2937;
    color: white;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    z-index: 1000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
    max-width: 300px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.tooltip.show {
    opacity: 1;
}

.tooltip-enhanced {
    padding: 0;
    max-width: 350px;
}

.tooltip-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px 8px 16px;
    background: rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    font-size: 14px;
    font-weight: 600;
}

.tooltip-content {
    padding: 12px 16px 16px 16px;
    line-height: 1.5;
}

.tooltip-arrow {
    position: absolute;
    width: 0;
    height: 0;
}

/* Help icon styles */
.help-icon {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    transition: all 0.2s;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.help-icon:hover {
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
    transform: translateY(-50%) scale(1.1);
}

.help-icon:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Form field help positioning */
.form-group {
    position: relative;
}

.form-group .form-input,
.form-group .form-select {
    padding-right: 40px; /* Make room for help icon */
}

/* 7. ENHANCED TABLE STYLING */
.table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.table th {
    background: #f9fafb;
    color: #374151;
    font-weight: 600;
    font-size: 14px;
    padding: 16px 20px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
    position: relative;
}

.table td {
    padding: 16px 20px;
    border-bottom: 1px solid #f3f4f6;
    font-size: 14px;
    color: #1f2937;
}

.table tbody tr:hover {
    background: #f9fafb;
}

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

/* Sortable table headers */
.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: all 0.2s ease;
}

.sortable:hover {
    background-color: #f3f4f6;
    color: #1f2937;
}

.sort-arrow {
    display: inline-block;
    margin-left: 6px;
    font-size: 12px;
    color: #9ca3af;
    transition: color 0.2s ease, transform 0.2s ease;
}

.sort-arrow.active {
    color: #3b82f6;
    font-weight: bold;
    transform: scale(1.2);
}

.sortable:hover .sort-arrow {
    color: #3b82f6;
}

/* Table container for responsive scrolling */
.table-container {
    overflow-x: auto;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* 7. STANDARDIZED MODAL SYSTEM */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal.active .modal-content {
    transform: scale(1);
}

.modal-header {
    padding: 20px 24px 16px 24px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #6b7280;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #f3f4f6;
    color: #374151;
}

.modal-body {
    padding: 20px 24px;
}

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

/* Modal overlay for confirmation dialogs */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    max-width: 500px;
    width: 90%;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.modal-overlay.active .modal-container {
    transform: scale(1);
}

/* Settings Panel Styles */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
}

.setting-group {
    background: #f8fafc;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.setting-group h4 {
    margin: 0 0 16px 0;
    color: #1f2937;
    font-size: 16px;
    font-weight: 600;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 8px;
}

.setting-item {
    margin-bottom: 16px;
}

.setting-item:last-child {
    margin-bottom: 0;
}

.setting-label {
    display: block;
    margin-bottom: 6px;
    color: #374151;
    font-size: 14px;
    font-weight: 500;
}

.setting-label input[type="checkbox"] {
    margin-right: 8px;
}

/* Theme and Color Scheme Support */
[data-theme="dark"] {
    --hubspot-bg: #1f2937;
    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;
    --border-color: #374151;
    --card-bg: #374151;
    --hover-bg: #4b5563;
}

[data-color-scheme="high-contrast"] {
    --hubspot-bg: #ffffff;
    --text-primary: #000000;
    --text-secondary: #333333;
    --border-color: #000000;
    --card-bg: #ffffff;
    --hover-bg: #f0f0f0;
}

[data-color-scheme="colorblind-friendly"] {
    --hubspot-orange: #1f77b4;
    --hubspot-blue: #ff7f0e;
}

/* Compact Mode */
.compact-mode .table th,
.compact-mode .table td {
    padding: 8px 12px;
    font-size: 13px;
}

.compact-mode .card {
    padding: 12px;
}

.compact-mode .btn {
    padding: 6px 12px;
    font-size: 13px;
}

.compact-mode .form-input,
.compact-mode .form-select {
    padding: 8px 12px;
    font-size: 13px;
}

/* No Animations */
.no-animations * {
    animation-duration: 0s !important;
    animation-delay: 0s !important;
    transition-duration: 0s !important;
    transition-delay: 0s !important;
}

/* Filter Panel Styles */
.filter-panel {
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    padding: 16px;
    margin-top: 16px;
    display: none;
}

.filter-panel.active {
    display: block;
}

/* Results Count Display */
#resultsCount {
    margin-top: 12px;
    padding: 8px 12px;
    background: #f0f9ff;
    border-radius: 6px;
    font-size: 14px;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

/* 8. STATUS BADGES */
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-safe {
    background: #d1fae5;
    color: #065f46;
}

.status-warning {
    background: #fef3c7;
    color: #92400e;
}

.status-danger {
    background: #fee2e2;
    color: #991b1b;
}

