@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Arabic:wght@300;400;500;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
    width: 100%;
}

:root {
    --primary: #ff1744;
    --primary-dark: #c2185b;
    --bg: #FFFFFF;
    --bg-secondary: #FFF5F7;
    --bg-tertiary: #FFE4E9;
    --text: #1A1A1A;
    --text-secondary: #666666;
    --border: #FFD0D9;
    --shadow: rgba(255, 23, 68, 0.15);
}

body {
    font-family: 'IBM Plex Sans Arabic', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #ffffff 0%, #ffc0d4 25%, #e8b5ff 50%, #ffc0d4 75%, #ffffff 100%);
    background-attachment: fixed;
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 2px solid #ff1744;
    box-shadow: 0 4px 20px rgba(255, 23, 68, 0.2);
    z-index: 100;
    width: 100%;
    overflow-x: hidden;
}

.nav-content {
    max-width: 100%;
    margin: 0 auto;
    padding: 0.8rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

@media (max-width: 768px) {
    .nav-content {
        padding: 0.6rem 1rem;
    }

    .nav-links {
        gap: 0.8rem !important;
        font-size: 0.85rem;
    }
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 700;
    font-size: 1.3rem;
    color: var(--text);
}

.brand-icon {
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: visible;
}

.brand-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.brand-name {
    background: linear-gradient(135deg, var(--primary), #FFF4CC);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-links {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-links a {
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: var(--primary);
}

.store-btn {
    background: linear-gradient(135deg, #ff1744, #ff0052);
    color: white;
    padding: 0.6rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.2s;
}

.store-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 23, 68, 0.4);
}

/* Main Chat */
.chat-main {
    min-height: 100vh;
    padding-top: 90px;
    background: var(--bg);
}

.chat-wrapper {
    width: 100%;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    height: calc(100vh - 90px);
}

/* Chat Header */
.chat-header {
    padding: 1.5rem 3rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
}

.header-content {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.bot-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.bot-icon {
    width: 48px;
    height: 48px;
    background: var(--primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bg);
    font-size: 1.5rem;
}

.bot-info h1 {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text);
}

.bot-info p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.clear-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.clear-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--primary);
}

/* Messages Area */
.messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 2rem 3rem;
}

.messages-area::-webkit-scrollbar {
    width: 6px;
}

.messages-area::-webkit-scrollbar-track {
    background: transparent;
}

.messages-area::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 10px;
}

.messages-area::-webkit-scrollbar-thumb:hover {
    background: #3A3A3A;
}

/* Message Container (centered) */
.message-container {
    max-width: 800px;
    margin: 0 auto;
}

/* Message */
.message {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    animation: messageIn 0.3s ease;
}

@keyframes messageIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--bg);
    font-size: 1.1rem;
    flex-shrink: 0;
}

.message.user .message-avatar {
    background: #4A90E2;
}

.message-bubble {
    max-width: 70%;
    padding: 1rem 1.25rem;
    border-radius: 18px;
    font-size: 0.95rem;
    line-height: 1.6;
}

.message.bot .message-bubble {
    background: var(--bg-secondary);
    color: var(--text);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}

.message.user .message-bubble {
    background: var(--primary);
    color: var(--bg);
    border-bottom-right-radius: 4px;
}

.message-bubble strong {
    font-weight: 600;
    color: var(--primary);
}

.message.user .message-bubble strong {
    color: var(--bg);
    opacity: 0.9;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 0.5rem 0;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-secondary);
    animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.5;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Menu Button in Message */
.menu-trigger-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding: 0.7rem 1.5rem;
    background: var(--primary);
    color: var(--bg);
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}

.menu-trigger-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

/* Input Area */
.input-area {
    padding: 1.5rem 3rem;
    background: var(--bg);
    border-top: 1px solid var(--border);
    position: sticky;
    bottom: 0;
    z-index: 50;
}

.input-container {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    max-width: 800px;
    margin: 0 auto;
}

#messageInput {
    flex: 1;
    padding: 0.9rem 1.25rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--text);
    transition: all 0.2s;
}

#messageInput:focus {
    outline: none;
    border-color: var(--primary);
}

#messageInput::placeholder {
    color: var(--text-secondary);
}

.send-btn {
    width: 48px;
    height: 48px;
    background: var(--primary);
    border: none;
    border-radius: 12px;
    color: var(--bg);
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.send-btn:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: scale(1.05);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Menu Modal - Centered */
.menu-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.menu-modal.active {
    display: flex;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.menu-content {
    width: 100%;
    max-width: 500px;
    max-height: 70vh;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.menu-header {
    padding: 1.5rem 2rem;
    background: var(--bg-tertiary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

.menu-header h2 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text);
}

.close-menu {
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 1.3rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-menu:hover {
    background: var(--bg-secondary);
    color: var(--text);
}

.menu-list {
    max-height: calc(70vh - 100px);
    overflow-y: auto;
}

.menu-list::-webkit-scrollbar {
    width: 6px;
}

.menu-list::-webkit-scrollbar-track {
    background: transparent;
}

.menu-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 10px;
}

.menu-item {
    padding: 1.25rem 2rem;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text);
}

.menu-item:last-child {
    border-bottom: none;
}

.menu-item:hover {
    background: var(--bg-tertiary);
}

.menu-item:active {
    background: #252525;
}

.menu-item-icon {
    width: 40px;
    height: 40px;
    background: var(--bg-tertiary);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

/* WhatsApp Button */
.whatsapp-btn {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 60px;
    height: 60px;
    background: #25D366;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2rem;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
    transition: all 0.3s;
    z-index: 99;
}

.whatsapp-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.5);
}

/* Footer */
.footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding: 3rem 2rem 1rem;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3,
.footer-section h4 {
    color: var(--primary);
    margin-bottom: 1rem;
    font-weight: 600;
}

.footer-section p,
.footer-section a {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.footer-section a {
    display: block;
    text-decoration: none;
    transition: color 0.2s;
}

.footer-section a:hover {
    color: var(--primary);
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Responsive */
@media (max-width: 768px) {
    .brand-icon {
        width: 45px;
        height: 45px;
    }

    .brand-name {
        font-size: 1rem;
    }

    .nav-content {
        padding: 1rem;
        flex-direction: column;
        gap: 1rem;
    }

    .nav-links {
        gap: 1rem;
        flex-wrap: wrap;
        justify-content: center;
    }

    .nav-links a {
        font-size: 0.85rem;
    }

    .chat-main {
        padding-top: 140px;
    }

    .chat-wrapper {
        height: calc(100vh - 140px);
    }

    .chat-header,
    .messages-area,
    .input-area {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .header-content,
    .input-container {
        max-width: 100%;
    }

    .message-container {
        max-width: 100%;
    }

    .message-bubble {
        max-width: 85%;
        font-size: 0.9rem;
    }

    .menu-modal {
        padding: 0;
    }

    .menu-content {
        max-width: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    .menu-list {
        max-height: calc(100vh - 100px);
    }

    .whatsapp-btn {
        width: 50px;
        height: 50px;
        font-size: 1.6rem;
        bottom: 20px;
        left: 20px;
    }

    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
}