/**
 * This file is part of Defalto Portal – a customer portal software developed by IT-Solutions4You s.r.o.
 *
 * (c) IT-Solutions4You s.r.o
 *
 * This file is licensed under the GNU AGPL v3 License.
 * See LICENSE-AGPLv3.txt for more details.
 */

:root {
    --portal-body-bg: #f4f6f9;
    --portal-navbar-height: 3.5rem;
    --portal-sidebar-width: 16rem;
    --portal-touch-size: 2.75rem;
}

body {
    background-color: var(--portal-body-bg);
}

/* Touch targets of at least 44 × 44 px */
.btn,
.form-control,
.form-select,
.dropdown-item,
.list-group-item-action {
    min-height: var(--portal-touch-size);
}

.btn,
.dropdown-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.dropdown-item {
    justify-content: flex-start;
}

.portal-min-w-0 {
    min-width: 0;
}

/* Long texts from the CRM: keep line breaks, wrap long words */
.portal-pre-line {
    white-space: pre-line;
}

.portal-break-word {
    overflow-wrap: anywhere;
}

/* Top bar */
.portal-navbar {
    min-height: var(--portal-navbar-height);
}

.portal-user-name {
    max-width: 14rem;
}

/* Menu: offcanvas on mobile, side panel from lg up */
.portal-sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: var(--portal-touch-size);
    padding: 0.5rem 0.75rem;
    border-radius: var(--bs-border-radius-lg);
    color: var(--bs-body-color);
}

.portal-sidebar .nav-link:hover,
.portal-sidebar .nav-link:focus-visible {
    background-color: var(--bs-secondary-bg);
}

.portal-sidebar .nav-link.active {
    background-color: var(--bs-primary-bg-subtle);
    color: var(--bs-primary-text-emphasis);
    font-weight: 600;
}

.portal-sidebar .nav-link .bi {
    font-size: 1.15rem;
}

@media (min-width: 992px) {
    .portal-sidebar {
        position: sticky;
        top: var(--portal-navbar-height);
        flex: 0 0 var(--portal-sidebar-width);
        width: var(--portal-sidebar-width);
        height: calc(100vh - var(--portal-navbar-height));
        overflow-y: auto;
        background-color: var(--bs-body-bg) !important;
    }
}

.portal-content {
    min-width: 0;
    min-height: calc(100vh - var(--portal-navbar-height));
}

/* Forms: on mobile the buttons stay at the bottom of the screen */
@media (max-width: 767.98px) {
    .portal-form-actions {
        position: sticky;
        bottom: 0;
        z-index: 1010;
        margin: 0 -1rem;
        padding: 0.75rem 1rem;
        border-top: var(--bs-border-width) solid var(--bs-border-color);
        background-color: var(--bs-body-bg);
    }
}

/* Comments: the customer's own comments on the right */
.portal-comment {
    max-width: min(100%, 40rem);
    padding: 0.75rem 1rem;
    border-radius: var(--bs-border-radius-xl);
    background-color: var(--bs-tertiary-bg);
}

.portal-comment-own {
    background-color: var(--bs-primary-bg-subtle);
}

/* Progress (native element: no inline width, which the Content Security Policy forbids) */
.portal-progress {
    display: block;
    width: 100%;
    height: 0.5rem;
    border: 0;
    border-radius: var(--bs-border-radius-pill);
    background-color: var(--bs-secondary-bg);
    overflow: hidden;
    appearance: none;
}

.portal-progress::-webkit-progress-bar {
    background-color: var(--bs-secondary-bg);
}

.portal-progress::-webkit-progress-value {
    background-color: var(--bs-success);
}

.portal-progress::-moz-progress-bar {
    background-color: var(--bs-success);
}

/* Dashboard */
.portal-stat-card {
    color: inherit;
    transition: box-shadow 0.15s ease-in-out;
}

.portal-stat-card:hover,
.portal-stat-card:focus-visible {
    box-shadow: var(--bs-box-shadow) !important;
}

.portal-stat-icon {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border-radius: var(--bs-border-radius-xl);
    background-color: var(--bs-primary-bg-subtle);
    color: var(--bs-primary);
    font-size: 1.4rem;
}

/* Sign-in */
.portal-login {
    background: linear-gradient(135deg, #eef2f7 0%, #dbe4f0 100%);
}

.portal-login-card {
    max-width: 26rem;
}

.portal-login-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    background-color: var(--bs-primary-bg-subtle);
    color: var(--bs-primary);
    font-size: 1.6rem;
}

.portal-login .form-select-sm {
    min-height: 2.25rem;
}

/* Error page */
.portal-error {
    max-width: 28rem;
}
