:root {

    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --bg-main: #0f172a;
    --bg-sidebar: #1e293b;
    --surface: #1e293b;
    --surface-alt: #334155;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #334155;
    --radius-lg: 16px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
    --font-main: 'Outfit', sans-serif;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --header-height: 46px;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: var(--font-main);
    margin: 0;
    padding: 0;
    height: 100vh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
}

/* --- Common UI --- */
.btn {
    border-radius: var(--radius-sm);
    font-weight: 500;
    transition: var(--transition);
}

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

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: linear-gradient(to bottom right, var(--primary), var(--primary-dark));
    border: none;
}

.btn-primary:hover {
    filter: brightness(1.1);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* Custom Outline Buttons with high contrast and modern aesthetics */
.btn-outline-primary {
    color: #93c5fd !important;
    border-color: rgba(96, 165, 250, 0.4) !important;
    background-color: rgba(59, 130, 246, 0.08) !important;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus,
.btn-outline-primary:active {
    color: #ffffff !important;
    background-color: var(--primary) !important;
    border-color: var(--primary) !important;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3) !important;
}

.btn-outline-secondary {
    color: #cbd5e1 !important;
    border-color: rgba(203, 213, 225, 0.3) !important;
    background-color: rgba(203, 213, 225, 0.05) !important;
}

.btn-outline-secondary:hover,
.btn-outline-secondary:focus,
.btn-outline-secondary:active {
    color: #ffffff !important;
    background-color: var(--surface-alt) !important;
    border-color: var(--surface-alt) !important;
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.1) !important;
}

.btn-outline-success {
    color: #a7f3d0 !important;
    border-color: rgba(167, 243, 208, 0.4) !important;
    background-color: rgba(52, 211, 153, 0.08) !important;
}

.btn-outline-success:hover,
.btn-outline-success:focus,
.btn-outline-success:active {
    color: #ffffff !important;
    background-color: #10b981 !important;
    border-color: #10b981 !important;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3) !important;
}

.btn-outline-danger {
    color: #f87171 !important;
    border-color: rgba(248, 113, 113, 0.4) !important;
    background-color: rgba(248, 113, 113, 0.08) !important;
}

.btn-outline-danger:hover,
.btn-outline-danger:focus,
.btn-outline-danger:active {
    color: #ffffff !important;
    background-color: #ef4444 !important;
    border-color: #ef4444 !important;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3) !important;
}

.form-control {
    background-color: var(--surface-alt);
    border: 1px solid var(--border);
    color: white;
    border-radius: var(--radius-sm);
    padding: 0.75rem;
}

.form-control:focus {
    background-color: var(--surface-alt);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 0 0 0.25rem rgba(59, 130, 246, 0.25);
}

.form-control::placeholder {
    color: var(--text-muted) !important;
    opacity: 0.8;
}

/* --- Modals --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.custom-modal {
    background-color: var(--bg-sidebar);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 500px;
    overflow: hidden;
    position: relative;
    animation: modalSlideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalSlideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }

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

.custom-modal-header {
    background-color: rgba(255, 255, 255, 0.02);
}

/* --- Scrollbar --- */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--surface-alt);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* --- Shared Fixed Header Component (<app-header>) --- */
app-header {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background-color: var(--bg-sidebar);
    border-bottom: 1px solid var(--border);
    z-index: 1040;
    /* Ensure header is on top of page contents, sidebar index is 10 */
}

.app-header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
    padding: 0 1.5rem;
}

.app-header-left,
.app-header-right {
    display: flex;
    align-items: center;
}

.app-header-left {
    gap: 1rem;
}

.app-header-right {
    gap: 1rem;
}

.app-header-brand {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    background: linear-gradient(to right, #38bdf8, #818cf8);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-decoration: none !important;
    transition: var(--transition);
}

.app-header-brand:hover {
    filter: brightness(1.1);
}

.app-header-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-main);
    margin: 0;
    text-transform: none;
}

/* --- Header Notifications --- */
.header-notification-container {
    position: relative;
}

.header-notification-bell {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background-color: var(--surface-alt);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid var(--border);
    position: relative;
}

.header-notification-bell:hover {
    transform: scale(1.05);
    border-color: var(--primary);
    color: var(--primary);
}

.header-notification-badge {
    padding: 0.25em 0.4em;
    font-size: 0.65rem;
    font-weight: 700;
}

.header-notification-dropdown-menu {
    background-color: var(--bg-sidebar);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 320px;
    max-width: 400px;
    max-height: 400px;
    overflow-y: auto;
    backdrop-filter: blur(20px);
    padding: 0;
    margin-top: 8px !important;
}

/* --- Header User Dropdown --- */
.header-user-avatar-container {
    position: relative;
}

.header-user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid var(--border);
}

.header-user-avatar:hover {
    transform: scale(1.05);
    border-color: var(--primary);
}

.header-user-dropdown-menu {
    background-color: var(--bg-sidebar);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    backdrop-filter: blur(20px);
    padding: 8px 0;
    margin-top: 8px !important;
}

.header-user-dropdown-item {
    color: var(--text-main);
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: var(--transition);
    cursor: pointer;
    text-decoration: none;
    font-size: 0.9rem;
}

.header-user-dropdown-item:hover {
    background-color: var(--surface-alt);
    color: var(--primary);
}

.header-user-dropdown-item i {
    font-size: 1.1rem;
}

.header-user-dropdown-section-title {
    font-size: 0.7rem;
}

.notification-time {
    font-size: 0.75rem;
}

.header-lang-active {
    color: var(--primary) !important;
    font-weight: 600;
}

@media (max-width: 768px) {
    .app-header-title {
        font-size: 0.95rem;
    }

    .app-header-container {
        padding: 0 1rem;
    }
}

/* Global Option Buttons styling */
.message-options-container {
    max-width: 100%;
}

.option-btn {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border-width: 1px;
    background-color: rgba(59, 130, 246, 0.12) !important;
    border-color: rgba(96, 165, 250, 0.5) !important;
    color: #93c5fd !important;
}

.option-btn:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.25);
    background-color: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #ffffff !important;
}

.option-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background-color: transparent !important;
    border-color: rgba(255, 255, 255, 0.1) !important;
    color: rgba(255, 255, 255, 0.3) !important;
}