/* ==============================
   Anta — Togalma Chat Assistant
   ============================== */
:root {
    --primary: #1b6b3a;
    --primary-light: #27a555;
    --primary-dark: #0f4924;
    --accent: #f5a623;
    --bg: #f0f2f5;
    --surface: #ffffff;
    --text: #1a1a2e;
    --text-muted: #6b7280;
    --bot-bubble: #ffffff;
    --user-bubble: #dcfce7;
    --user-bubble-border: #bbf7d0;
    --danger: #ef4444;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.12);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.15);
    --radius: 16px;
    --radius-sm: 10px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --header-h: 64px;
    --input-h: 68px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    overflow: hidden;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
}

/* Screens */
.screen {
    display: none;
    width: 100%;
    height: 100%;
}

.screen.active {
    display: flex;
}

/* ==============================
   LOGIN SCREEN
   ============================== */
#login-screen {
    align-items: center;
    justify-content: center;
    background: linear-gradient(160deg, #0f4924 0%, #1b6b3a 40%, #27a555 100%);
    position: relative;
    overflow: hidden;
}

#login-screen::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(245, 166, 35, 0.15) 0%, transparent 70%);
    top: -200px;
    right: -100px;
}

#login-screen::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.05) 0%, transparent 70%);
    bottom: -100px;
    left: -80px;
}

.login-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 400px;
    padding: 24px;
}

.login-header {
    text-align: center;
    margin-bottom: 36px;
}

.logo-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    border: 2px solid rgba(255, 255, 255, 0.25);
    animation: pulse-glow 3s ease-in-out infinite;
}

.logo-img {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

@keyframes pulse-glow {

    0%,
    100% {
        box-shadow: 0 0 20px rgba(245, 166, 35, 0.2);
    }

    50% {
        box-shadow: 0 0 40px rgba(245, 166, 35, 0.4);
    }
}

.login-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.5px;
    margin-bottom: 4px;
}

.subtitle {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 400;
}

.login-form {
    width: 100%;
}

.input-group {
    margin-bottom: 20px;
    position: relative;
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.12);
    border: 1.5px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-sm);
    transition: border-color 0.2s, background 0.2s;
    overflow: hidden;
}

.input-group:focus-within {
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.18);
    box-shadow: 0 0 0 3px rgba(245, 166, 35, 0.15);
}

.country-code {
    padding: 14px 12px 14px 16px;
    font-size: 1rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.6);
    border-right: 1px solid rgba(255, 255, 255, 0.15);
    user-select: none;
    white-space: nowrap;
}

#phone,
#password {
    flex: 1;
    border: none;
    background: transparent;
    padding: 14px 16px;
    font-size: 1.1rem;
    font-weight: 500;
    color: #fff;
    outline: none;
    font-family: var(--font);
    width: 100%;
}

#phone::placeholder,
#password::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

.login-btn {
    width: 100%;
    padding: 14px 24px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: #1a1a2e;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font);
    box-shadow: 0 4px 14px rgba(245, 166, 35, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
}

.login-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(245, 166, 35, 0.4);
}

.login-btn:active {
    transform: translateY(0);
}

.login-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    /* Keep generic class for modal buttons */
    width: 100%;
    padding: 14px 24px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: #1a1a2e;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font);
    box-shadow: 0 4px 14px rgba(245, 166, 35, 0.3);
}

.btn-secondary {
    width: 100%;
    padding: 12px 24px;
    border: 1.5px solid #d1d5db;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font);
}

.btn-secondary:hover {
    border-color: var(--text-muted);
    color: var(--text);
}

.error-msg {
    margin-top: 12px;
    text-align: center;
    font-size: 0.85rem;
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.15);
    border-radius: 8px;
    padding: 10px;
    animation: shake 0.4s ease-in-out;
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-8px);
    }

    75% {
        transform: translateX(8px);
    }
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
}

.login-footer a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

/* Dot loader */
.dot-loader {
    display: inline-flex;
    gap: 4px;
}

.dot-loader span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #1a1a2e;
    animation: dot-bounce 1.2s infinite;
}

.dot-loader span:nth-child(2) {
    animation-delay: 0.15s;
}

.dot-loader span:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes dot-bounce {

    0%,
    80%,
    100% {
        transform: scale(0.6);
        opacity: 0.4;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* ==============================
   CHAT SCREEN
   ============================== */
#chat-screen {
    flex-direction: column;
    background: var(--bg);
}

.chat-header {
    height: var(--header-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    background: var(--primary-dark);
    color: #fff;
    box-shadow: var(--shadow-md);
    z-index: 10;
    flex-shrink: 0;
}

.chat-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar-small {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.avatar-small img {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.header-info h2 {
    font-size: 1.05rem;
    font-weight: 700;
}

.header-info .status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4ade80;
    margin-right: 4px;
    animation: status-pulse 2s infinite;
}

.header-info .status-text {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
}

@keyframes status-pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

.btn-icon {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: rgba(255, 255, 255, 0.7);
    transition: all 0.2s;
}

.btn-icon:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

/* Messages */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 16px 16px 8px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.messages-container::-webkit-scrollbar {
    width: 4px;
}

.messages-container::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.15);
    border-radius: 4px;
}

.welcome-message {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 8px;
}

.avatar-bubble {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.avatar-bubble img {
    width: 22px;
    height: 22px;
    object-fit: contain;
}

.bubble {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 0.92rem;
    line-height: 1.5;
    animation: bubble-in 0.25s ease-out;
    word-break: break-word;
}

@keyframes bubble-in {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.97);
    }

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

.bubble.bot {
    background: var(--bot-bubble);
    border: 1px solid #e5e7eb;
    border-radius: var(--radius) var(--radius) var(--radius) 4px;
    box-shadow: var(--shadow-sm);
}

.bubble.bot p {
    margin-bottom: 4px;
}

.bubble.bot p:last-child {
    margin-bottom: 0;
}

.bubble.user {
    background: var(--user-bubble);
    border: 1px solid var(--user-bubble-border);
    border-radius: var(--radius) var(--radius) 4px var(--radius);
    margin-left: auto;
    box-shadow: var(--shadow-sm);
}

.message-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    margin-bottom: 10px;
}

.message-row.user {
    justify-content: flex-end;
}

.message-row.bot {
    justify-content: flex-start;
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.typing-dots {
    background: var(--bot-bubble);
    border: 1px solid #e5e7eb;
    border-radius: var(--radius) var(--radius) var(--radius) 4px;
    padding: 14px 18px;
    display: flex;
    gap: 5px;
    box-shadow: var(--shadow-sm);
}

.typing-dots span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--primary-light);
    animation: typing-bounce 1.4s infinite;
}

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

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

@keyframes typing-bounce {

    0%,
    60%,
    100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-6px);
    }
}

/* Quick actions */
.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 4px 0 12px;
}

.quick-btn {
    padding: 10px 16px;
    border: 1.5px solid #e5e7eb;
    border-radius: 20px;
    background: var(--surface);
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font);
    box-shadow: var(--shadow-sm);
    white-space: nowrap;
}

.quick-btn:hover {
    border-color: var(--primary-light);
    background: #f0fdf4;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.quick-btn:active {
    transform: translateY(0);
}

/* Chat input */
.chat-input-area {
    flex-shrink: 0;
    padding: 12px 16px;
    background: var(--surface);
    border-top: 1px solid #e5e7eb;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.04);
}

.chat-form {
    display: flex;
    align-items: center;
    gap: 10px;
}

#chat-input {
    flex: 1;
    padding: 12px 18px;
    border: 1.5px solid #e5e7eb;
    border-radius: 24px;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
    font-family: var(--font);
    background: var(--bg);
    resize: none;
    min-height: 48px;
    max-height: 120px;
    line-height: 1.4;
}

#chat-input:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(39, 165, 85, 0.1);
}

#chat-input::placeholder {
    color: #adb5bd;
}

.btn-send {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border: none;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-send:hover:not(:disabled) {
    background: var(--primary-light);
    transform: scale(1.05);
}

.btn-send:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-send:active:not(:disabled) {
    transform: scale(0.95);
}

/* ==============================
   MODAL
   ============================== */
.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    animation: fade-in 0.2s ease-out;
}

@keyframes fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-content {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 480px;
    max-height: 80vh;
    background: var(--surface);
    border-radius: 20px 20px 0 0;
    display: flex;
    flex-direction: column;
    animation: slide-up 0.3s ease-out;
    box-shadow: var(--shadow-lg);
}

@keyframes slide-up {
    from {
        transform: translateY(100%);
    }

    to {
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid #e5e7eb;
}

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-muted);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.modal-close:hover {
    background: #f3f4f6;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
    font-size: 0.9rem;
    line-height: 1.6;
}

.modal-body .order-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #f3f4f6;
}

.modal-body .order-item:last-child {
    border-bottom: none;
}

.modal-body .order-label {
    font-weight: 500;
    color: var(--text-muted);
}

.modal-actions {
    display: flex;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid #e5e7eb;
}

/* Payment link button */
.payment-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #1b6b3a, #27a555);
    color: #fff;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.95rem;
    transition: all 0.2s;
    box-shadow: var(--shadow-md);
    margin-top: 8px;
}

.payment-link:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

/* Markdown in bubbles */
.bubble.bot strong {
    font-weight: 700;
}

.bubble.bot em {
    font-style: italic;
}

.bubble.bot ul,
.bubble.bot ol {
    margin: 6px 0;
    padding-left: 20px;
}

.bubble.bot li {
    margin-bottom: 3px;
}

.bubble.bot code {
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85em;
}

/* ==============================
   RESPONSIVE
   ============================== */
@media (min-width: 600px) {
    #login-screen {
        background-attachment: fixed;
    }

    .login-container {
        background: rgba(255, 255, 255, 0.06);
        border: 1px solid rgba(255, 255, 255, 0.12);
        border-radius: 20px;
        padding: 40px;
        backdrop-filter: blur(20px);
    }

    #chat-screen {
        max-width: 480px;
        margin: 0 auto;
        border-left: 1px solid #e5e7eb;
        border-right: 1px solid #e5e7eb;
        box-shadow: var(--shadow-lg);
    }

    .modal-content {
        border-radius: 20px;
        margin-bottom: 20px;
    }

}

/* Menu Carousel */
.menu-carousel-container {
    margin: 12px 0 16px;
    position: relative;
    max-width: 100%;
    animation: fade-in 0.3s;
}

.carousel-feedback {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    opacity: 0.8;
}

.menu-carousel-track {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding: 4px 16px 16px;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.menu-carousel-track::-webkit-scrollbar {
    display: none;
}

.menu-card {
    flex: 0 0 220px;
    background: #fff;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    border: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s;
}

.menu-card:active {
    transform: scale(0.98);
}

.menu-card-img {
    height: 140px;
    background-size: cover;
    background-position: center;
    background-color: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #9ca3af;
    font-size: 2rem;
}

.menu-card-img.no-img {
    background: #f9fafb;
}

.menu-card-body {
    padding: 12px;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.menu-card-title {
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 4px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.menu-card-price {
    font-weight: 600;
    color: var(--primary);
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.menu-card-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
    margin-bottom: 12px;
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.menu-card-action {
    background: var(--surface);
    border: 1.5px solid var(--primary);
    color: var(--primary);
    text-align: center;
    padding: 8px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.menu-card-action:hover {
    background: var(--primary);
    color: #fff;
}
/* Cart and Qty Controls */
.menu-card-actions {
    margin-top: auto;
}

.qty-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #f3f4f6;
    border-radius: 8px;
    padding: 4px;
    height: 36px;
}

.qty-btn {
    border: none;
    background: #fff;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: var(--primary);
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.qty-btn:active {
    transform: scale(0.95);
}

.qty-val {
    font-weight: 600;
    font-size: 0.9rem;
    min-width: 24px;
    text-align: center;
}

/* Floating Cart Button */
.floating-cart-btn {
    position: fixed;
    bottom: 80px;
    right: 20px;
    background: var(--primary);
    color: #fff;
    padding: 12px 20px;
    border-radius: 30px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    z-index: 99;
    animation: bounce-in 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transition: transform 0.2s;
}

.floating-cart-btn:hover {
    transform: translateY(-2px);
}

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

.cart-icon {
    font-size: 1.2rem;
}

.cart-count {
    background: #fff;
    color: var(--primary);
    font-weight: bold;
    font-size: 0.8rem;
    padding: 2px 6px;
    border-radius: 10px;
}

.cart-label {
    font-weight: 600;
    font-size: 0.9rem;
}

@keyframes bounce-in {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* Cart Modal Items */
.cart-list {
    max-height: 50vh;
    overflow-y: auto;
    margin: -10px -20px 20px;
    padding: 10px 20px;
}

.cart-item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f3f4f6;
}

.cart-item-info {
    flex: 1;
}

.cart-item-name {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 2px;
}

.cart-item-price {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.cart-item-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #f3f4f6;
    padding: 4px;
    border-radius: 8px;
}

.cart-item-actions button {
    border: none;
    background: #fff;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    font-weight: bold;
    color: var(--primary);
    cursor: pointer;
}

.cart-item-actions span {
    font-weight: 600;
    min-width: 16px;
    text-align: center;
    font-size: 0.9rem;
}

.cart-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
    font-size: 1.1rem;
    margin-top: 10px;
    border-top: 2px solid #f3f4f6;
    padding-top: 16px;
}

.cart-note {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 8px;
    text-align: center;
}
