/* Global polish layer: keeps existing UI structure, improves consistency/quality. */

:root {
    --ai-bg: #f6f8fc;
    --ai-surface: #ffffff;
    --ai-surface-soft: #f8fafc;
    --ai-border: #e2e8f0;
    --ai-text: #0f172a;
    --ai-muted: #64748b;
    --ai-primary: #2563eb;
    --ai-primary-soft: #dbeafe;
    --ai-shadow-sm: 0 6px 18px rgba(15, 23, 42, 0.06);
    --ai-shadow-md: 0 14px 34px rgba(15, 23, 42, 0.08);
    --ai-radius-lg: 18px;
    --ai-radius-md: 12px;
}

body[class*="route-"] {
    color: var(--ai-text);
    background:
        radial-gradient(1100px 500px at -10% -10%, rgba(37, 99, 235, 0.08), transparent 60%),
        radial-gradient(800px 380px at 110% -5%, rgba(14, 165, 233, 0.06), transparent 65%),
        var(--ai-bg);
}

body[class*="route-"] #wrapper,
body[class*="route-"] .dashboard-container,
body[class*="route-"] .dashboard-content-container {
    background: transparent;
}

body[class*="route-"] .modern-dashboard,
body[class*="route-"] .panel-card,
body[class*="route-"] .view-header-card,
body[class*="route-"] .info-card,
body[class*="route-"] .info-card-premium,
body[class*="route-"] .form-wrapper-premium,
body[class*="route-"] .form-container-premium,
body[class*="route-"] .table-card,
body[class*="route-"] .search-wrapper,
body[class*="route-"] .action-search-wrapper,
body[class*="route-"] .assembly-search-wrapper,
body[class*="route-"] .city-search-wrapper,
body[class*="route-"] .company-search-wrapper,
body[class*="route-"] .contract-search-wrapper,
body[class*="route-"] .device-search-wrapper,
body[class*="route-"] .device-info-search,
body[class*="route-"] .history-search-wrapper,
body[class*="route-"] .location-search-wrapper,
body[class*="route-"] .log-search-wrapper,
body[class*="route-"] .message-search-wrapper,
body[class*="route-"] .model-search-wrapper,
body[class*="route-"] .setting-search-wrapper,
body[class*="route-"] .user-search-wrapper {
    border-color: var(--ai-border) !important;
}

body[class*="route-"] .view-header-card,
body[class*="route-"] .info-card,
body[class*="route-"] .info-card-premium,
body[class*="route-"] .form-wrapper-premium,
body[class*="route-"] .form-container-premium,
body[class*="route-"] .table-card {
    background: var(--ai-surface);
    border-radius: var(--ai-radius-lg);
    box-shadow: var(--ai-shadow-sm);
    transition: box-shadow 0.25s ease, transform 0.25s ease;
}

body[class*="route-"] .view-header-card:hover,
body[class*="route-"] .info-card:hover,
body[class*="route-"] .info-card-premium:hover,
body[class*="route-"] .table-card:hover {
    box-shadow: var(--ai-shadow-md);
}

body[class*="route-"] .page-header-bar h1,
body[class*="route-"] .page-header-bar h2,
body[class*="route-"] .page-header-modern h1,
body[class*="route-"] .header-title-group h2,
body[class*="route-"] .action-title-group h2,
body[class*="route-"] .app-title-group h2,
body[class*="route-"] .assembly-title-group h2,
body[class*="route-"] .company-title-area h2,
body[class*="route-"] .device-title-group h2 {
    color: var(--ai-text) !important;
    letter-spacing: -0.4px !important;
}

body[class*="route-"] .small,
body[class*="route-"] .subtitle-text,
body[class*="route-"] .search-label-mini,
body[class*="route-"] .counter-label {
    color: var(--ai-muted) !important;
}

body[class*="route-"] .table,
body[class*="route-"] .modern-grid,
body[class*="route-"] .modern-table,
body[class*="route-"] .modern-detail {
    border-radius: 14px;
    overflow: hidden;
}

body[class*="route-"] .modern-grid thead th,
body[class*="route-"] .modern-table thead th {
    background: var(--ai-surface-soft) !important;
    border-bottom-color: var(--ai-border) !important;
}

body[class*="route-"] .modern-grid tbody tr:last-child td,
body[class*="route-"] .modern-table tbody tr:last-child td,
body[class*="route-"] .modern-detail tbody tr:last-child td {
    border-bottom: none !important;
}

body[class*="route-"] .btn,
body[class*="route-"] [class*="btn-"] {
    transition: all 0.2s ease;
}

body[class*="route-"] .btn-action-premium,
body[class*="route-"] .btn-create-premium,
body[class*="route-"] .btn-create-modern,
body[class*="route-"] .btn-search-premium,
body[class*="route-"] .btn-save-action,
body[class*="route-"] .btn-save-device,
body[class*="route-"] .btn-save-user,
body[class*="route-"] .btn-save-company {
    border-radius: 12px;
}

body[class*="route-"] .btn-action-premium:hover,
body[class*="route-"] .btn-create-premium:hover,
body[class*="route-"] .btn-create-modern:hover,
body[class*="route-"] .btn-search-premium:hover {
    transform: translateY(-1px);
}

body[class*="route-"] .status-pill,
body[class*="route-"] .status-badge,
body[class*="route-"] .badge-modern,
body[class*="route-"] .toggle-status-btn,
body[class*="route-"] .version-tag {
    border-radius: 999px !important;
}

body[class*="route-"] .form-control,
body[class*="route-"] .select2-container--default .select2-selection--single,
body[class*="route-"] .select2-selection,
body[class*="route-"] textarea.form-control {
    border-radius: var(--ai-radius-md) !important;
}

body[class*="route-"] .form-control:focus,
body[class*="route-"] .select2-container--default.select2-container--focus .select2-selection--single,
body[class*="route-"] .select2-container--default .select2-selection--single:focus {
    border-color: var(--ai-primary) !important;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.14) !important;
}

body[class*="route-"] .pagination .page-link {
    border-radius: 10px !important;
}

body[class*="route-"] .pagination .active .page-link {
    background: var(--ai-primary) !important;
    border-color: var(--ai-primary) !important;
}

/* Subtle page entry polish */
body[class*="route-"] .dashboard-content-container {
    animation: ai-fade-up 220ms ease-out;
}

@keyframes ai-fade-up {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile tune */
@media (max-width: 992px) {
    body[class*="route-"] .dashboard-content-container {
        padding: 14px !important;
    }

    body[class*="route-"] .view-header-card,
    body[class*="route-"] .info-card,
    body[class*="route-"] .info-card-premium,
    body[class*="route-"] .form-wrapper-premium,
    body[class*="route-"] .form-container-premium {
        border-radius: 14px;
    }
}

/* Header cleanup */
#header-container {
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(14px);
    box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06);
}

#header {
    border-bottom: 1px solid rgba(226, 232, 240, 0.9);
}

#header .header__f {
    min-height: 84px;
    gap: 20px;
}

#header .left-side,
#header .right-side {
    min-width: 0;
    gap: 14px !important;
}

#header .header-widget {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 52px;
    border: none !important;
    border-radius: 16px;
    background: transparent;
    box-shadow: none;
    padding: 0 14px;
}

#header .header-widget.pr-3 {
    padding-right: 14px !important;
}

#header .left-sidebar-btn,
#header .right-sidebar-btn,
#header #fullscreen-button {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: #335783;
    border-radius: 12px;
}

#header .left-sidebar-btn:hover,
#header .right-sidebar-btn:hover,
#header #fullscreen-button:hover {
    background: rgba(37, 99, 235, 0.09);
    color: #1d4ed8;
}

#header .left-sidebar-btn i,
#header .right-sidebar-btn i {
    font-size: 22px !important;
    line-height: 1;
}

#header #logo {
    display: flex;
    align-items: center;
    min-height: 56px;
    padding-left: 20px !important;
    margin-left: 2px;
    border-left: 1px solid rgba(226, 232, 240, 0.95) !important;
}

#header #logo img {
    width: 116px;
    max-width: 100%;
    height: auto;
}

#header #navigation {
    margin-left: 10px !important;
}

#header .language-selector {
    display: flex;
    margin: 0;
}

#header .language-selector > li {
    list-style: none;
}

#header .language-selector > li > a {
    min-height: 52px;
    padding: 10px 18px;
    display: inline-flex !important;
    align-items: center;
    gap: 10px;
    border: none;
    border-radius: 18px;
    background: #fff;
    box-shadow: none;
    white-space: nowrap;
}

#header .language-selector > li > a img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
}

#header .language-selector .dropdown-nav {
    min-width: 190px;
    margin-top: 10px;
    border-radius: 16px;
    border: 1px solid rgba(226, 232, 240, 0.92);
    box-shadow: 0 18px 36px rgba(15, 23, 42, 0.12);
}

#header .header-notifications-trigger > a {
    min-height: 52px;
    padding: 8px 10px !important;
    border: none;
    background: transparent !important;
    box-shadow: none !important;
}

#header .user-avatar {
    flex: 0 0 auto;
}

#header .user-name {
    max-width: 160px !important;
    font-size: 14px !important;
    line-height: 1.25;
}

#header .header-notifications-dropdown {
    border-radius: 18px;
    border: none;
    box-shadow: 0 18px 38px rgba(15, 23, 42, 0.1);
}

/* Sidebar cleanup */
.dashboard-sidebar {
    background: rgba(255, 255, 255, 0.98);
    border-right: 1px solid rgba(226, 232, 240, 0.9);
    box-shadow: 18px 0 40px rgba(15, 23, 42, 0.04);
}


.dashboard-nav ul:before {
    padding: 0 28px;
    margin-bottom: 12px;
    color: #8aa0ba;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.dashboard-nav ul li {
    margin: 4px 14px;
    border-radius: 18px;
    overflow: hidden;
}

.dashboard-nav ul li > a {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 56px;
    padding: 14px 1px !important;
    color: #475569;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.25;
    border-radius: 18px;
}

.dashboard-nav ul li > a:hover,
.dashboard-nav ul li > a.current,
.dashboard-nav ul li.active-submenu > a {
    background: linear-gradient(180deg, rgba(239, 246, 255, 0.98), rgba(219, 234, 254, 0.88));
    color: #163a63;
}

.dashboard-nav ul li > a i {
    width: 22px;
    min-width: 22px;
    padding-right: 0;
    font-size: 21px;
    line-height: 1;
    color: #708399;
    top: 0;
}

.dashboard-nav ul li > a:hover i,
.dashboard-nav ul li > a.current i,
.dashboard-nav ul li.active-submenu > a i {
    color: #214f8c;
}

.dashboard-nav ul li > a:after {
    display: none !important;
    content: none !important;
}

.dashboard-nav ul li > a.has-submenu {
    position: relative;
}

.dashboard-nav ul li > a.has-submenu::before {
    content: "";
    width: 10px;
    height: 10px;
    border-right: 2px solid #9aa9bb;
    border-bottom: 2px solid #9aa9bb;
    transform: rotate(45deg);
    transition: transform 0.22s ease, border-color 0.22s ease;
}

.dashboard-nav ul li > a.has-submenu:hover::before,
.dashboard-nav ul li.active-submenu > a.has-submenu::before {
    border-color: #2563eb;
}

.dashboard-nav ul li.active-submenu > a.has-submenu::before {
    transform: rotate(225deg);
}

.dashboard-nav ul li ul {
    padding: 4px 12px 14px 14px !important;
    margin-top: 0 !important;
}

.dashboard-nav ul li ul li {
    margin: 2px 0;
    border-radius: 14px;
}

.dashboard-nav ul li ul li a {
    min-height: 42px;
    padding: 9px 10px !important;
    font-size: 14px;
    font-weight: 600;
    color: #64748b;
    border-radius: 14px;
}

.dashboard-nav ul li ul li a:hover,
.dashboard-nav ul li ul li a.current {
    background: rgba(255, 255, 255, 0.92);
    color: #1d4ed8;
}

.dashboard-nav .nav-tag {
    margin-left: auto;
    min-width: 40px;
    height: 24px;
    padding: 0 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.06em;
    flex: 0 0 auto;
}

/* Mobile-specific fixes for screenshots */
@media (max-width: 992px) {
    #header .container-fluid {
        padding-left: 14px !important;
        padding-right: 14px !important;
    }

    #header .header__f {
        min-height: 72px;
        gap: 10px;
        flex-wrap: nowrap;
    }

    #header .left-side,
    #header .right-side {
        gap: 8px !important;
    }

    #header .header-widget {
        min-height: 44px;
        padding: 0 8px;
        border-radius: 14px;
    }

    #header #logo {
        min-height: 44px;
        padding-left: 12px !important;
    }

    #header #logo img {
        width: 104px;
    }

    #header #navigation {
        margin-left: 0 !important;
    }

    #header .language-selector > li > a {
        min-height: 44px;
        padding: 8px 12px;
        max-width: 170px;
    }

    #header .language-selector > li > a span {
        display: inline-block !important;
        max-width: 92px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    #header .header-notifications-trigger > a {
        min-height: 44px;
        padding: 6px 8px !important;
    }

    #header .user-name {
        display: none !important;
    }

    .dashboard-sidebar {
        width: min(86vw, 340px);
    }

    .dashboard-nav ul {
        margin-top: 22px;
    }

    .dashboard-nav ul:before {
        padding: 0 22px;
    }

    .dashboard-nav ul li {
        margin: 4px 10px;
    }

    .dashboard-nav ul li > a {
        min-height: 52px;
        gap: 9px;
        padding: 12px 12px !important;
        font-size: 15px;
    }

    .dashboard-nav ul li > a i {
        width: 20px;
        min-width: 20px;
        font-size: 20px;
    }

    .dashboard-nav ul li ul {
        padding: 2px 10px 14px 38px !important;
    }

    .dashboard-nav .nav-tag {
        min-width: 36px;
        height: 22px;
        font-size: 10px;
    }
}
