:root {
    --bg-base: #0a0a0c;
    --bg-surface: rgba(255, 255, 255, 0.03);
    --bg-surface-hover: rgba(255, 255, 255, 0.05);
    --bg-glass: rgba(20, 20, 25, 0.6);
    --border-glass: rgba(255, 255, 255, 0.08);

    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.6);
    --text-muted: rgba(255, 255, 255, 0.4);

    --accent-primary: #6366f1;
    /* Indigo */
    --accent-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    --accent-hover: #4f46e5;

    --success: #10b981;
    --danger: #ef4444;

    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

    --h-factor: 100;
}

.contact-list-box .rz-listbox-item {
    padding: 0.5rem 1rem !important;
    border-bottom: 1px solid var(--border-glass) !important;
}

.contact-list-box .rz-listbox-item.rz-state-highlight {
    background-color: var(--bg-surface-hover) !important;
    color: inherit !important;
}

.chat-screen {
    width: 100% !important;
    height: 100%;/* calc(var(--vh, 1vh) * var(--h-factor));*/
    box-sizing: border-box;
    background: radial-gradient(circle at top right, rgba(99, 102, 241, 0.1) 0%, var(--bg-base) 80%);
}

@media only screen and (min-width: 600px) {
    .sidebar-container {
        transition: width 0.3s ease, margin 0.3s ease;
    }

    .sidebar-toggle {
        display: none !important;
    }

    .sidebar-container {
        min-width: 350px;
        max-width: 450px;
    }

    .sidebar-container.collapsed {
        display: none;
    }

    .chat-screen {
        padding: 1rem;
    }

}

@media only screen and  (max-width: 600px) {
    .sidebar-container {
        width: 100% !important;
        position: fixed;
        z-index: 1000;
        top: 0;
        bottom: 0;
        left: 0;
        right: 0;
        margin: 0;
        border-radius: 0;
    }

    .sidebar-container>div {
        border-radius: 0 !important;
    }

    .sidebar-toggle {
        display: inline-flex;
    }

    .sidebar-toggle.desktop-only {
        display: none !important;
    }

    .mobile-back-btn {
        display: inline-flex !important;
    }

    .chat-messages-container {
        padding: 0rem !important;
    }

    .sidebar-close-btn {
        display: inline-flex !important;
    }

    .chat-screen {
        padding: 0;
    }
}


html,
body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-main);
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
    position: absolute;
    width:100%;
    min-height: 100%;
    height: calc(var(--vh, 1vh) * var(--h-factor));
}

#app {
    width: 100%;
    height: 100%;
    /*height: calc(var(--vh, 1vh) * var(--h-factor));*/
}

.welcome-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    background: radial-gradient(circle at center, rgba(99, 102, 241, 0.15) 0%, var(--bg-base) 60%);
}

/* Glassmorphism Utilities */
.glass-panel {
    background: var(--bg-glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-glass);
    padding: 2rem;
}
@media only screen and (max-width: 600px){
    .glass-panel {
        border-radius: 0;
    }
}
@media only screen and (min-width: 600px){
    .glass-panel {
        border-radius: 16px;
    }
}

.glass-panel.no-padding {
    padding: 0;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    margin-top: 0;
    font-weight: 600;
}

h1 {
    font-size: 2.5rem;
    letter-spacing: -0.02em;
}

h2 {
    font-size: 1.75rem;
    letter-spacing: -0.01em;
}

p {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Common Layout */
.page-container {
    display: flex;
    width: 100%;
    height: 100%;
    /*height: calc(var(--vh, 1vh) * var(--h-factor));*/
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 2rem;
    overflow-y: hidden;
    min-height: 100%;
    /*min-height: calc(var(--vh, 1vh) * var(--h-factor));*/
}

/* Buttons */
.btn-primary {
    background: var(--accent-gradient);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    font-size: 1rem;
    font-family: var(--font-main);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.btn-primary:active {
    transform: translateY(1px);
}

.btn-secondary {
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-glass);
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 500;
    font-size: 1rem;
    font-family: var(--font-main);
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.btn-secondary:hover {
    background: var(--bg-surface-hover);
    border-color: var(--text-secondary);
}

/* Inputs */
.input-glass {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-glass);
    color: var(--text-primary);
    padding: 0.875rem 1rem;
    border-radius: 8px;
    font-family: var(--font-main);
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    width: 100%;
    box-sizing: border-box;
}

.input-glass:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.input-glass::placeholder {
    color: var(--text-muted);
}

/* Form Groups */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
}

/* The Progress Bar */
.loading-bar {
    width: 300px;
    height: 10px;
    background: #222;
    border-radius: 5px;
    position: relative;
    overflow: hidden;
}

.loading-bar::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    /* Use the variable to drive the width */
    width: var(--blazor-load-percentage);
    background: linear-gradient(90deg, #0078d4, #00bcff);
    transition: width 0.2s ease-out;
}

/* The Percentage Text */
.loading-text::before {
    /* Use the string variable for the content */
    content: var(--blazor-load-percentage-text);
    display: block;
    margin-top: 15px;
    font-size: 1.2rem;
    font-weight: bold;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.delay-1 {
    animation-delay: 0.1s;
    opacity: 0;
}

.delay-2 {
    animation-delay: 0.2s;
    opacity: 0;
}

.delay-3 {
    animation-delay: 0.3s;
    opacity: 0;
}

/* Blazor Error UI overrides */
#blazor-error-ui {
    background: var(--danger);
    color: white;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}



/*Breakpoints*/

.contacts-container {
    width: 40%;
    max-width: 450px;
}

.top-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-glass);
    background: rgba(0, 0, 0, 0.2);
}

@media only screen and (max-width: 600px) {
    .top-header {
        border-top-left-radius: 0;
        border-top-right-radius: 0;
    }

    .hidden-mobile {
        display: none !important;
    }

    .contacts-container {
        max-width: 100%;
        width: 100%;
    }
}

@media only screen and (min-width: 600px) {
    .top-header {
        border-top-left-radius: 15px;
        border-top-right-radius: 15px;
    }

    .hidden-desktop {
        display: none !important;
    }
}


/* Target devices with a width smaller than, for example, 430px (iPhone 15 Pro Max and down) */
@media only screen and (max-width: 430px) {
    html,body {
        /* Scale the entire app to 80% */
        transform: scale(0.8);
        /* Ensure the scaling starts from the top-left corner */
        transform-origin:top left;
        /* Increase the width to 125% to fill the gap left by scaling (1 / 0.8 = 1.25) */
        width:  125%!important;
        height: 125%!important;
        /* Hide any weird scrollbars created by the transform */
        overflow-x: hidden;
    }
}