﻿html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 0.8rem !important;
}

h1:focus {
    outline: none;
}

a, .btn-link {
    color: #0071c1;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.content {
    padding-top: 1.1rem;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

#blazor-error-ui {
    background: linear-gradient(135deg, #dc3545, #c82333);
    bottom: 0;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.15);
    display: none;
    left: 0;
    padding: 1rem 1.5rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
    color: white;
    font-weight: 500;
    border-top: 3px solid rgba(255, 255, 255, 0.2);
}

#blazor-error-ui::before {
    content: "⚠️";
    font-size: 1.2rem;
    margin-right: 0.75rem;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: bold;
    transition: all 0.2s ease;
}

#blazor-error-ui .dismiss::before {
    content: "×";
    line-height: 1;
}

#blazor-error-ui .dismiss:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-50%) scale(1.1);
}

/* Enhanced reload link styling */
#blazor-error-ui .reload {
    color: white;
    text-decoration: underline;
    font-weight: 600;
    margin-left: 0.5rem;
}

#blazor-error-ui .reload:hover {
    color: #f8f9fa;
    text-decoration: none;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpb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3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred."
}

.instance-selector{
    margin-left: 1.5rem;
}

/* Instance dropdown with fixed height and scroll */
#instance-dropdown .dropdown-menu {
    max-height: 100px !important;
    overflow-y: auto !important;
}

label {
    margin-bottom: 0 !important;
}

.print-label {
    font-size: 20px;
    color: blue;
}

.snackbar-body {
    white-space: pre-wrap !important;
}

.nav-link-padding{
    padding: 5px !important;
}

/*.sidebar {*/
/*    min-height: 100vh !important;*/
/*}*/

/* Modern Navigation Menu Styles */
.modern-sidebar {
    background-color: #f8f9fa;
    height: calc(100vh - 5rem);
    width: 100%;
    overflow-y: auto;
    overflow-x: hidden;
}

.nav-section {
    margin-bottom: 1.5rem;
}

.nav-section-title {
    padding: 0.5rem 1.5rem;
    margin-bottom: 0.5rem;
}

.modern-nav-link {
    display: block;
    padding: 0.75rem 1rem;
    color: #495057;
    text-decoration: none;
    border-radius: 0.375rem;
    margin: 0.25rem 1rem;
    transition: all 0.2s ease-in-out;
    border: none;
    background: transparent;
    width: calc(100% - 2rem);
    cursor: pointer;
    box-sizing: border-box;
}

.modern-nav-link:hover {
    background-color: #e9ecef;
    color: #212529;
}

.modern-nav-link.active {
    background-color: #0d6efd;
    color: white;
}

.modern-nav-link.active .nav-icon {
    color: white;
}

.nav-link-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-icon {
    width: 1.2rem;
    height: 1.2rem;
    margin-right: 0.75rem;
    color: #6c757d;
    flex-shrink: 0;
}

.nav-icon.small {
    width: 1rem;
    height: 1rem;
    margin-right: 0.5rem;
}

.nav-text {
    flex-grow: 1;
    font-weight: 500;
}

.nav-badge {
    margin-left: auto;
    margin-right: 1.5rem;
    font-size: 0.7rem;
}

.expandable-nav {
    cursor: pointer;
    padding: 0.75rem 1rem !important;
}

.expandable-nav.expanded {
    background-color: #e9ecef;
}

.expand-icon {
    width: 1rem;
    height: 1rem;
    color: #6c757d;
    transition: transform 0.2s ease-in-out;
    flex-shrink: 0;
}

.expand-icon.expanded {
    transform: rotate(90deg);
}

.nav-submenu {
    padding-left: 0.5rem;
    border-left: 2px solid #e9ecef;
    margin-left: 1.5rem;
}

.submenu-item {
    font-size: 0.9rem;
    padding: 0.75rem 1rem;
}

.submenu-item .nav-text {
    font-weight: 400;
}

/* DataLinq Logo Styles */
.datalinq-logo svg {
    transition: transform 0.2s ease-in-out;
}

.navbar-brand:hover .datalinq-logo svg {
    transform: scale(1.05);
}

.brand-text h1 {
    background: linear-gradient(45deg, #ffffff, #e3f2fd);
    background-clip: text;
    -webkit-background-clip: text;
}

/* Fix for Blazorise icon alignment */
.modern-nav-link i {
    width: 1.2rem;
    height: 1.2rem;
    margin-right: 0.75rem;
    text-align: center;
    line-height: 1.2rem;
}

/* Enhanced top navigation bar */
.top-row.navbar-dark.bg-primary,
.top-row {
    background: linear-gradient(135deg, #1b6ec2, #0d6efd) !important;
    box-shadow: none;
    height: 5rem;
    border-bottom: none;
}

/* Fix dropdown menu margin caused by component-scoped CSS */
.top-row .dropdown-menu {
    margin-left: 0 !important;
}

.top-row .dropdown-menu .dropdown-item {
    margin-left: 0 !important;
}

/* Document View Modal Tab Styling - Global Override */
.document-view-container .modern-tabs .nav-tabs {
    border-bottom: 1px solid #dee2e6 !important;
    background: #f8f9fa !important;
    border-radius: 0.375rem 0.375rem 0 0 !important;
    margin-bottom: 0 !important;
    height: 48px !important;
    min-height: 48px !important;
}

.document-view-container .modern-tabs .nav-item {
    height: 48px !important;
    min-height: 48px !important;
}

.document-view-container .modern-tabs .nav-link {
    padding: 8px 16px !important;
    font-weight: 500 !important;
    color: #6c757d !important;
    border: none !important;
    background: transparent !important;
    border-bottom: 3px solid transparent !important;
    transition: all 0.2s ease !important;
    height: 48px !important;
    min-height: 48px !important;
    max-height: 48px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    font-size: 0.9rem !important;
    border-radius: 0 !important;
    line-height: 1.2 !important;
    white-space: nowrap !important;
    box-sizing: border-box !important;
}

.document-view-container .modern-tabs .nav-link:hover {
    color: #0d6efd !important;
    background-color: rgba(13, 110, 253, 0.05) !important;
    border-bottom: 3px solid transparent !important;
}

.document-view-container .modern-tabs .nav-link.active {
    color: #0d6efd !important;
    border-bottom: 3px solid #0d6efd !important;
    background-color: rgba(13, 110, 253, 0.05) !important;
    border-top: none !important;
    border-left: none !important;
    border-right: none !important;
}

form .table-fixed-header {
    height: 100% !important;
    max-height: 100% !important;
}

.shadow-sm form {
    height: 100% !important;
}

.shadow-sm:not(.card) div.row {
    margin-top: 1rem !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .nav-section-title {
        padding: 0.5rem 1rem;
    }

    .modern-nav-link {
        margin: 0.25rem 0.75rem;
        padding: 0.5rem 0.75rem;
        width: calc(100% - 1.5rem);
    }

    .nav-submenu {
        margin-left: 1.5rem;
        padding-left: 0.5rem;
    }
}

/* Phase 2.3: Dashboard Visual Hierarchy Styles */
.dashboard-section {
    margin-bottom: 1.5rem;
}

.dashboard-section-header {
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e9ecef;
}

.dashboard-section-header h5 {
    margin-bottom: 0;
    font-weight: 600;
    color: #495057;
}

.dashboard-section-header .section-icon {
    margin-right: 0.5rem;
    font-size: 1.1rem;
}

/* Color-coded card borders by type */
.card-kpi {
    border-left: 3px solid #0d6efd !important;
}

.card-usage {
    border-left: 3px solid #198754 !important;
}

.card-alerts {
    border-left: 3px solid #ffc107 !important;
}

.card-analytics {
    border-left: 3px solid #6f42c1 !important;
}

.card-documents {
    border-left: 3px solid #17a2b8 !important;
}

/* Section backgrounds */
.section-kpi {
    background: linear-gradient(to right, rgba(13, 110, 253, 0.02), transparent);
    border-radius: 0.5rem;
    padding: 1rem;
}

.section-usage {
    background: linear-gradient(to right, rgba(25, 135, 84, 0.02), transparent);
    border-radius: 0.5rem;
    padding: 1rem;
}

.section-alerts {
    background: linear-gradient(to right, rgba(255, 193, 7, 0.02), transparent);
    border-radius: 0.5rem;
    padding: 1rem;
}

/* Hover effects for interactive cards */
.card-hover-lift {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

/* Clickable card styles */
.card-clickable {
    cursor: pointer;
    transition: all 0.2s ease;
}

.card-clickable:hover {
    background-color: #f8f9fa;
    transform: translateY(-1px);
}

.card-clickable:active {
    transform: translateY(0);
}

/* Phase 3.6: Responsive Dashboard Improvements */

/* Tablet breakpoint (768-1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
    .dashboard-header .row {
        flex-wrap: wrap;
    }

    .dashboard-header .col-auto.ms-auto {
        flex-wrap: wrap;
        gap: 0.5rem !important;
    }

    .kpi-card .card-body h4 {
        font-size: 1.1rem;
    }

    .kpi-card .kpi-icon-wrapper {
        width: 40px;
        height: 40px;
    }

    .quick-action-btn {
        font-size: 0.75rem;
        padding: 0.3rem 0.5rem;
    }

    .chart-container-small {
        min-height: 120px;
    }
}

/* Mobile breakpoint (<768px) */
@media (max-width: 767px) {
    /* Stack dashboard header vertically */
    .dashboard-header .row {
        flex-direction: column;
        align-items: flex-start !important;
    }

    .dashboard-header .col-auto.ms-auto {
        margin-left: 0 !important;
        margin-top: 1rem;
        flex-wrap: wrap;
        gap: 0.5rem !important;
        width: 100%;
    }

    /* Stack KPI cards vertically */
    .compact-card {
        margin-bottom: 0.5rem;
    }

    /* Ensure minimum touch target sizes (44px) */
    .btn, button {
        min-height: 44px;
        min-width: 44px;
    }

    .btn-sm, .btn-group-sm > .btn {
        min-height: 38px;
    }

    /* Adjust card padding for mobile */
    .card-body {
        padding: 0.75rem;
    }

    .card-header {
        padding: 0.5rem 0.75rem;
    }

    /* Make charts full width */
    .chart-container-small {
        min-height: 100px;
    }

    /* Stack filters vertically */
    .preset-btn {
        flex: 1 0 calc(50% - 0.25rem);
    }

    /* Improve alert panel on mobile */
    .alert-type-row {
        padding: 0.6rem;
    }

    /* Hide less important elements on mobile */
    .auto-refresh-select {
        display: none;
    }

    /* Full width progress bars */
    .usage-progress-container {
        padding: 0.75rem;
    }

    /* Adjust quick actions layout */
    .quick-action-btn {
        flex: 1 0 calc(50% - 0.5rem);
        justify-content: center;
    }

    /* Navigation improvements for mobile */
    .modern-sidebar {
        height: auto;
        max-height: calc(100vh - 5rem);
    }

    .nav-submenu {
        margin-left: 1rem;
    }
}

/* Small mobile (<480px) */
@media (max-width: 480px) {
    html, body {
        font-size: 0.75rem !important;
    }

    .dashboard-header h2 {
        font-size: 1.25rem;
    }

    .kpi-card h4 {
        font-size: 1rem;
    }

    .preset-btn {
        flex: 1 0 100%;
        margin-bottom: 0.25rem;
    }

    .quick-action-btn {
        flex: 1 0 100%;
    }

    /* Hide health indicator label on very small screens */
    .health-label {
        display: none;
    }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {
    /* Remove hover effects on touch devices */
    .card-hover-lift:hover,
    .card-clickable:hover {
        transform: none;
        box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    }

    /* Add active states instead */
    .card-hover-lift:active,
    .card-clickable:active {
        transform: scale(0.98);
    }

    /* Larger touch targets */
    .clickable-summary-item {
        padding: 0.75rem;
    }

    .alert-type-row {
        padding: 0.75rem;
    }
}

/* Phase 3.1: Collapsible Sidebar Styles */
.sidebar {
    width: 250px;
    transition: width 0.3s ease;
}

.sidebar.collapsed {
    width: 60px;
}

.page.sidebar-collapsed main {
    margin-left: 60px;
}

.page main {
    transition: margin-left 0.3s ease;
}

/* Sidebar toggle button */
.sidebar-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.sidebar-toggle-btn:hover {
    transform: scale(1.05);
}

/* Collapsed sidebar header */
.collapsed-header {
    justify-content: center !important;
    padding: 0.5rem !important;
}

.collapsed-header .container-fluid {
    justify-content: center !important;
}

/* Collapsed sidebar content */
.sidebar-collapsed-content {
    width: 60px;
    overflow-x: hidden;
}

.sidebar-collapsed-content .nav-section-title {
    display: none;
}

.sidebar-collapsed-content .nav-text {
    display: none;
}

.sidebar-collapsed-content .nav-badge {
    display: none;
}

.sidebar-collapsed-content .expand-icon {
    display: none;
}

.sidebar-collapsed-content .modern-nav-link {
    justify-content: center;
    padding: 0.75rem 0.5rem;
    margin: 0.25rem 0.5rem;
    width: calc(100% - 1rem);
}

.sidebar-collapsed-content .nav-link-content {
    justify-content: center;
}

.sidebar-collapsed-content .nav-icon {
    margin-right: 0;
    font-size: 1.2rem;
}

.sidebar-collapsed-content .nav-submenu {
    display: none;
}

/* Tooltip for collapsed sidebar items */
.sidebar-collapsed-content .modern-nav-link {
    position: relative;
}

.sidebar-collapsed-content .modern-nav-link::after {
    content: attr(title);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    background: #333;
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 0.25rem;
    font-size: 0.85rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 1000;
    margin-left: 0.5rem;
}

.sidebar-collapsed-content .modern-nav-link:hover::after {
    opacity: 1;
    visibility: visible;
}

/* Phase 3.2: Navigation Favorites Styles */
.nav-item-with-favorite {
    position: relative;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.nav-item-with-favorite .nav-link {
    flex: 1;
    min-width: 0;
    padding-right: 2rem;
}

.favorite-toggle-btn {
    position: absolute;
    right: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #c0c0c0;
    cursor: pointer;
    padding: 0.25rem;
    opacity: 0.5;
    transition: opacity 0.2s ease, color 0.2s ease, transform 0.2s ease;
    font-size: 0.75rem;
    z-index: 10;
}

.nav-item-with-favorite:hover .favorite-toggle-btn {
    opacity: 1;
    color: #aaa;
}

.favorite-toggle-btn:hover {
    color: #ffc107 !important;
    transform: translateY(-50%) scale(1.15);
}

.favorite-toggle-btn.is-favorite {
    color: #ffc107;
    opacity: 1;
}

.favorite-toggle-btn.is-favorite:hover {
    color: #dc3545;
}

/* Modal Width Fix for Profile Modals */
/* Override Bootstrap's default modal width for connector profile modals */
.modal-dialog.modal-dialog-centered {
    max-width: 95vw !important;
    width: 95vw !important;
}

/* Ensure modal-xl still has a reasonable max-width */
.modal-dialog.modal-xl {
    max-width: 1400px !important;
}