/*
 * Global theme switch. Light is the default; these selectors only apply when
 * <html data-theme="dark"> is set by wwwroot/js/theme.js.
 *
 * The dark palette is intentionally neutral dark gray (not blue-black):
 * deep #0f1115 -> background #15181e -> elevated #1b1f26 -> surface #20252d.
 */

html[data-theme="dark"] {
    --ivs-deep: #14161a;
    --ivs-bg: #1b1e24;
    --ivs-bg-elevated: #22262e;
    --ivs-surface: #272c35;
    --ivs-surface-2: #1f232a;
    --ivs-border: #3a414d;
    --ivs-border-strong: #4a5260;
    --ivs-text: #eceef2;
    --ivs-muted: #aab1bc;
    --ivs-accent: #93b4ff;
}

.theme-toggle {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(14, 62, 197, 0.18);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: var(--tg-theme-primary, #0e3ec5);
    cursor: pointer;
    transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.theme-toggle:hover {
    transform: translateY(-1px);
    background: rgba(14, 62, 197, 0.10);
}

.theme-toggle:focus-visible {
    outline: 3px solid rgba(14, 62, 197, 0.25);
    outline-offset: 2px;
}

.tv-header-right-action .theme-toggle {
    margin-right: 10px;
}

.theme-toggle .theme-toggle-sun {
    display: none;
}

html[data-theme="dark"] .theme-toggle {
    border-color: var(--ivs-border-strong);
    background: var(--ivs-bg-elevated);
    color: #f4c542;
}

html[data-theme="dark"] .theme-toggle:hover {
    background: var(--ivs-surface);
}

html[data-theme="dark"] .theme-toggle .theme-toggle-sun {
    display: inline-block;
}

html[data-theme="dark"] .theme-toggle .theme-toggle-moon {
    display: none;
}

/* Service card icons: visible in both themes, including hover. */
.single-service-item span.service-icon i {
    color: var(--tv-theme-1, #2b4dff);
}

.single-service-item:hover span.service-icon i {
    color: #ffffff;
}

html[data-theme="dark"] body {
    background: var(--ivs-bg);
    color: var(--ivs-text);
}

html[data-theme="dark"] .tv-header-top-area,
html[data-theme="dark"] .tv-header-area,
html[data-theme="dark"] .header-sticky {
    background-color: var(--ivs-bg) !important;
    border-color: var(--ivs-border) !important;
}

html[data-theme="dark"] .tv-header-top-area {
    border-bottom: 1px solid var(--ivs-border);
}

html[data-theme="dark"] .tv-header-top-list-box ul li span,
html[data-theme="dark"] .tv-header-top-list-box ul li a,
html[data-theme="dark"] .tv-header-top-social-box a,
html[data-theme="dark"] .tv-menu-content ul li a,
html[data-theme="dark"] .tv-header-search,
html[data-theme="dark"] .tv-menu-bar {
    color: var(--ivs-text);
}

html[data-theme="dark"] .tv-header-top-list-box ul li i,
html[data-theme="dark"] .tv-header-top-social-box a i,
html[data-theme="dark"] .tv-header-top-list-box .fa-solid {
    color: var(--ivs-accent) !important;
}

html[data-theme="dark"] .tv-header-right-action .tv-header-search {
    background: var(--ivs-bg-elevated) !important;
    border-color: var(--ivs-border-strong) !important;
    color: var(--ivs-accent) !important;
}

html[data-theme="dark"] .tv-header-right-action .tv-header-search i {
    color: var(--ivs-accent) !important;
}

html[data-theme="dark"] .tv-header-right-action .tv-header-search:hover {
    background: var(--ivs-surface) !important;
}

html[data-theme="dark"] .tv-menu-bar span {
    background: var(--ivs-bg-elevated) !important;
    border-color: var(--ivs-border-strong) !important;
    color: var(--ivs-accent) !important;
}

html[data-theme="dark"] .tv-menu-bar span i {
    color: var(--ivs-accent) !important;
}

html[data-theme="dark"] .white-bg,
html[data-theme="dark"] .gray-bg,
html[data-theme="dark"] .services__area,
html[data-theme="dark"] .tv-about-area,
html[data-theme="dark"] .tv-slider-area,
html[data-theme="dark"] .tv-counter-area,
html[data-theme="dark"] .tv-service-area,
html[data-theme="dark"] .tv-breadcrumb-area,
html[data-theme="dark"] .tv-footer-wrap,
html[data-theme="dark"] .tv-footer-top-area,
html[data-theme="dark"] .tv-copyright-area {
    background-color: var(--ivs-bg) !important;
}

html[data-theme="dark"] .single-counter-item h2,
html[data-theme="dark"] .single-counter-item .counter {
    color: var(--ivs-text) !important;
}

html[data-theme="dark"] .single-counter-item p {
    color: var(--ivs-muted) !important;
}

html[data-theme="dark"] .tv-breadcrumb-area {
    background-image: linear-gradient(120deg, rgba(27, 30, 36, 0.94), rgba(43, 77, 255, 0.45)) !important;
}

html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3,
html[data-theme="dark"] h4,
html[data-theme="dark"] h5,
html[data-theme="dark"] h6,
html[data-theme="dark"] .title,
html[data-theme="dark"] .tv-section-title {
    color: var(--ivs-text);
}

html[data-theme="dark"] p,
html[data-theme="dark"] li,
html[data-theme="dark"] dd,
html[data-theme="dark"] dt,
html[data-theme="dark"] .text-muted {
    color: var(--ivs-muted) !important;
}

html[data-theme="dark"] a {
    color: var(--ivs-accent);
}

html[data-theme="dark"] .card,
html[data-theme="dark"] .single-service-item,
html[data-theme="dark"] .icon-box,
html[data-theme="dark"] .tv-footer-top-area-form,
html[data-theme="dark"] .legal-content,
html[data-theme="dark"] .modal-content,
html[data-theme="dark"] .dropdown-menu {
    background-color: var(--ivs-surface) !important;
    border-color: var(--ivs-border) !important;
    color: var(--ivs-text);
}

html[data-theme="dark"] .single-service-item span.service-icon {
    background: var(--ivs-bg-elevated);
}

html[data-theme="dark"] .single-service-item span.service-icon i {
    color: var(--ivs-accent);
}

html[data-theme="dark"] .single-service-item:hover span.service-icon {
    background: var(--tv-theme-1, #2b4dff);
}

html[data-theme="dark"] .single-service-item:hover span.service-icon i {
    color: #ffffff;
}

html[data-theme="dark"] .card-header,
html[data-theme="dark"] .card-footer,
html[data-theme="dark"] .modal-header,
html[data-theme="dark"] .modal-footer,
html[data-theme="dark"] .dropdown-divider {
    background-color: var(--ivs-bg-elevated) !important;
    border-color: var(--ivs-border) !important;
    color: var(--ivs-text);
}

html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select,
html[data-theme="dark"] .form-check-input,
html[data-theme="dark"] textarea,
html[data-theme="dark"] input[type="text"],
html[data-theme="dark"] input[type="email"],
html[data-theme="dark"] input[type="password"],
html[data-theme="dark"] input[type="tel"],
html[data-theme="dark"] input[type="number"] {
    background-color: var(--ivs-surface-2) !important;
    border-color: var(--ivs-border-strong) !important;
    color: var(--ivs-text) !important;
}

html[data-theme="dark"] .form-control::placeholder,
html[data-theme="dark"] textarea::placeholder {
    color: #7f8794 !important;
}

html[data-theme="dark"] .form-control:focus,
html[data-theme="dark"] .form-select:focus {
    border-color: var(--ivs-accent) !important;
    box-shadow: 0 0 0 0.2rem rgba(143, 176, 255, 0.18) !important;
}

html[data-theme="dark"] .btn-outline-primary {
    color: var(--ivs-accent);
    border-color: var(--ivs-border-strong);
}

html[data-theme="dark"] .btn-outline-primary:hover {
    background: var(--ivs-bg-elevated);
    color: #ffffff;
    border-color: var(--ivs-accent);
}

html[data-theme="dark"] .breadcrumb-item + .breadcrumb-item::before,
html[data-theme="dark"] .breadcrumb-item.active {
    color: var(--ivs-muted);
}

html[data-theme="dark"] .table {
    color: var(--ivs-text);
    border-color: var(--ivs-border);
}

html[data-theme="dark"] .table > :not(caption) > * > * {
    background-color: var(--ivs-surface);
    border-color: var(--ivs-border);
    color: var(--ivs-text);
}

html[data-theme="dark"] .alert-danger {
    background: #2a1618;
    border-color: #5d2529;
    color: #ffb4b8;
}

html[data-theme="dark"] .search__popup {
    background: linear-gradient(150deg, var(--ivs-deep) 0%, #1c2b52 100%) !important;
}

html[data-theme="dark"] .scroll-top {
    background: var(--ivs-bg-elevated);
    color: var(--ivs-accent);
}

html[data-theme="dark"] .tv-footer-top-area {
    background: linear-gradient(135deg, #22262e 0%, #2b3240 100%) !important;
}

html[data-theme="dark"] .tv-footer-widget-contact-info i {
    color: var(--ivs-accent) !important;
}

/* Service cards: tighter icon gap, left-aligned copy and bottom-aligned CTA. */
.single-service-item {
    display: flex;
    flex-direction: column;
}

.single-service-item span.service-icon {
    margin-bottom: 26px;
}

body main .single-service-item p,
body main .single-service-item li {
    text-align: left !important;
}

body main .contact-page p,
body main .contact-page li {
    text-align: left !important;
}

body main .contact-page .cm-success-card p {
    text-align: center !important;
}

.single-service-item p {
    flex: 1;
}

html[data-theme="dark"] .single-service-item {
    background: #2b303a !important;
    border-color: #3a414d !important;
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.16);
}

html[data-theme="dark"] .single-service-item:hover {
    border-color: var(--ivs-accent) !important;
}

/* Footer newsletter: compact block and a real flex-aligned form. */
.tv-footer-top-area-form {
    padding: 32px 40px;
    margin-bottom: 48px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 28px;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
}

.tv-footer-top-heading h2 {
    font-size: 42px;
    line-height: 1.15;
}

.tv-footer-top-form {
    margin-left: 0;
}

.tv-footer-top-form form {
    position: relative;
    width: 100%;
    max-width: 560px;
    margin-left: auto;
}

.tv-footer-top-form input {
    width: 100%;
    height: 52px;
    padding: 0 140px 0 18px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 12px;
    background: #ffffff;
    color: #0f172a;
}

.tv-footer-top-form button {
    position: absolute;
    top: 0;
    right: 0;
    height: 52px;
    padding: 0 26px;
    border-radius: 0 12px 12px 0;
}

html[data-theme="dark"] .tv-footer-top-area-form {
    border-color: var(--ivs-border);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.18);
}

html[data-theme="dark"] .tv-footer-top-form input {
    border-color: var(--ivs-border);
    background: var(--ivs-surface-2);
    color: var(--ivs-text);
}

.tv-footer-widget-title {
    margin-bottom: 22px;
}

.tv-footer-widget-menu ul {
    margin: 0;
    padding: 0;
}

.tv-footer-widget-menu ul li:not(:last-child) {
    margin-bottom: 14px;
}

.tv-footer-widget-menu ul li a {
    display: inline-block;
    line-height: 1.5;
}

.tv-footer-widget-contact-info ul li:not(:last-child) {
    margin-bottom: 12px;
}

@media (max-width: 991.98px) {
    .tv-footer-top-area-form {
        padding: 28px;
        margin-bottom: 40px;
    }

    .tv-footer-top-heading h2 {
        font-size: 34px;
    }

    .tv-footer-top-form form {
        margin-left: 0;
        margin-top: 24px;
    }
}

@media (max-width: 575px) {
    .tv-footer-top-form input {
        padding-right: 116px;
    }

    .tv-footer-top-form button {
        padding: 0 18px;
    }
}

html[data-theme="dark"] .tv-footer-widget-title,
html[data-theme="dark"] .tv-footer-widget p,
html[data-theme="dark"] .tv-footer-widget a,
html[data-theme="dark"] .tv-copyright-left p,
html[data-theme="dark"] .tv-copyright-left a {
    color: var(--ivs-muted);
}

html[data-theme="dark"] .tv-footer-widget a:hover,
html[data-theme="dark"] .tv-copyright-left a:hover {
    color: #ffffff;
}

/* Preloader must follow the theme instead of flashing white. */
html[data-theme="dark"] #preloader {
    background-color: var(--ivs-bg);
}

html[data-theme="dark"] #preloader .preloader span {
    background: var(--ivs-accent);
}

html[data-theme="dark"] #page-transition-overlay {
    background: linear-gradient(135deg, var(--ivs-bg) 0%, #1c2b52 100%);
}

html[data-theme="dark"] .tv-footer-top-form input,
html[data-theme="dark"] .tv-footer-top-form input::placeholder {
    text-transform: none;
}

html[data-theme="dark"] .tv-footer-top-form input::placeholder {
    color: #8c94a2;
}

@media (prefers-reduced-motion: reduce) {
    .theme-toggle {
        transition: none;
    }
}
