/* ========================================
   AG ONE Work - Design System CSS
   ======================================== */

:root {
    /* Primary Colors */
    --primary-25: #f5f8ff;
    --primary-50: #e6efff;
    --primary-100: #ccdeff;
    --primary-200: #99bdff;
    --primary-300: #669cff;
    --primary-400: #4a7aff;
    --primary-500: #3366ff;
    --primary-600: #2952cc;
    --primary-700: #1f3d99;
    --primary-800: #142966;
    --primary-900: #001d6b;

    /* Accent Colors */
    --accent: #00d4ff;
    --accent-light: #66e5ff;
    --accent-dark: #00a8cc;

    /* Neutral Colors */
    --neutral-50: #f8fafc;
    --neutral-100: #f1f5f9;
    --neutral-200: #e2e8f0;
    --neutral-300: #cbd5e1;
    --neutral-400: #94a3b8;
    --neutral-500: #64748b;
    --neutral-600: #475569;
    --neutral-700: #334155;
    --neutral-800: #1e293b;
    --neutral-900: #0f172a;

    /* Semantic Colors */
    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --error: #ef4444;
    --error-light: #fee2e2;
    --info: #3b82f6;
    --info-light: #dbeafe;

    /* Background Colors */
    --background: #ffffff;
    --foreground: #1e293b;
    --card: #ffffff;
    --card-foreground: #1e293b;
    --muted: #f1f5f9;
    --muted-foreground: #64748b;

    /* Sidebar */
    --sidebar-bg: linear-gradient(180deg, #001d6b 0%, #0a2d7a 50%, #143d8a 100%);
    --sidebar-text: #ffffff;
    --sidebar-foreground: #ffffff;
    --sidebar-foreground-muted: rgba(255, 255, 255, 0.7);
    --sidebar-accent: #00d4ff;
    --sidebar-hover: rgba(74, 122, 255, 0.3);
    --sidebar-active: linear-gradient(267deg, rgba(74, 122, 255, 0.5) 11.41%, rgba(0, 29, 107, 0.3) 127.13%);

    /* Gradient Background */
    --gradient-background-color: #f8fafc;

    /* Border */
    --border: #e2e8f0;
    --border-radius: 8px;
    --radius: 8px;

    /* Spacing */
    --spacing-1: 4px;
    --spacing-2: 8px;
    --spacing-3: 12px;
    --spacing-4: 16px;
    --spacing-5: 20px;
    --spacing-6: 24px;
    --spacing-8: 32px;

    /* Typography */
    --font-family: 'Noto Sans', sans-serif;
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;

    --text-body-xxs: 10px;
    --text-body-xs: 12px;
    --text-body-sm: 13px;
    --text-body-md: 14px;
    --text-body-lg: 16px;
    --text-subtitle-lg: 18px;
    --text-heading-sm: 20px;
    --text-heading-md: 24px;
    --text-heading-lg: 32px;

    /* Input */
    --input-height: 40px;
    --input-radius: 8px;
    --input-background: #ffffff;
    --input-default-border: #e2e8f0;

    /* Button */
    --button-default-bg: #3366ff;
    --button-default-text: #ffffff;
    --button-secondary-bg: #f1f5f9;
    --button-secondary-text: #1e293b;

    /* Table */
    --table-border-color: #ebf3ff;
    --table-header-gradient-start: #2563eb;
    --table-header-gradient-end: #1e40af;
    --table-header-text: #ffffff;
    --table-header-border: rgba(255, 255, 255, 0.1);
    --table-cell-text: #1e293b;
    --table-row-hover: #f9fafb;
    --table-status-active-bg: #d1fae5;
    --table-status-active-text: #059669;
    --table-status-inactive-bg: #fee2e2;
    --table-status-inactive-text: #dc2626;
    --table-status-pending-bg: #fef3c7;
    --table-status-pending-text: #d97706;

    /* Breadcrumb */
    --breadcrumb-current-text: #64748b;
    --breadcrumb-inactive-text: #94a3b8;

    /* Search */
    --search-icon-color: #94a3b8;

    /* Charts */
    --chart-1: #3366ff;
    --chart-2: #10b981;
    --chart-3: #f59e0b;
    --chart-4: #00d4ff;
    --chart-5: #ef4444;

    /* Sync Status Colors */
    --sync-synced-bg: #10b981;
    --sync-pending-bg: #f59e0b;
    --sync-synced-text: #ffffff;
    --sync-pending-text: #ffffff;

    /* White Text */
    --white-text: #ffffff;

    /* Warning */
    --warning-bg: #fef3c7;
    --warning-border: #fcd34d;
}

/* Global Reset */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body,
#app {
    height: 100%;
    width: 100%;
    font-family: var(--font-family);
    background-color: var(--gradient-background-color);
    color: var(--foreground);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--neutral-100);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--neutral-300);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--neutral-400);
}

/* Focus Styles */
*:focus-visible {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
}

/* Selection */
::selection {
    background: var(--primary-200);
    color: var(--primary-900);
}

/* ========================================
   Layout Styles
   ======================================== */

.app-container {
    display: flex;
    height: 100vh;
    width: 100%;
    overflow: hidden;
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

/* Header */
.header {
    height: 68px;
    background: var(--background);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 24px;
    flex-shrink: 0;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-logo {
    height: 36px;
}

.header-divider {
    width: 1px;
    height: 32px;
    background: var(--border);
}

.header-title {
    font-size: var(--text-subtitle-lg);
    font-weight: var(--font-weight-semibold);
    color: var(--foreground);
}

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

.role-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    font-family: var(--font-family);
    font-size: var(--text-body-md);
    font-weight: var(--font-weight-medium);
    color: var(--foreground);
    transition: all 0.2s;
}

.role-selector:hover {
    border-color: var(--primary-500);
}

.header-icon-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--neutral-600);
    border-radius: var(--radius);
    transition: background 0.2s;
}

.header-icon-btn:hover {
    background: var(--neutral-100);
}

/* User Profile Dropdown */
.user-profile-wrapper {
    position: relative;
}

.user-profile-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px;
    background: transparent;
    border: none;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.2s;
}

.user-profile-btn:hover {
    background: var(--neutral-100);
}

.header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    position: relative;
    background: var(--neutral-100);
}

.header-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.header-avatar .avatar-fallback {
    display: flex;
    position: absolute;
    inset: 0;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--neutral-600);
    background: var(--neutral-100);
}

.profile-chevron {
    color: var(--neutral-500);
    transition: transform 0.2s;
}

.profile-chevron.rotated {
    transform: rotate(180deg);
}

.profile-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 300px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12), 0 1px 3px rgba(0, 0, 0, 0.08);
    z-index: 1000;
    animation: dropdownSlide 0.15s ease-out;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.profile-dropdown-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px;
}

.profile-dropdown-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    position: relative;
    background: var(--neutral-100);
    flex-shrink: 0;
}

.profile-dropdown-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-dropdown-avatar .avatar-fallback-large {
    display: flex;
    position: absolute;
    inset: 0;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 600;
    color: var(--neutral-600);
    background: var(--neutral-100);
}

.profile-dropdown-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.profile-dropdown-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--neutral-900);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-dropdown-email {
    font-size: 13px;
    color: var(--primary-500);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-dropdown-divider {
    height: 1px;
    background: var(--neutral-200);
    margin: 0 16px;
}

.profile-dropdown-menu {
    padding: 8px;
}

.profile-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 14px;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: var(--font-family);
    font-size: 14px;
    font-weight: 500;
    color: var(--neutral-700);
    transition: background 0.15s;
    text-align: left;
}

.profile-dropdown-item:hover {
    background: var(--neutral-100);
}

.profile-dropdown-item svg {
    color: var(--neutral-500);
}

/* Page Header */
.page-header {
    padding: 16px 24px;
    flex-shrink: 0;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--text-body-xs);
    color: var(--breadcrumb-current-text);
    margin-bottom: 4px;
}

.page-title {
    font-size: 25px;
    font-weight: var(--font-weight-bold);
    color: var(--foreground);
}

/* Main Area */
.main-area {
    flex: 1;
    overflow: auto;
    padding: 0 24px 24px;
}

/* ========================================
   Component Styles
   ======================================== */

/* Card */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
}

/* Search Bar */
.search-container {
    position: relative;
    flex: 1;
    max-width: 600px;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--search-icon-color);
    width: 20px;
    height: 20px;
}

.search-input {
    width: 100%;
    height: var(--input-height);
    padding-left: 44px;
    padding-right: 12px;
    border: 1px solid var(--input-default-border);
    border-radius: var(--input-radius);
    font-family: var(--font-family);
    font-size: var(--text-body-md);
    color: var(--foreground);
    background: var(--input-background);
    outline: none;
    transition: border-color 0.2s;
}

.search-input:focus {
    border-color: var(--primary-500);
}

.search-input::placeholder {
    color: var(--muted-foreground);
}

/* Button */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: var(--input-height);
    padding: 0 16px;
    border: none;
    border-radius: var(--radius);
    font-family: var(--font-family);
    font-size: var(--text-body-md);
    font-weight: var(--font-weight-semibold);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-primary {
    background: var(--button-default-bg);
    color: var(--button-default-text);
}

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

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

.btn-secondary:hover {
    background: var(--neutral-200);
}

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

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

/* Filter */
.filter-select {
    height: 36px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: var(--font-family);
    font-size: var(--text-body-sm);
    color: var(--foreground);
    background: var(--background);
    cursor: pointer;
}

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

.table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-family);
}

.table th {
    background: linear-gradient(to bottom, #2563eb, #1e40af);
    padding: var(--spacing-3) var(--spacing-4);
    text-align: left;
    font-size: var(--text-body-md);
    font-weight: var(--font-weight-semibold);
    color: var(--table-header-text);
    border-right: 1px solid var(--table-header-border);
    border-bottom: none;
    white-space: nowrap;
    line-height: 1.4;
}

.table th:last-child {
    border-right: none;
}

.table td {
    padding: 8px 16px;
    font-size: 14px;
    color: var(--table-cell-text);
    border-bottom: 1px solid var(--table-border-color);
    line-height: 1.4;
}

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

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

.employee-table tbody tr {
    transition: background-color 0.15s ease;
}

.employee-table tbody tr:hover {
    background: #F9FAFB;
}

/* Avatar */
.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-family);
    font-size: var(--text-body-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--white-text);
    background: linear-gradient(135deg, var(--primary-500) 0%, var(--accent) 100%);
    flex-shrink: 0;
    object-fit: cover;
}

/* Status Badge */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 12px;
    border-radius: 16px;
    font-family: var(--font-family);
    font-size: var(--text-body-xs);
    font-weight: var(--font-weight-semibold);
}

.badge-active {
    background: var(--table-status-active-bg);
    color: var(--table-status-active-text);
}

.badge-inactive {
    background: var(--table-status-inactive-bg);
    color: var(--table-status-inactive-text);
}

.badge-pending {
    background: var(--table-status-pending-bg);
    color: var(--table-status-pending-text);
}

.badge-neutral {
    background: var(--neutral-100);
    color: var(--foreground);
}

/* Sync Status */
.sync-status {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sync-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--text-body-xs);
}

.sync-item.synced {
    color: var(--table-status-active-text);
}

.sync-item.pending {
    color: var(--chart-3);
}

.sync-badge-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 4px;
    font-family: 'Noto Sans', sans-serif;
    font-size: 11px;
    font-weight: 500;
    color: white;
    white-space: nowrap;
    line-height: 1.4;
}

.sync-badge-item[data-status="Synced"] {
    background-color: #10b981;
}

.sync-badge-item[data-status="Pending"] {
    background-color: #f59e0b;
}

.sync-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.9);
    flex-shrink: 0;
}

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

.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stat-card-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-50);
    color: var(--primary-500);
}

.stat-card-value {
    font-size: var(--text-heading-md);
    font-weight: var(--font-weight-bold);
    color: var(--foreground);
}

.stat-card-label {
    font-size: var(--text-body-sm);
    color: var(--muted-foreground);
}

/* Duplicate Warning */
.duplicate-warning {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: var(--radius);
    background: var(--warning-bg);
    border: 1px solid var(--warning-border);
    font-size: var(--text-body-xxs);
    font-weight: var(--font-weight-semibold);
    color: var(--chart-3);
}

/* MudBlazor Overrides */
.mud-drawer-container {
    background: var(--sidebar-bg) !important;
}

.mud-nav-item .mud-nav-link {
    color: var(--sidebar-foreground-muted) !important;
}

.mud-nav-item .mud-nav-link.active {
    background: var(--sidebar-active) !important;
    color: var(--white-text) !important;
}

/* Utility Classes */
.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.justify-center {
    justify-content: center;
}

.gap-2 {
    gap: 8px;
}

.gap-3 {
    gap: 12px;
}

.gap-4 {
    gap: 16px;
}

.gap-6 {
    gap: 24px;
}

.mb-4 {
    margin-bottom: 16px;
}

.mb-6 {
    margin-bottom: 24px;
}

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

.font-semibold {
    font-weight: var(--font-weight-semibold);
}

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

.transition-colors {
    transition: background-color 0.15s ease, color 0.15s ease;
}

.cursor-pointer {
    cursor: pointer;
}

.align-middle {
    vertical-align: middle;
}

.text-left {
    text-align: left;
}

.whitespace-nowrap {
    white-space: nowrap;
}

.inline-flex {
    display: inline-flex;
}

.relative {
    position: relative;
}

.size-full {
    width: 100%;
    height: 100%;
}

/* Additional Table Styles */
[data-slot="table-wrapper"] {
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
}

[data-slot="table-row"]:hover {
    background-color: var(--table-row-hover) !important;
}

/* Info Banner */
.info-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background-color: var(--primary-25);
    border: 1px solid var(--primary-100);
    border-radius: 8px;
    margin-bottom: 16px;
}

.info-banner svg {
    color: var(--primary-500);
    flex-shrink: 0;
}

.info-banner p {
    font-family: 'Noto Sans', sans-serif;
    font-size: var(--text-body-sm);
    color: var(--foreground);
    margin: 0;
}

/* ========================================
   Mobile Responsive Styles
   ======================================== */
@media (max-width: 768px) {

    /* Ensure main content takes full width minus collapsed sidebar */
    .app-container {
        position: relative;
    }

    .main-content {
        width: 100%;
        margin-left: 0;
    }
}