:root {
    --font-base: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    --font-color: #1e1e1e;
    /* IES brand palette */
    --color-grey: #858D9A;           /* IES primary grey */
    --color-blue-primary: #4C739F;   /* main action blue */
    --color-blue-dark: #5B6C8F;      /* hover/active blue */
    --color-blue-light: #A9C4E0;     /* light hover/secondary */
    --color-text: #1E1E1E;           /* main text color */
    --base-bg: #E5E7EB;              /* Test Grey - base background color */
    --color-background: #E5E7EB;     /* Test Grey background */
    --color-surface: #E5E7EB;        /* Test Grey for cards */
    --color-success: #16A34A;        /* green for OK/success */
    --color-danger: #D14343;         /* red for errors */

    /* Back-compat mapping for existing theme tokens */
    --color-blue: var(--color-blue-primary);
    
    /* Icon system variables */
    --icon-size-sm: 16px;
    --icon-size-md: 20px;
    --icon-size-lg: 24px;
    --icon-size-xl: 32px;
    
    --icon-color-primary: #4C739F;
    --icon-color-secondary: #6b7280;
    --icon-color-success: #16a34a;
    --icon-color-warning: #f59e0b;
    --icon-color-danger: #dc2626;
    --icon-color-muted: #9ca3af;
    
    /* Status color system - standardized across all components */
    --status-safe: #16a34a;
    --status-safe-bg: #d1fae5;
    --status-safe-text: #065f46;
    
    --status-warning: #f59e0b;
    --status-warning-bg: #fef3c7;
    --status-warning-text: #92400e;
    
    --status-danger: #dc2626;
    --status-danger-bg: #fee2e2;
    --status-danger-text: #991b1b;
    
    --status-info: #3b82f6;
    --status-info-bg: #dbeafe;
    --status-info-text: #1e40af;
    
    /* Risk level colors for compliance tracking */
    --risk-green: #16a34a;
    --risk-amber: #f59e0b;
    --risk-red: #dc2626;
}

body {
    font-family: var(--font-base);
    font-weight: 400;
    color: var(--font-color);
    line-height: 1.5;
    letter-spacing: 0.01em;
    background-color: var(--color-background);
}

h1, h2, h3 {
    font-weight: 600;
}

h4, h5, h6 {
    font-weight: 500;
}

p, td, li, button, input, label {
    font-weight: 400;
    font-family: var(--font-base);
}

/* Ensure framework resets are overridden if present */
html, body, button, input, select, textarea, table, th, td {
    font-family: var(--font-base);
    color: var(--font-color);
}

/* Inherit for headings and common UI components */
.card, .btn, .form-input, .form-label, .table, .sidebar, .topbar, .content-title {
    font-family: var(--font-base);
}

/* IES brand colors applied globally */
h1, h2, h3, h4, h5, h6 {
    color: var(--color-grey);
}

button, .btn {
    color: var(--color-background);
    background-color: var(--color-blue);
    border: none;
    transition: background-color 0.2s ease;
}

button:hover, .btn:hover {
    background-color: var(--color-blue-light);
}

.card, .panel, .container {
    background-color: var(--color-surface);
    border: 1px solid var(--color-grey);
}

hr, .divider {
    border-color: var(--color-grey);
}

input, select, textarea {
    border: 1px solid var(--color-grey);
    color: var(--color-text);
    background-color: var(--color-background);
}

/* Ensure dropdown input matches other form inputs */
.dropdown-input {
    border: 1px solid var(--color-grey);
    border-radius: 4px;
}

/* Ensure select elements have same border as text inputs */
select.form-input {
    border: 1px solid var(--color-grey) !important;
    border-radius: 4px;
}

/* Map existing theme variables to brand tokens so all components inherit */
:root {
    --text-primary: var(--color-text);
    --text-secondary: var(--color-grey);
    --border-color: var(--color-grey);
    --card-bg: var(--color-surface);
}

/* ===== SEARCH BAR STYLES ===== */

/* Search Container */
.search-bar {
    position: relative;
    display: flex;
    align-items: center;
}

.search-bar input {
    padding-right: 80px; /* Space for clear button and loading indicator */
}

/* Clear Button */
.search-clear {
    position: absolute;
    right: 40px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #9ca3af;
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    transition: color 0.2s, background-color 0.2s;
    border-radius: 4px;
    z-index: 10;
}

.search-clear:hover {
    color: #6b7280;
    background-color: #f3f4f6;
}

/* Loading Indicator */
.search-loading {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.search-loading svg {
    animation: spin 1s linear infinite;
}

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

/* Search Dropdown */
.search-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--base-bg);
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1), 0 4px 10px rgba(0, 0, 0, 0.05);
    display: none;
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    animation: dropdownFadeIn 0.15s ease-out;
}

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

/* Search Dropdown Item */
.search-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
    transition: background-color 0.15s ease;
}

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

.search-dropdown-item:hover,
.search-dropdown-item.selected {
    background-color: #f9fafb;
}

.search-dropdown-item.selected {
    background-color: #eff6ff;
}

/* Search Result Icon */
.search-result-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background-color: #f3f4f6;
    border-radius: 50%;
    flex-shrink: 0;
}

.search-result-icon svg {
    color: #6b7280;
}

/* Search Result Content */
.search-result-content {
    flex: 1;
    min-width: 0;
}

.search-result-name {
    font-weight: 500;
    color: #1f2937;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.search-result-meta {
    font-size: 12px;
    color: #9ca3af;
    margin-top: 2px;
}

/* Highlighted Text */
.search-result-name mark,
.search-dropdown mark {
    background-color: #fef3c7;
    color: #92400e;
    padding: 0 2px;
    border-radius: 2px;
    font-weight: 600;
}

/* Empty State */
.search-dropdown-empty {
    padding: 32px 16px;
    text-align: center;
    color: #9ca3af;
}

.search-dropdown-empty svg {
    margin: 0 auto 12px;
    color: #d1d5db;
}

.search-dropdown-empty p {
    margin: 0;
    font-size: 14px;
}

/* Scrollbar Styling */
.search-dropdown::-webkit-scrollbar {
    width: 8px;
}

.search-dropdown::-webkit-scrollbar-track {
    background: #f9fafb;
    border-radius: 0 8px 8px 0;
}

.search-dropdown::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 4px;
}

.search-dropdown::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .search-bar {
        width: 100%;
    }
    
    .search-dropdown {
        left: 0;
        right: 0;
        width: 100%;
    }
    
    .employee-search-container {
        width: 100% !important;
        max-width: none !important;
    }
}

/* Focus styles */
.search-bar input:focus {
    outline: none;
    border-color: var(--color-blue-primary);
    box-shadow: 0 0 0 3px rgba(76, 115, 159, 0.1);
}

/* Tutorial Modal Styles */
.tutorial-modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0,0,0,0.7) !important;
    z-index: 999999 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
}

.tutorial-modal-content {
    background: #F2F3F5 !important;
    border-radius: 12px !important;
    padding: 32px !important;
    max-width: 600px !important;
    width: 90% !important;
    max-height: 80vh !important;
    overflow-y: auto !important;
    box-shadow: 0 20px 40px rgba(0,0,0,0.3) !important;
    border: 2px solid var(--color-blue-primary) !important;
    margin: 20px !important;
    position: relative !important;
    transform: none !important;
}

/* Employee checkbox hover effect */
.employee-checkbox:hover {
    border-color: var(--color-blue-primary);
    background-color: #f9fafb;
}

.employee-checkbox input:checked ~ span {
    color: var(--color-blue-primary);
}

/* ===== Cookie consent banner ===== */
.cookie-consent {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    width: min(560px, 92vw);
    background-color: rgba(17, 24, 39, 0.96);
    color: #f9fafb;
    border-radius: 12px;
    box-shadow: 0 20px 48px rgba(15, 23, 42, 0.25);
    padding: 20px 24px;
    z-index: 1100;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.cookie-consent--visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

.cookie-consent__content {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.cookie-consent__message {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    color: #e5e7eb;
}

.cookie-consent__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.cookie-consent__actions .btn {
    flex-shrink: 0;
}

.cookie-consent__actions .btn-outline-secondary {
    background-color: transparent;
    color: #f9fafb;
    border: 1px solid rgba(229, 231, 235, 0.4);
}

.cookie-consent__actions .btn-outline-secondary:hover {
    background-color: rgba(229, 231, 235, 0.12);
    color: #f9fafb;
}

.cookie-consent__link {
    color: #bfdbfe;
    text-decoration: underline;
    padding-left: 0;
}

.cookie-consent__link:hover {
    color: #93c5fd;
    text-decoration: underline;
}

@media (max-width: 576px) {
    .cookie-consent {
        bottom: 16px;
        padding: 18px 20px;
    }

    .cookie-consent__actions {
        flex-direction: column;
        align-items: stretch;
    }

    .cookie-consent__actions .btn,
    .cookie-consent__link {
        width: 100%;
        text-align: center;
    }
}

