/* ══════════════════════════════════════════════════════
   SAP Excel Analyzer - shadcn/Berry-inspired Theme
   MudBlazor overrides for minimal, modern design
   ══════════════════════════════════════════════════════ */

html, body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── Elevation: Replace Material shadows with subtle ones ── */
:root {
    --mud-elevation-0: none;
    --mud-elevation-1: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --mud-elevation-2: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --mud-elevation-3: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --mud-elevation-4: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
}

.mud-elevation-1, .mud-elevation-2, .mud-elevation-3, .mud-elevation-4,
.mud-elevation-5, .mud-elevation-6, .mud-elevation-7, .mud-elevation-8 {
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1) !important;
}

/* ── Top Bar ── */
.app-topbar {
    border-bottom: 1px solid var(--mud-palette-lines-default) !important;
    box-shadow: none !important;
    background: var(--mud-palette-surface) !important;
    color: var(--mud-palette-text-primary) !important;
}

.topbar-search {
    display: flex;
    align-items: center;
    background: var(--mud-palette-background);
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 0.5rem;
    padding: 0.35rem 0.75rem;
    margin-left: 1rem;
    min-width: 200px;
}

.topbar-search .search-icon {
    color: var(--mud-palette-text-secondary);
    margin-right: 0.5rem;
    font-size: 1rem;
}

.topbar-search .search-input {
    border: none;
    outline: none;
    background: transparent;
    font-family: inherit;
    font-size: 0.8125rem;
    color: var(--mud-palette-text-primary);
    width: 100%;
}

.topbar-search .search-input::placeholder {
    color: var(--mud-palette-text-secondary);
}

.user-avatar-topbar {
    width: 32px !important;
    height: 32px !important;
    margin-left: 0.5rem;
}

/* ── Sidebar ── */
.sidebar {
    border-right: 1px solid var(--mud-palette-lines-default) !important;
    box-shadow: none !important;
}

.sidebar .mud-drawer-content {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.sidebar-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 0;
}

/* Logo: h-16 (64px) with border-bottom, matching Python BerryLayout */
.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0 1.5rem;
    height: 64px;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}

.sidebar-logo-text {
    font-size: 1.125rem;
    font-weight: 700;
    color: #111827;
    letter-spacing: -0.01em !important;
}

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

/* Section labels: Python uses text-[11px] font-medium text-gray-400 uppercase tracking-wider */
.nav-section-label {
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.05em !important;
    color: #9ca3af;
    padding: 0 1rem 0.375rem;
    text-transform: uppercase;
}

/* Spacing between sections */
.nav-section-label:not(:first-child) {
    margin-top: 1.25rem;
}

/* Nav items: Python uses px-4 py-2.5 rounded-lg text-[13px] font-medium */
.nav-menu .mud-nav-link {
    border-radius: 0.5rem !important;
    margin: 1px 0;
    font-size: 0.8125rem !important;
    font-weight: 500 !important;
    color: #4b5563 !important;
    min-height: 40px !important;
    padding: 0.375rem 1rem !important;
    transition: all 0.2s ease !important;
}

.nav-menu .mud-nav-link:hover {
    background: #f3f4f6 !important;
    color: #111827 !important;
}

/* Active state: Python uses bg-berry-primary-light text-berry-primary */
.nav-menu .mud-nav-link.active {
    background: rgba(124, 58, 237, 0.08) !important;
    color: #7c3aed !important;
    font-weight: 500 !important;
}

.nav-menu .mud-nav-link .mud-nav-link-text {
    font-size: 0.8125rem;
}

.nav-menu .mud-nav-link .mud-icon-root {
    font-size: 1.125rem !important;
}

.nav-menu .mud-nav-group .mud-nav-group-text {
    font-size: 0.8125rem;
    font-weight: 500;
}

/* Sub-items (admin, dept) — Python uses pl-7 pr-3 py-2 text-[13px] text-gray-500 with 3.5x3.5 icons */
.nav-menu .mud-nav-group .mud-collapse .mud-nav-link {
    padding-left: 1.75rem !important;
    padding-right: 0.75rem !important;
    font-size: 0.8125rem !important;
    font-weight: 400 !important;
    color: #6b7280 !important;
    min-height: 36px !important;
}

.nav-menu .mud-nav-group .mud-collapse .mud-nav-link:hover {
    color: #374151 !important;
    background: #f3f4f6 !important;
}

.nav-menu .mud-nav-group .mud-collapse .mud-nav-link.active {
    color: #7c3aed !important;
    background: rgba(124, 58, 237, 0.08) !important;
    font-weight: 500 !important;
}

.nav-menu .mud-nav-group .mud-collapse .mud-nav-link .mud-icon-root {
    font-size: 0.875rem !important;
}

/* User card at sidebar bottom */
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--mud-palette-lines-default);
    margin-top: auto;
}

.sidebar-user-info {
    display: flex;
    flex-direction: column;
}

.sidebar-user-name {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--mud-palette-text-primary);
}

.sidebar-user-role {
    font-size: 0.6875rem;
    color: var(--mud-palette-text-secondary);
}

.sidebar-footer {
    text-align: center;
    font-size: 0.6875rem;
    color: var(--mud-palette-text-secondary);
    padding: 0.375rem 1.25rem 0.625rem;
    opacity: 0.7;
}

/* ── Main Content ── */
.main-content {
    background: var(--mud-palette-background) !important;
}

/* ── Buttons: Remove Material uppercase, reduce padding ── */
.mud-button-root {
    text-transform: none !important;
    letter-spacing: 0 !important;
    font-weight: 500 !important;
    border-radius: 0.5rem !important;
}

.mud-button-label {
    text-transform: none !important;
}

.mud-button-filled {
    box-shadow: none !important;
}

.mud-button-filled:hover {
    box-shadow: none !important;
    filter: brightness(0.95);
}

.mud-button-outlined {
    border-width: 1px !important;
}

/* ── Cards: Subtle borders, less shadow ── */
.mud-card {
    border: 1px solid var(--mud-palette-lines-default) !important;
    border-radius: 0.75rem !important;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05) !important;
}

.mud-card:hover {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1) !important;
}

/* ── Paper ── */
.mud-paper {
    border-radius: 0.75rem !important;
}

/* ── Tables: Clean, minimal ── */
.mud-table {
    border: 1px solid var(--mud-palette-lines-default) !important;
    border-radius: 0.5rem !important;
    overflow: hidden;
}

.mud-table .mud-table-head .mud-table-cell {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--mud-palette-text-secondary);
    background: var(--mud-palette-background);
    border-bottom: 1px solid var(--mud-palette-lines-default);
    padding: 0.6rem 1rem;
}

.mud-table .mud-table-body .mud-table-cell {
    font-size: 0.8125rem;
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--mud-palette-divider-light);
}

.mud-table .mud-table-body .mud-table-row:hover {
    background: var(--mud-palette-background) !important;
}

.mud-table-container {
    overflow-x: auto;
}

/* ── Chips/Badges ── */
.mud-chip {
    border-radius: 0.375rem !important;
    font-size: 0.6875rem !important;
    font-weight: 600 !important;
    height: auto !important;
    padding: 0.15rem 0.5rem !important;
}

/* ── Tabs: Underline style ── */
.mud-tabs .mud-tab {
    text-transform: none !important;
    font-weight: 400;
    font-size: 0.8125rem;
    letter-spacing: 0 !important;
    min-width: auto !important;
    padding: 0.5rem 1rem !important;
}

.mud-tabs .mud-tab.mud-tab-active {
    font-weight: 600;
    color: var(--mud-palette-primary);
}

/* ── Inputs: Clean outlined style ── */
.mud-input-outlined .mud-input-outlined-border {
    border-radius: 0.5rem !important;
    border-width: 1px !important;
}

.mud-input.mud-input-outlined:hover .mud-input-outlined-border {
    border-width: 1px !important;
}

/* ── Dialogs ── */
.mud-dialog {
    border-radius: 0.75rem !important;
}

/* ── Alerts ── */
.mud-alert {
    border-radius: 0.5rem !important;
}

/* ── Snackbar ── */
.mud-snackbar {
    border-radius: 0.5rem !important;
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.25);
}

/* ── Department card hover ── */
.department-card {
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    cursor: pointer;
}

.department-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
}

/* ── Chat message animations ── */
.chat-message {
    animation: fadeIn 0.2s ease-in;
}

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

/* ── Stat cards (hero style) ── */
.stat-card {
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 0.75rem;
    padding: 1.25rem;
    background: var(--mud-palette-surface);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.stat-card .stat-label {
    font-size: 0.75rem;
    color: var(--mud-palette-text-secondary);
    margin-bottom: 0.25rem;
}

.stat-card .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--mud-palette-text-primary);
}

.stat-card .stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Hero banner (purple gradient) ── */
.hero-banner {
    background: linear-gradient(135deg, #7c3aed 0%, #8b5cf6 40%, #a78bfa 100%);
    border-radius: 0.75rem;
    padding: 1.5rem 2rem;
    color: white;
    position: relative;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.hero-banner .hero-circle {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
}

.hero-banner .hero-circle-1 {
    width: 200px; height: 200px;
    top: -60px; right: -40px;
}

.hero-banner .hero-circle-2 {
    width: 120px; height: 120px;
    bottom: -30px; right: 20%;
}

.hero-banner h1, .hero-banner h2, .hero-banner h3 {
    color: white;
    position: relative;
    z-index: 1;
}

.hero-banner p {
    color: rgba(255, 255, 255, 0.85);
    position: relative;
    z-index: 1;
}

/* ── Print styles ── */
@media print {
    .mud-drawer, .mud-appbar, .sidebar { display: none !important; }
    .mud-main-content { margin: 0 !important; padding: 0 !important; }
}

/* ── Blazor error UI ── */
#blazor-error-ui {
    background: lightyellow;
    bottom: 0; left: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    padding: 0.6rem 1.25rem 0.7rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}
