/* Mobile scaling: refined for modern high-resolution devices like S25 Ultra */
@media (max-width: 359px) {
    html {
        font-size: 13px !important;
    }
}

@media (min-width: 360px) and (max-width: 599px) {
    html {
        font-size: 14.5px !important;
        /* Improved readability for large phones */
    }
}

/* Tablet scaling */
@media (min-width: 600px) and (max-width: 959px) {
    html {
        font-size: 15.5px !important;
    }
}

/* Modern Glassmorphism Styles extracted from Home.razor */
.glass-panel {
    background: rgba(var(--mud-palette-surface-rgb), 0.4) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2);
}

.inner-glass-panel {
    background: rgba(var(--mud-palette-surface-rgb), 0.4) !important;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
    box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.1);
}

.bg-glass-dark {
    background: rgba(0, 0, 0, 0.2) !important;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

@keyframes floatOrb {
    0% {
        transform: translate(0, 0) scale(1);
    }

    33% {
        transform: translate(50px, -50px) scale(1.1);
    }

    66% {
        transform: translate(-30px, 40px) scale(0.9);
    }

    100% {
        transform: translate(0, 0) scale(1);
    }
}

.glow-orb {
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    filter: blur(100px);
    z-index: -1;
    pointer-events: none;
    animation: floatOrb 30s ease-in-out infinite;
}

.glow-orb:nth-child(2) {
    animation-delay: -15s;
    animation-direction: reverse;
}

/* Feature cards specific - might be useful on other pages too */
.feature-card {
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.feature-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3);
    border-color: rgba(var(--mud-palette-primary-rgb), 0.3) !important;
}

.gradient-text {
    background: linear-gradient(135deg, var(--mud-palette-primary), var(--mud-palette-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ====== GLOBAL UI COMPONENT OVERRIDES ====== */

/* 1. Sidebar (MudDrawer) */
.mud-drawer {
    background: rgba(var(--mud-palette-surface-rgb), 0.5) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border-right: 1px solid rgba(255, 255, 255, 0.05) !important;
}

/* 2. Modals (MudDialog) */
.mud-dialog {
    background: rgba(var(--mud-palette-surface-rgb), 0.6) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 24px !important;
    /* Matches rounded-xl */
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25) !important;
}

.mud-dialog-title,
.mud-dialog-content,
.mud-dialog-actions {
    background: transparent !important;
}

/* 3. Buttons (MudButton) - Targeting primary/filled ones */
.mud-button-filled.mud-button-filled-primary,
.mud-button-filled.mud-button-filled-secondary,
.mud-button-filled.mud-button-filled-success,
.mud-button-filled.mud-button-filled-info {
    border-radius: 50px !important;
    /* Pill shape */
    box-shadow: 0 10px 20px -5px rgba(0, 0, 0, 0.25) !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease !important;
}

.mud-button-filled.mud-button-filled-primary:hover,
.mud-button-filled.mud-button-filled-secondary:hover,
.mud-button-filled.mud-button-filled-success:hover,
.mud-button-filled.mud-button-filled-info:hover {
    transform: scale(1.03) !important;
    box-shadow: 0 15px 25px -5px rgba(0, 0, 0, 0.35) !important;
}

/* Outlined Buttons */
.mud-button-outlined {
    border-radius: 50px !important;
    transition: transform 0.2s ease !important;
}

.mud-button-outlined:hover {
    transform: scale(1.03) !important;
}

/* 4. Tables (MudTable / MudDataGrid) */
.mud-table {
    background: transparent !important;
    box-shadow: none !important;
}

.mud-table-container,
.mud-table-head,
.mud-table-row {
    background: transparent !important;
}

.mud-table-root .mud-table-head .mud-table-cell {
    background: rgba(var(--mud-palette-surface-rgb), 0.2) !important;
    border-bottom: 1px solid rgba(var(--mud-palette-divider-rgb), 0.3) !important;
    font-weight: 700 !important;
}

.mud-table-root .mud-table-body .mud-table-row:hover {
    background: rgba(var(--mud-palette-action-default-hover-rgb), 0.05) !important;
}

.mud-table-cell {
    border-bottom: 1px solid rgba(var(--mud-palette-divider-rgb), 0.1) !important;
}

/* Cards containing tables should not have double padding/shadows if inside glass-panel */
.glass-panel .mud-table {
    margin: 0 !important;
}


/* 5. Tabs (MudTabs) */
.mud-tabs {
    background: rgba(var(--mud-palette-surface-rgb), 0.4) !important;
    backdrop-filter: blur(16px) !important;
    -webkit-backdrop-filter: blur(16px) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 16px !important;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2) !important;
    overflow: hidden !important;
}

/* The tab bar (header) itself */
.mud-tabs-toolbar {
    background: rgba(var(--mud-palette-surface-rgb), 0.2) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
}

/* The inner area where tab buttons are */
.mud-tabs-toolbar-inner {
    background: transparent !important;
}

/* Individual Tab Button */
.mud-tab {
    background: transparent !important;
    transition: all 0.3s ease !important;
    margin: 4px 2px !important;
    border-radius: 8px !important;
    /* Slight rounding for tab button */
}

/* Active Tab Button */
.mud-tab.mud-active {
    background: rgba(var(--mud-palette-primary-rgb), 0.15) !important;
    /* Semi-transparent background for active tab */
    color: var(--mud-palette-primary) !important;
}

/* The active indicator line (keep logic, adapt color) */
.mud-tab-slider {
    background-color: var(--mud-palette-primary) !important;
    height: 3px !important;
    border-radius: 3px 3px 0 0 !important;
}

/* Tab Panels Container */
.mud-tabs-panels {
    background: transparent !important;
    border: none !important;
}

/* 6. Cards (MudCard) - Used in Index pages for listing widgets */
.mud-card:not(.mud-theme-primary):not(.mud-theme-secondary):not(.mud-theme-info):not(.mud-theme-success):not(.mud-theme-warning):not(.mud-theme-error):not(.mud-theme-dark) {
    background: rgba(var(--mud-palette-surface-rgb), 0.3) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 16px !important;
    /* Make cards rounded globally */
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2) !important;
    transition: all 0.3s ease !important;
}

.mud-card:hover {
    background: rgba(var(--mud-palette-surface-rgb), 0.4) !important;
    transform: translateY(-4px) !important;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3) !important;
    border-color: rgba(var(--mud-palette-primary-rgb), 0.3) !important;
}

.mud-card-header,
.mud-card-content,
.mud-card-actions {
    background: transparent !important;
}

/* 7. Expansion Panels (MudExpansionPanels) */
.mud-expansion-panels {
    background: transparent !important;
    box-shadow: none !important;
}

.mud-expand-panel {
    background: rgba(var(--mud-palette-surface-rgb), 0.3) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 12px !important;
    margin-bottom: 8px !important;
    /* Spacing between panels */
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1) !important;
    transition: all 0.3s ease !important;
}

.mud-expand-panel::before {
    display: none !important;
    /* Remove the default top border on expanded panels in MudBlazor */
}

.mud-expand-panel:hover {
    background: rgba(var(--mud-palette-surface-rgb), 0.4) !important;
    border-color: rgba(var(--mud-palette-primary-rgb), 0.3) !important;
}

.mud-expand-panel .mud-expand-panel-header {
    background: transparent !important;
    border-bottom: 1px solid transparent !important;
    transition: border-bottom 0.3s ease !important;
}

.mud-expand-panel.mud-panel-expanded .mud-expand-panel-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
}

.mud-expand-panel .mud-expand-panel-content {
    background: transparent !important;
}

/* 8. Popovers & Menus (MudPopover / MudMenu) */
.mud-popover.mud-paper {
    background: rgba(var(--mud-palette-surface-rgb), 0.6) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 16px !important;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3) !important;
}

.mud-list.mud-menu-list {
    background: transparent !important;
}

.mud-menu-item {
    transition: all 0.2s ease !important;
}

.mud-menu-item:hover {
    background: rgba(var(--mud-palette-action-default-hover-rgb), 0.1) !important;
}

/* 9. Collapse (MudCollapse) */
.mud-collapse-container {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

/* Enhancing inner panels within collapse for better integration */
.mud-collapse-entered .inner-glass-panel {
    background: rgba(var(--mud-palette-surface-rgb), 0.2) !important;
    backdrop-filter: blur(10px) !important;
    -webkit-backdrop-filter: blur(10px) !important;
    border-radius: 0 0 12px 12px !important;
    border-top: none !important;
}
