/*
 * NemAbo - Clean Professional Theme 2025
 * Optimized for simplicity and readability
 * NO !important declarations - using proper CSS specificity
 */

/* ==========================================================================
   THEME VARIABLES
   ========================================================================== */

:root {
    --app-border-radius: 8px;
    --app-transition: all 0.2s ease;
    --app-primary: #10B981;
    --app-primary-dark: #059669;
    --app-primary-light: #34D399;
    --app-secondary: #F59E0B;
    --app-text-primary: rgba(0,0,0,0.87);
    --app-text-secondary: rgba(0,0,0,0.60);
    --app-text-disabled: rgba(0,0,0,0.38);
    --app-surface: #ffffff;
    --app-background: #f5f5f5;
    --app-divider: rgba(0,0,0,0.12);
}

/* ==========================================================================
   GLOBAL FIXES
   ========================================================================== */

html body {
    font-family: 'Roboto', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* Fix horizontal scrollbar in dropdowns/popovers - NOT on the select input itself! */
.mud-popover,
.mud-popover-provider,
.mud-menu,
.mud-select-popover {
    overflow-x: hidden !important;
}

/* Ensure popover/dropdown content doesn't overflow */
.mud-popover .mud-list,
.mud-menu .mud-list,
.mud-select-popover .mud-list,
.mud-popover-cascading-container {
    overflow-x: hidden !important;
    overflow-y: auto !important;
    max-height: 300px !important;
}

/* Prevent list items from causing horizontal scroll */
.mud-list-item,
.mud-select-item,
.mud-menu-item,
.mud-list-item-text {
    max-width: 100% !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

/* ==========================================================================
   LIGHT THEME FOR PUBLIC PAGES - Using CSS Variables & High Specificity
   ========================================================================== */

/* Override MudBlazor CSS variables globally for public pages */
div.checkout-layout,
div.homepage-container {
    background-color: var(--app-background);
}

/* Login/Register containers should be transparent */
div.login-container,
div.register-container {
    background-color: transparent !important;
}

div.checkout-layout,
div.homepage-container {

    --mud-palette-primary: var(--app-primary);
    --mud-palette-primary-text: var(--app-primary);
    --mud-palette-primary-darken: var(--app-primary-dark);
    --mud-palette-primary-lighten: var(--app-primary-light);

    --mud-palette-secondary: var(--app-secondary);
    --mud-palette-secondary-text: var(--app-secondary);

    --mud-palette-text-primary: var(--app-text-primary);
    --mud-palette-text-secondary: var(--app-text-secondary);
    --mud-palette-text-disabled: var(--app-text-disabled);

    --mud-palette-surface: var(--app-surface);
    --mud-palette-background: var(--app-background);
    --mud-palette-background-grey: #fafafa;
    --mud-palette-drawer-background: var(--app-surface);
    --mud-palette-appbar-background: var(--app-surface);

    --mud-palette-action-default: rgba(0,0,0,0.54);
    --mud-palette-action-disabled: rgba(0,0,0,0.26);

    --mud-palette-divider: var(--app-divider);
    --mud-palette-lines-default: var(--app-divider);
    --mud-palette-lines-inputs: rgba(0,0,0,0.42);
}

/* Cards - white with high specificity */
div.checkout-layout .mud-paper.mud-elevation-1,
div.checkout-layout .mud-paper.mud-elevation-2,
div.checkout-layout .mud-paper.mud-elevation-3,
div.homepage-container .mud-paper {
    background-color: var(--app-surface);
    color: var(--app-text-primary);
}

/* All text - dark with high specificity */
div.checkout-layout .mud-typography.mud-text-primary,
div.login-container .mud-typography.mud-text-primary,
div.register-container .mud-typography.mud-text-primary,
div.homepage-container .mud-typography.mud-text-primary {
    color: var(--app-text-primary);
}

div.checkout-layout .mud-typography.mud-text-secondary,
div.login-container .mud-typography.mud-text-secondary,
div.register-container .mud-typography.mud-text-secondary,
div.homepage-container .mud-typography.mud-text-secondary {
    color: var(--app-text-secondary);
}

/* Input fields with high specificity */
div.checkout-layout .mud-input-outlined.mud-input,
div.login-container .mud-input-outlined.mud-input,
div.register-container .mud-input-outlined.mud-input,
div.homepage-container .mud-input-outlined.mud-input {
    background-color: var(--app-surface);
}

div.checkout-layout .mud-input-slot.mud-input-root,
div.login-container .mud-input-slot.mud-input-root,
div.register-container .mud-input-slot.mud-input-root,
div.homepage-container .mud-input-slot.mud-input-root,
div.checkout-layout input.mud-input-slot,
div.login-container input.mud-input-slot,
div.register-container input.mud-input-slot,
div.homepage-container input.mud-input-slot {
    background-color: var(--app-surface);
    color: var(--app-text-primary);
}

/* Labels with high specificity */
div.checkout-layout label.mud-input-label,
div.login-container label.mud-input-label,
div.register-container label.mud-input-label,
div.homepage-container label.mud-input-label {
    color: var(--app-text-secondary);
}

/* Focused label */
div.checkout-layout .mud-input.mud-focused label.mud-input-label,
div.login-container .mud-input.mud-focused label.mud-input-label,
div.register-container .mud-input.mud-focused label.mud-input-label,
div.homepage-container .mud-input.mud-focused label.mud-input-label {
    color: var(--app-primary);
}

/* Icons with high specificity */
div.checkout-layout .mud-input-adornment.mud-input-adornment-start,
div.checkout-layout .mud-input-adornment.mud-input-adornment-end,
div.login-container .mud-input-adornment,
div.register-container .mud-input-adornment,
div.homepage-container .mud-input-adornment {
    color: rgba(0, 0, 0, 0.54);
}

/* Buttons with high specificity */
div.checkout-layout button.mud-button-filled.mud-button-filled-primary,
div.login-container button.mud-button-filled.mud-button-filled-primary,
div.register-container button.mud-button-filled.mud-button-filled-primary,
div.homepage-container button.mud-button-filled.mud-button-filled-primary {
    background-color: var(--app-primary);
    color: #ffffff;
}

/* Links with high specificity */
div.checkout-layout a.mud-link,
div.login-container a.mud-link,
div.register-container a.mud-link,
div.homepage-container a.mud-link {
    color: var(--app-primary);
}

/* Alerts with high specificity */
div.checkout-layout .mud-alert.mud-alert-standard,
div.login-container .mud-alert.mud-alert-standard,
div.register-container .mud-alert.mud-alert-standard,
div.homepage-container .mud-alert.mud-alert-standard {
    background-color: #ecfdf5;
    color: var(--app-text-primary);
}

/* Dividers with high specificity */
div.checkout-layout .mud-divider.mud-divider-fullwidth,
div.login-container .mud-divider,
div.register-container .mud-divider,
div.homepage-container .mud-divider {
    background-color: var(--app-divider);
}

/* ==========================================================================
   NAVIGATION
   ========================================================================== */

.mud-nav-link {
    border-radius: var(--app-border-radius);
    margin: 4px 8px;
    transition: var(--app-transition);
}

.mud-nav-link.active {
    font-weight: 600;
}

/* ==========================================================================
   CARDS & PAPERS
   ========================================================================== */

.mud-paper {
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

/* ==========================================================================
   STAT CARDS - Nordic Finance Style
   ========================================================================== */

.stat-card.mud-card {
    position: relative;
    overflow: hidden;
    border-radius: 16px !important;
    border: 1px solid var(--mud-palette-divider);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.stat-card.mud-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.15);
}

.stat-card.mud-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #10B981 0%, #34D399 100%);
}

.stat-card .mud-card-content {
    padding: 24px !important;
}

.stat-card .stat-card-icon.mud-icon-root {
    position: absolute;
    top: 20px;
    right: 20px;
    opacity: 0.08;
    font-size: 64px;
    color: #10B981;
}

.stat-card .mud-typography-h4 {
    font-weight: 700;
    letter-spacing: -0.02em;
    margin: 8px 0;
}

.stat-card .mud-typography-subtitle2 {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.6875rem;
}

/* Highlight cards (emerald gradient) */
.highlight-card.mud-paper,
.highlight-card.mud-card {
    background: linear-gradient(135deg, #0F172A 0%, #1E293B 100%) !important;
    color: #F8FAFC !important;
    border-radius: 20px !important;
    border: 1px solid rgba(52, 211, 153, 0.2) !important;
    box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    position: relative;
}

.highlight-card.mud-paper::before,
.highlight-card.mud-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #10B981 0%, #34D399 50%, #6EE7B7 100%);
}

.highlight-card.mud-paper::after,
.highlight-card.mud-card::after {
    content: '';
    position: absolute;
    top: -100px;
    right: -100px;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(52, 211, 153, 0.15) 0%, transparent 70%);
    pointer-events: none;
}

.highlight-card .mud-card-content {
    position: relative;
    z-index: 1;
}

.highlight-card .mud-typography {
    color: #F8FAFC !important;
}

.highlight-card .mud-input-slot {
    background-color: rgba(255, 255, 255, 0.95) !important;
    border-radius: 12px;
    color: #111827 !important;
}

.highlight-card .mud-icon-button {
    color: #F8FAFC !important;
}

/* ==========================================================================
   DATA TABLES
   ========================================================================== */

.mud-table .mud-table-head th.mud-table-cell {
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.mud-table .mud-table-row {
    transition: background-color 0.15s ease;
}

/* ==========================================================================
   FORM INPUTS - Browser autofill fix
   ========================================================================== */

input.mud-input-slot:-webkit-autofill,
input.mud-input-slot:-webkit-autofill:hover,
input.mud-input-slot:-webkit-autofill:focus {
    -webkit-box-shadow: 0 0 0 30px var(--mud-palette-surface) inset;
    -webkit-text-fill-color: var(--mud-palette-text-primary);
}

/* ==========================================================================
   BUTTONS
   ========================================================================== */

.mud-button-root {
    border-radius: var(--app-border-radius);
    transition: var(--app-transition);
}

.mud-button-filled:hover {
    transform: translateY(-1px);
}

/* ==========================================================================
   CHIPS & BADGES
   ========================================================================== */

.mud-chip {
    border-radius: 16px;
    font-weight: 500;
}

/* ==========================================================================
   ALERTS
   ========================================================================== */

.mud-alert {
    border-radius: var(--app-border-radius);
}

/* ==========================================================================
   DIALOGS
   ========================================================================== */

.mud-dialog.mud-dialog-default {
    border-radius: 12px;
}

/* ==========================================================================
   UTILITY CLASSES
   ========================================================================== */

.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }

.text-bold { font-weight: 600; }
.text-medium { font-weight: 500; }

.rounded-lg { border-radius: 12px; }
.rounded-xl { border-radius: 16px; }

/* ==========================================================================
   ACCESSIBILITY
   ========================================================================== */

*:focus-visible {
    outline: 2px solid var(--mud-palette-primary);
    outline-offset: 2px;
}

/* ==========================================================================
   ADMIN LAYOUT - Modern FinTech Design
   ========================================================================== */

/* App Bar - Clean and professional */
.mud-appbar.mud-appbar-fixed-top {
    backdrop-filter: blur(10px);
    background: rgba(var(--mud-palette-primary-rgb), 0.95);
}

/* Drawer/Sidebar - Modern look */
.mud-drawer {
    border-right: 1px solid rgba(0, 0, 0, 0.06);
}

.mud-drawer .mud-navmenu {
    padding: 8px;
}

.mud-drawer .mud-nav-link {
    border-radius: 10px;
    margin: 2px 0;
    padding: 12px 16px;
    transition: all 0.2s ease;
    font-weight: 500;
}

.mud-drawer .mud-nav-link:hover {
    background: rgba(16, 185, 129, 0.08);
}

.mud-drawer .mud-nav-link.active {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.12) 0%, rgba(16, 185, 129, 0.06) 100%);
    color: var(--app-primary);
    font-weight: 600;
}

.mud-drawer .mud-nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 24px;
    background: var(--app-primary);
    border-radius: 0 3px 3px 0;
}

/* ==========================================================================
   ADMIN CARDS - Modern FinTech Style
   ========================================================================== */

/* Base card improvements */
.mud-paper.mud-elevation-1 {
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.06);
}

.mud-paper.mud-elevation-2 {
    border: 1px solid rgba(0, 0, 0, 0.04);
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

.mud-paper.mud-elevation-3 {
    border-radius: 16px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.03);
}

/* Stat cards - Premium look - uses MudBlazor CSS variables for automatic theme switching */
.stat-card.mud-card {
    border: 1px solid var(--mud-palette-lines-default, rgba(0, 0, 0, 0.06));
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    background: var(--mud-palette-surface);
    color: var(--mud-palette-text-primary);
}

.stat-card.mud-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--app-primary) 0%, var(--app-primary-light) 100%);
}

.stat-card .mud-card-content {
    padding: 24px;
}

.stat-card .stat-card-icon.mud-icon-root {
    position: absolute;
    top: 20px;
    right: 20px;
    opacity: 0.08;
    font-size: 64px;
    color: var(--app-primary);
}

/* Highlight card - Dark gradient with emerald accents */
.highlight-card.mud-paper {
    border-radius: 20px;
    background: linear-gradient(135deg, #0F172A 0%, #1E293B 100%);
    color: white;
    border: 1px solid rgba(52, 211, 153, 0.2);
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    position: relative;
}

.highlight-card.mud-paper::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    pointer-events: none;
}

.highlight-card .mud-input-filled {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
}

/* Quick Actions Card */
.mud-card-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.mud-card-header .mud-typography-h6 {
    font-weight: 600;
    font-size: 1rem;
    color: var(--mud-palette-text-primary);
}

/* ==========================================================================
   ADMIN BUTTONS - Modern styling
   ========================================================================== */

/* Primary button - Emerald gradient with white text */
.mud-button-filled.mud-button-filled-primary {
    background: linear-gradient(135deg, #10B981 0%, #059669 100%);
    color: #ffffff;
    border-radius: 10px;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0.01em;
    box-shadow: 0 4px 14px -3px rgba(16, 185, 129, 0.4);
    transition: all 0.2s ease;
}

.mud-button-filled.mud-button-filled-primary .mud-button-label {
    color: #ffffff;
}

.mud-button-filled.mud-button-filled-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px -3px rgba(16, 185, 129, 0.5);
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
}

/* Text buttons */
.mud-button-text.mud-button-text-primary {
    border-radius: 10px;
    font-weight: 500;
    text-transform: none;
}

/* ==========================================================================
   ADMIN TABLES - Clean modern look (using CSS variables for theme support)
   ========================================================================== */

.mud-table {
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--mud-palette-table-lines, rgba(0, 0, 0, 0.06));
    background: var(--mud-palette-background);
}

.mud-table .mud-table-head {
    background: var(--mud-palette-surface);
}

.mud-table .mud-table-head th.mud-table-cell {
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--mud-palette-text-secondary);
    border-bottom: 1px solid var(--mud-palette-table-lines, var(--mud-palette-divider));
    padding: 16px;
    background: var(--mud-palette-surface);
}

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

.mud-table .mud-table-body td.mud-table-cell {
    padding: 16px;
    border-bottom: 1px solid var(--mud-palette-table-lines, var(--mud-palette-divider));
}

.mud-table .mud-table-row:hover {
    background: var(--mud-palette-table-hover, rgba(16, 185, 129, 0.08));
}

.mud-table .mud-table-row:last-child td.mud-table-cell {
    border-bottom: none;
}

.mud-table-striped .mud-table-body .mud-table-row:nth-child(odd) {
    background: var(--mud-palette-table-striped, rgba(0, 0, 0, 0.02));
}

.mud-table-striped .mud-table-body .mud-table-row:nth-child(even) {
    background: var(--mud-palette-background);
}

/* ==========================================================================
   ADMIN CHIPS & BADGES
   ========================================================================== */

.mud-chip {
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.8125rem;
}

.mud-chip.mud-chip-color-success {
    background: rgba(34, 197, 94, 0.12);
    color: #16a34a;
}

.mud-chip.mud-chip-color-error {
    background: rgba(239, 68, 68, 0.12);
    color: #dc2626;
}

.mud-chip.mud-chip-color-warning {
    background: rgba(245, 158, 11, 0.12);
    color: #d97706;
}

.mud-chip.mud-chip-color-info {
    background: rgba(59, 130, 246, 0.12);
    color: #2563eb;
}

/* ==========================================================================
   ADMIN ALERTS
   ========================================================================== */

.mud-alert {
    border-radius: 12px;
}

.mud-alert.mud-alert-filled-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

.mud-alert.mud-alert-filled-error {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.mud-alert.mud-alert-filled-success {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
}

.mud-alert.mud-alert-filled-info {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

/* ==========================================================================
   ADMIN DIALOGS
   ========================================================================== */

.mud-dialog {
    border-radius: 20px;
    overflow: hidden;
}

.mud-dialog .mud-dialog-title {
    font-weight: 600;
    font-size: 1.25rem;
    padding: 24px 24px 16px;
}

.mud-dialog .mud-dialog-content {
    padding: 0 24px 16px;
}

.mud-dialog .mud-dialog-actions {
    padding: 16px 24px 24px;
    gap: 12px;
}

/* ==========================================================================
   ADMIN PROGRESS INDICATORS
   ========================================================================== */

.mud-progress-linear {
    border-radius: 4px;
    overflow: hidden;
}

.mud-progress-linear .mud-progress-linear-bar {
    background: linear-gradient(90deg, var(--app-primary) 0%, var(--app-primary-light) 100%);
}

/* ==========================================================================
   ADMIN TEXT & TYPOGRAPHY
   ========================================================================== */

.grey-text-lighten-1 {
    color: var(--mud-palette-text-secondary);
}

.success-text {
    color: #16a34a;
    font-weight: 500;
}

.error-text {
    color: #dc2626;
    font-weight: 500;
}

.warning-text {
    color: #d97706;
    font-weight: 500;
}

/* Page titles - using CSS variable for theme support */
.mud-typography.mud-typography-h5 {
    font-weight: 700;
    color: var(--mud-palette-text-primary);
    letter-spacing: -0.01em;
}

/* ==========================================================================
   ADMIN FORM INPUTS
   ========================================================================== */

.mud-input-outlined .mud-input-outlined-border {
    border-radius: 10px;
    border-color: #e2e8f0;
    transition: all 0.2s ease;
}

.mud-input-outlined:hover .mud-input-outlined-border {
    border-color: #cbd5e1;
}

.mud-input-outlined.mud-focused .mud-input-outlined-border {
    border-color: var(--app-primary);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

/* ==========================================================================
   ADMIN SELECT/DROPDOWN
   ========================================================================== */

.mud-popover-paper {
    border-radius: 12px;
    box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.mud-list-item {
    border-radius: 8px;
    margin: 2px 4px;
}

/* ==========================================================================
   ADMIN DARK MODE ADJUSTMENTS
   ========================================================================== */

/* Dark mode stat cards - extra specificity if CSS variables don't work */
.mud-theme-dark .stat-card.mud-card,
.mud-theme-dark .stat-card.mud-card.mud-paper {
    background: var(--mud-palette-surface, #1e293b);
    border-color: rgba(255, 255, 255, 0.06);
    color: var(--mud-palette-text-primary, #f1f5f9);
}

.mud-theme-dark .stat-card.mud-card::before {
    background: linear-gradient(90deg, #34D399 0%, #10B981 100%);
}

.mud-theme-dark .mud-paper {
    border-color: rgba(255, 255, 255, 0.06);
}


.mud-theme-dark .mud-card-header {
    border-color: rgba(255, 255, 255, 0.06);
}



/* ==========================================================================
   FORCE STAT CARDS TO USE THEME - Override all previous rules
   ========================================================================== */
.stat-card.mud-card.mud-paper,
.mud-grid .stat-card.mud-card,
.mud-grid-item .stat-card.mud-card {
    background: var(--mud-palette-surface);
    color: var(--mud-palette-text-primary);
}
