/* Theme Integration CSS - Bridges MudBlazor themes to Bootstrap components */

:root {
    /* Default theme colors (Modern theme light mode) */
    --theme-primary: #594AE2;
    --theme-primary-hover: #4a3ec2;
    --theme-primary-rgb: 89, 74, 226;
    --theme-secondary: #FF4081;
    --theme-secondary-hover: #e63971;
    --theme-success: #4caf50;
    --theme-info: #2196f3;
    --theme-warning: #ff9800;
    --theme-danger: #f44336;
    --theme-light: #f8f9fa;
    --theme-dark: #1e1e2d;
    --theme-text: #212529;
    --theme-bg: #ffffff;
    --theme-card-bg: #ffffff;
    --theme-border: #dee2e6;
}

/* Dark mode colors */
body.dark-mode {
    --theme-primary: #7E6FFF;
    --theme-primary-hover: #6e5fef;
    --theme-primary-rgb: 126, 111, 255;
    --theme-secondary: #FF80AB;
    --theme-secondary-hover: #ef709b;
    --theme-text: #e0e0e0;
    --theme-bg: #1e1e2d;
    --theme-card-bg: #27293d;
    --theme-border: #3a3d5c;
    filter: brightness(0.95);
}

/* Apply theme to Bootstrap buttons */
.btn-primary {
    background-color: var(--theme-primary) !important;
    border-color: var(--theme-primary) !important;
    color: #fff !important;
}

.btn-primary:hover, .btn-primary:focus {
    background-color: var(--theme-primary-hover) !important;
    border-color: var(--theme-primary-hover) !important;
}

.btn-outline-primary {
    color: var(--theme-primary) !important;
    border-color: var(--theme-primary) !important;
}

.btn-outline-primary:hover {
    background-color: var(--theme-primary) !important;
    border-color: var(--theme-primary) !important;
    color: #fff !important;
}

.btn-success {
    background-color: var(--theme-success) !important;
    border-color: var(--theme-success) !important;
}

.btn-outline-success {
    color: var(--theme-success) !important;
    border-color: var(--theme-success) !important;
}

.btn-outline-success:hover {
    background-color: var(--theme-success) !important;
    border-color: var(--theme-success) !important;
    color: #fff !important;
}

.btn-info, .btn-outline-info:hover {
    background-color: var(--theme-info) !important;
    border-color: var(--theme-info) !important;
}

.btn-outline-info {
    color: var(--theme-info) !important;
    border-color: var(--theme-info) !important;
}

.btn-danger {
    background-color: var(--theme-danger) !important;
    border-color: var(--theme-danger) !important;
}

.btn-outline-danger {
    color: var(--theme-danger) !important;
    border-color: var(--theme-danger) !important;
}

.btn-outline-danger:hover {
    background-color: var(--theme-danger) !important;
    border-color: var(--theme-danger) !important;
    color: #fff !important;
}

.btn-warning {
    background-color: var(--theme-warning) !important;
    border-color: var(--theme-warning) !important;
}

/* Apply theme to cards */
.card {
    background-color: var(--theme-card-bg);
    border-color: var(--theme-border);
    color: var(--theme-text);
}

.card-header {
    background-color: var(--theme-light);
    border-bottom-color: var(--theme-border);
    color: var(--theme-text);
}

body.dark-mode .card-header {
    background-color: rgba(0, 0, 0, 0.2);
}

.card.border-primary {
    border-color: var(--theme-primary) !important;
}

.card.border-success {
    border-color: var(--theme-success) !important;
}

.card.border-info {
    border-color: var(--theme-info) !important;
}

.card.border-warning {
    border-color: var(--theme-warning) !important;
}

/* Apply theme to badges */
.badge.bg-primary {
    background-color: var(--theme-primary) !important;
}

.badge.bg-success {
    background-color: var(--theme-success) !important;
}

.badge.bg-info {
    background-color: var(--theme-info) !important;
}

.badge.bg-warning {
    background-color: var(--theme-warning) !important;
}

.badge.bg-danger {
    background-color: var(--theme-danger) !important;
}

.badge.bg-secondary {
    background-color: var(--theme-secondary) !important;
}

/* Apply theme to text colors */
.text-primary {
    color: var(--theme-primary) !important;
}

.text-success {
    color: var(--theme-success) !important;
}

.text-info {
    color: var(--theme-info) !important;
}

.text-warning {
    color: var(--theme-warning) !important;
}

.text-danger {
    color: var(--theme-danger) !important;
}

.text-muted {
    color: rgba(var(--theme-primary-rgb), 0.5) !important;
}

/* Apply theme to forms */
.form-control, .form-select {
    background-color: var(--theme-card-bg);
    border-color: var(--theme-border);
    color: var(--theme-text);
}

.form-control:focus, .form-select:focus {
    border-color: var(--theme-primary);
    box-shadow: 0 0 0 0.2rem rgba(var(--theme-primary-rgb), 0.25);
}

/* Input groups */
.input-group-text {
    background-color: var(--theme-light);
    border-color: var(--theme-border);
    color: var(--theme-text);
}

body.dark-mode .input-group-text {
    background-color: rgba(255, 255, 255, 0.05);
}

.input-group .form-control {
    border-color: var(--theme-border);
}

.input-group .form-control:focus {
    border-color: var(--theme-primary);
    box-shadow: none;
}

.input-group:focus-within .input-group-text {
    border-color: var(--theme-primary);
}

/* Apply theme to tables */
.table {
    color: var(--theme-text);
}

.table-light {
    background-color: var(--theme-light) !important;
    color: var(--theme-text) !important;
}

body.dark-mode .table-light {
    background-color: rgba(255, 255, 255, 0.05) !important;
}

.table-hover tbody tr:hover {
    background-color: rgba(var(--theme-primary-rgb), 0.1);
}

.table thead th {
    background-color: var(--theme-light);
    color: var(--theme-text);
    border-color: var(--theme-border);
}

body.dark-mode .table thead th {
    background-color: rgba(255, 255, 255, 0.05);
}

.table td, .table th {
    border-color: var(--theme-border);
}

/* Apply theme to alerts */
.alert-primary {
    background-color: rgba(var(--theme-primary-rgb), 0.1);
    border-color: var(--theme-primary);
    color: var(--theme-primary);
}

.alert-success {
    background-color: rgba(76, 175, 80, 0.1);
    border-color: var(--theme-success);
    color: var(--theme-success);
}

.alert-info {
    background-color: rgba(33, 150, 243, 0.1);
    border-color: var(--theme-info);
    color: var(--theme-info);
}

.alert-warning {
    background-color: rgba(255, 152, 0, 0.1);
    border-color: var(--theme-warning);
    color: var(--theme-warning);
}

.alert-danger {
    background-color: rgba(244, 67, 54, 0.1);
    border-color: var(--theme-danger);
    color: var(--theme-danger);
}

/* Apply theme to nav tabs */
.nav-tabs .nav-link.active {
    color: var(--theme-primary);
    border-bottom-color: var(--theme-primary);
}

.nav-tabs .nav-link:hover {
    color: var(--theme-primary);
}

/* Apply theme to progress bars */
.progress-bar {
    background-color: var(--theme-primary);
}

/* Apply theme to pagination */
.page-item.active .page-link {
    background-color: var(--theme-primary);
    border-color: var(--theme-primary);
}

.page-link {
    color: var(--theme-primary);
}

.page-link:hover {
    color: var(--theme-primary-hover);
    background-color: rgba(var(--theme-primary-rgb), 0.1);
}

/* Apply theme to list groups */
.list-group-item.active {
    background-color: var(--theme-primary);
    border-color: var(--theme-primary);
}

/* Apply theme to spinners */
.spinner-border {
    border-color: rgba(var(--theme-primary-rgb), 0.2);
    border-right-color: var(--theme-primary);
}

.spinner-border.text-primary {
    border-right-color: var(--theme-primary);
}

/* Dark mode body background */
body.dark-mode {
    background-color: var(--theme-bg);
    color: var(--theme-text);
}

/* Dark mode container */
body.dark-mode .container-fluid {
    background-color: var(--theme-bg);
}

/* Dark mode modal */
body.dark-mode .modal-content {
    background-color: var(--theme-card-bg);
    color: var(--theme-text);
}

body.dark-mode .modal-header {
    border-bottom-color: var(--theme-border);
}

body.dark-mode .modal-footer {
    border-top-color: var(--theme-border);
}

/* Dark mode dropdown */
body.dark-mode .dropdown-menu {
    background-color: var(--theme-card-bg);
    border-color: var(--theme-border);
}

body.dark-mode .dropdown-item {
    color: var(--theme-text);
}

body.dark-mode .dropdown-item:hover {
    background-color: rgba(var(--theme-primary-rgb), 0.1);
}

/* Fix container-fluid inside MudContainer to prevent layout shifts */
.mud-main-content .container-fluid {
    max-width: 100%;
    padding-left: 0;
    padding-right: 0;
    overflow-x: hidden;
}

/* Ensure modals don't cause horizontal scroll */
.modal-dialog {
    max-width: min(800px, calc(100vw - 2rem));
}

.modal-lg {
    max-width: min(992px, calc(100vw - 2rem));
}

/* Prevent content from causing horizontal scroll */
body {
    overflow-x: hidden;
}

.mud-layout {
    overflow-x: hidden;
}
