body {
    font-family: 'Poppins', sans-serif;
    margin: 0;
    padding: 0;
    background: linear-gradient(135deg, #e2e8f0, #edf2f7);
    overflow-x: hidden;
}

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    z-index: 999;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    width: 90%;
    max-width: 600px;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    animation: slideFadeIn 0.6s ease-out forwards;
    transform: translateY(-30px);
    opacity: 0;
}

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

.welcome-title {
    color: #1a365d;
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 1.5rem;
    animation: fadeInDown 1s ease;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.welcome-text {
    color: #4a5568;
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin: 1.5rem 0;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 14px;
    color: #2d3748;
}

.animate-float {
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
    100% { transform: translateY(0px); }
}

.feature-card {
    background: white;
    padding: 1rem;
    border-radius: 0.75rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    transform: scale(1);
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    background: rgba(255, 255, 255, 0.9);
}

.feature-card:hover {
    transform: scale(1.05);
}

/* Updated sidebar and chat area styles */
.sidebar {
    width: 280px;
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    background: #1a365d;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    z-index: 50;
}

.chat-area {
    margin-left: 280px;
    height: 100vh;
    width: calc(100vw - 280px);
    display: flex;
    flex-direction: column;
    background: #f9fafb;
}

#messagesContainer {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    scroll-behavior: smooth;
}
#chatForm {
    width: 100%;
    padding: 1.5rem;
    background: white;
    border-top: 1px solid #e5e7eb;
    z-index: 40;
}

.session-gauge {
    padding: 0.5rem 0.25rem 0.25rem;
}

.session-gauge-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}

.session-gauge-label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.78rem;
}

.session-gauge-time {
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}

.session-gauge-time.low {
    color: #fca5a5;
}

.session-gauge-track {
    height: 5px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.15);
    overflow: hidden;
}

.session-gauge-fill {
    height: 100%;
    border-radius: 999px;
    background: #93c5fd;
    transition: width 1s linear, background 0.3s ease;
}

.session-gauge-fill.low {
    background: #f87171;
}

.rate-gauge {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.25rem;
}

.rate-gauge-count {
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
}

.rate-gauge-dashes {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex: 1;
    min-width: 0;
}

.rate-dash {
    flex: 1;
    height: 6px;
    border-radius: 999px;
    background: #93c5fd;
    transition: background 0.3s ease, opacity 0.3s ease;
}

.rate-dash.off {
    background: rgba(255, 255, 255, 0.15);
}

.rate-gauge-circle {
    --p: 1;
    position: relative;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: conic-gradient(#93c5fd calc(var(--p) * 360deg), rgba(255, 255, 255, 0.15) 0deg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.rate-gauge-circle::before {
    content: '';
    position: absolute;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #1a365d;
}

.rate-gauge-timer {
    position: relative;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    text-align: center;
    line-height: 1;
    z-index: 1;
}

.rate-gauge-tooltip {
    position: absolute;
    bottom: calc(100% + 10px);
    right: 0;
    background: #0f2544;
    color: #fff;
    font-size: 0.72rem;
    font-weight: 500;
    line-height: 1.35;
    white-space: pre-line;
    text-align: center;
    padding: 0.4rem 0.6rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
    opacity: 0;
    visibility: hidden;
    transform: translateY(4px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
    pointer-events: none;
    z-index: 60;
}

.rate-gauge-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    right: 18px;
    border: 6px solid transparent;
    border-top-color: #0f2544;
}

.rate-gauge-circle:hover .rate-gauge-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.nav-button {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: white;
    text-decoration: none; /* <a> kullanınca underline çıkmasın */
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
}

.nav-button:hover {
    background: rgba(255, 255, 255, 0.1);
}

.nav-button.danger:hover {
    background: #dc2626;
}

.chat-message {
    max-width: 80%;
    padding: 1rem;
    border-radius: 1rem;
    margin-bottom: 1rem;
    animation: messageSlide 0.3s ease;
    background-color: #f5f5f5;
    color: #333;
    font-family: 'Segoe UI', sans-serif;
    line-height: 1.6;
    word-wrap: break-word;

}

/* تنسيقات إضافية للمحتوى الداخلي */

.chat-message a {
    color: #1d4ed8;
    text-decoration: underline;
}

.chat-message a:hover {
    text-decoration: none;
}

.chat-message ul, .chat-message ol {
    padding-left: 1.5rem;
    margin-top: 0.5rem;
    list-style: circle ;
}
.chat-message ul li::marker {
    color: #3b82f6; 
}
.chat-message li {
    margin-bottom: 0.3rem;
}

.chat-message code {
    background-color: #e2e8f0;
    padding: 0.2rem 0.4rem;
    border-radius: 0.3rem;
    font-family: monospace;
    font-size: 0.95em;
}

.chat-message pre {
    background-color: #1e293b;
    color: #f1f5f9;
    padding: 1rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
    margin-top: 0.5rem;
}

.chat-message strong {
    font-weight: bold;
}

.chat-message em {
    font-style: italic;
}
.chat-message.user {
    background: #dbeafe;
    margin-left: auto;
    border-bottom-right-radius: 0.25rem;
        white-space: pre-wrap;      
    overflow-wrap: anywhere; 
}

.chat-message.bot {
    background: #f3f4f6;
    margin-right: auto;
    border-bottom-left-radius: 0.25rem;
}

.typing-message {
    min-width: 190px;
}

.typing-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.typing-text {
    font-size: 0.95rem;
    color: #4b5563;
    margin-bottom: 0.25rem;
}

.typing-dots {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.typing-dots span {
    width: 0.4rem;
    height: 0.4rem;
    border-radius: 9999px;
    background-color: #9ca3af;
    animation: typingPulse 1.2s infinite ease-in-out;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingPulse {
    0%, 80%, 100% {
        transform: translateY(0);
        opacity: 0.45;
    }
    40% {
        transform: translateY(-3px);
        opacity: 1;
    }
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.mobile-menu-button {
    display: none;
}

/* Responsive design */
@media (max-width: 768px) {
    .sidebar {
        width: min(85vw, 320px);
        height: 100dvh;
        transform: translateX(-100%);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .chat-area {
        margin-left: 0;
        width: 100vw;
        height: 100dvh;
    }

    #chatForm {
        width: 100%;
        padding: 1rem;
    }

    .mobile-menu-button {
        display: block;
    }

    #userInfoTrigger {
        min-width: 0;
        gap: 0.5rem;
    }

    #userInfoTrigger span {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    #infoButton {
        padding: 0.35rem;
    }

    .modal-content {
        width: 95%;
        padding: 20px;
    }
}

/* Additional responsive adjustments */
@media (min-width: 769px) {
    .mobile-menu-button {
        display: none !important;
    }
}

.custom-alert {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 16px 24px;
    min-width: 300px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.08);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 9999;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease; 
}

.custom-alert.show {
    opacity: 1;
    transform: translateY(0);
}

.custom-alert.hide {
    opacity: 0;
    transform: translateY(-10px);
}

.alert-icon {
    font-size: 20px;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

/* تنسيقات الأنواع المختلفة */
.custom-alert.success {
    background: #f0fdf4;
    border-left: 4px solid #22c55e;
}

.custom-alert.error {
    background: #fef2f2;
    border-left: 4px solid #ef4444;
}

.custom-alert.warning {
    background: #fffbeb;
    border-left: 4px solid #f59e0b;
}

.custom-alert.info {
    background: #eff6ff;
    border-left: 4px solid #3b82f6;
}

/* ألوان الأيقونات */
.success .alert-icon {
    color: #22c55e;
}

.error .alert-icon {
    color: #ef4444;
}

.warning .alert-icon {
    color: #f59e0b;
}

.info .alert-icon {
    color: #3b82f6;
}