* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

html,
body {
    height: 100%;
    height: -webkit-fill-available;
    overflow: hidden;
    background: #0a0a1a;
    color: #1a1a1a;
    transition: background 0.3s, color 0.3s;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    position: fixed;
    width: 100%;
    top: 0;
    left: 0;
}

/* ======================================== */
/* HERO / LANDING PAGE (Screenshot 1) */
/* ======================================== */

.hero-page {
    position: fixed;
    inset: 0;
    z-index: 999998;
    background: linear-gradient(135deg, #0a0a1a 0%, #1a1a3e 50%, #0d1b2a 100%);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 0 40px;
}

.hero-page.hide {
    display: none !important;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    flex-shrink: 0;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 24px;
    font-weight: 800;
    color: #ffffff;
}

.nav-brand i {
    color: #10a37f;
    font-size: 28px;
}

.nav-links {
    display: flex;
    gap: 30px;
}

.nav-link {
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: 0.3s;
}

.nav-link:hover,
.nav-link.active {
    color: #ffffff;
}

.nav-actions {
    display: flex;
    gap: 12px;
}

.btn-outline {
    padding: 10px 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    background: transparent;
    color: #ffffff;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4);
}

.btn-primary {
    padding: 10px 20px;
    border: none;
    border-radius: 12px;
    background: #10a37f;
    color: #ffffff;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-primary:hover {
    background: #0d8b6c;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(16, 163, 127, 0.3);
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: #ffffff;
    font-size: 24px;
    cursor: pointer;
}

.hero-content {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 60px;
    padding: 20px 0 40px;
    min-height: 0;
}

.hero-text {
    flex: 1;
    max-width: 600px;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(16, 163, 127, 0.15);
    border: 1px solid rgba(16, 163, 127, 0.3);
    padding: 6px 16px;
    border-radius: 50px;
    color: #10a37f;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 20px;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10a37f;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.3);
    }
}

.hero-title {
    font-size: 52px;
    font-weight: 900;
    color: #ffffff;
    line-height: 1.1;
    margin-bottom: 20px;
}

.hero-title .gradient-text {
    background: linear-gradient(135deg, #10a37f, #4ade80);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-description {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.8;
    margin-bottom: 30px;
}

.hero-buttons {
    display: flex;
    gap: 14px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.btn-hero-primary {
    padding: 14px 32px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, #10a37f, #0d8b6c);
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-hero-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(16, 163, 127, 0.4);
}

.btn-hero-secondary {
    padding: 14px 32px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 14px;
    background: transparent;
    color: #ffffff;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: 0.3s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-hero-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.4);
}

.hero-stats {
    display: flex;
    gap: 30px;
    align-items: center;
}

.stat-item {
    display: flex;
    flex-direction: column;
}

.stat-number {
    font-size: 28px;
    font-weight: 800;
    color: #ffffff;
}

.stat-label {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
}

.stat-divider {
    width: 1px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
}

.hero-image {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 400px;
}

.hero-illustration {
    position: relative;
    width: 400px;
    height: 400px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.6;
    animation: float 6s ease-in-out infinite;
}

.orb-1 {
    width: 250px;
    height: 250px;
    background: #10a37f;
    top: -20px;
    right: -20px;
    animation-delay: 0s;
}

.orb-2 {
    width: 200px;
    height: 200px;
    background: #4ade80;
    bottom: -30px;
    left: -30px;
    animation-delay: 2s;
}

.orb-3 {
    width: 150px;
    height: 150px;
    background: #6366f1;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: 4s;
}

@keyframes float {
    0%,
    100% {
        transform: translateY(0px) scale(1);
    }
    50% {
        transform: translateY(-20px) scale(1.05);
    }
}

.ai-icon-container {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(16, 163, 127, 0.3), rgba(16, 163, 127, 0.1));
    border: 2px solid rgba(16, 163, 127, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 50px;
    color: #10a37f;
    z-index: 1;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    animation: pulseGlow 3s ease-in-out infinite;
}

@keyframes pulseGlow {
    0%,
    100% {
        box-shadow: 0 0 40px rgba(16, 163, 127, 0.2);
    }
    50% {
        box-shadow: 0 0 80px rgba(16, 163, 127, 0.4);
    }
}

.floating-card {
    position: absolute;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    padding: 12px 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 500;
    animation: floatCard 4s ease-in-out infinite;
}

.floating-card i {
    font-size: 18px;
    color: #10a37f;
}

.card-1 {
    top: 20px;
    left: 20px;
    animation-delay: 0s;
}

.card-2 {
    bottom: 40px;
    right: 20px;
    animation-delay: 1.5s;
}

.card-3 {
    bottom: 100px;
    left: -10px;
    animation-delay: 3s;
}

@keyframes floatCard {
    0%,
    100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* ======================================== */
/* LOGIN SCREEN (Screenshot 2) */
/* ======================================== */

.login-screen {
    position: fixed;
    inset: 0;
    z-index: 999999;
    display: none !important;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #0a0a1a 0%, #1a1a3e 50%, #0d1b2a 100%);
    padding: 16px;
}

.login-screen.show {
    display: flex !important;
}

.login-box {
    width: 100%;
    max-width: 400px;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 40px 32px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
    animation: popup 0.5s ease;
}

.login-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: 28px;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 8px;
}

.login-logo i {
    color: #10a37f;
    font-size: 36px;
}

.login-subtitle {
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
    margin-bottom: 32px;
}

.login-form .form-group {
    margin-bottom: 16px;
}

.login-form .form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 4px;
}

.login-form .form-group input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    font-size: 14px;
    transition: border-color 0.3s, box-shadow 0.3s;
    background: rgba(255, 255, 255, 0.05);
    color: #ffffff;
    -webkit-appearance: none;
}

.login-form .form-group input:focus {
    border-color: #10a37f;
    outline: none;
    box-shadow: 0 0 0 3px rgba(16, 163, 127, 0.2);
    background: rgba(255, 255, 255, 0.08);
}

.login-form .form-group input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.login-form .password-wrapper {
    position: relative;
}

.login-form .password-wrapper .toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    font-size: 16px;
    padding: 4px;
}

.login-form .password-wrapper .toggle-password:hover {
    color: rgba(255, 255, 255, 0.7);
}

.login-error {
    color: #e74c3c;
    font-size: 12px;
    text-align: center;
    margin-top: 8px;
    min-height: 20px;
}

.login-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #10a37f, #0d8b6c);
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s;
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.login-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(16, 163, 127, 0.3);
}

.login-btn:active {
    transform: scale(0.97);
}

.register-link {
    text-align: center;
    margin-top: 16px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
}

.register-link a {
    color: #10a37f;
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
}

.register-link a:hover {
    text-decoration: underline;
}

/* ======================================== */
/* APP STYLES (Screenshot 3) */
/* ======================================== */

.app {
    display: none !important;
    height: 100vh;
    height: -webkit-fill-available;
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
    position: relative;
    width: 100%;
    background: #f0f2f5;
}

.app.show {
    display: flex !important;
}

.sidebar {
    width: 270px;
    background: #ffffff;
    border-right: 1px solid #e0e0e0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 16px;
    flex-shrink: 0;
    height: 100%;
    height: -webkit-fill-available;
    overflow-y: auto;
    transition: background 0.3s, border-color 0.3s, transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
    -webkit-overflow-scrolling: touch;
}

.sidebar::-webkit-scrollbar {
    width: 3px;
}
.sidebar::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: fadeIn 0.3s ease;
}

.sidebar-overlay.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 16px;
    color: #1a1a1a;
    flex-shrink: 0;
}

.logo i {
    color: #10a37f;
    font-size: 26px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: #f0f0f0;
    border-radius: 10px;
    margin-bottom: 12px;
    flex-shrink: 0;
}

.user-info .avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #10a37f;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.user-info .name {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
    color: #1a1a1a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-info .logout-btn {
    background: none;
    border: none;
    color: #e74c3c;
    cursor: pointer;
    font-size: 14px;
    padding: 4px;
    transition: 0.3s;
}

.user-info .logout-btn:hover {
    transform: scale(1.1);
}

.user-info .logout-btn:active {
    transform: scale(0.9);
}

.new-chat {
    width: 100%;
    border: none;
    cursor: pointer;
    background: #10a37f;
    color: white;
    padding: 12px;
    border-radius: 12px;
    font-size: 14px;
    margin-bottom: 16px;
    transition: .3s;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.new-chat:hover {
    background: #0d8b6c;
}

.new-chat:active {
    transform: scale(0.97);
}

.history {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.history h3 {
    color: #666;
    font-size: 13px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.history h3 .clear-history {
    background: none;
    border: none;
    color: #ff4d4d;
    cursor: pointer;
    font-size: 13px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: .3s;
}

.history h3 .clear-history:hover {
    background: rgba(255, 77, 77, 0.1);
}

.history ul {
    list-style: none;
    overflow-y: auto;
    flex: 1;
    -webkit-overflow-scrolling: touch;
}

.history ul::-webkit-scrollbar {
    width: 3px;
}
.history ul::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}

.history li {
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    margin-bottom: 3px;
    transition: .3s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #1a1a1a;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.history li:hover {
    background: #f0f0f0;
}

.history li:active {
    background: #f0f0f0;
    transform: scale(0.98);
}

.history li i {
    flex-shrink: 0;
    color: #888;
    font-size: 13px;
}

.history li .history-delete {
    margin-left: auto;
    background: none;
    border: none;
    color: #ff4d4d;
    cursor: pointer;
    font-size: 13px;
    padding: 2px 8px;
    border-radius: 4px;
    flex-shrink: 0;
    opacity: 0.5;
}

.history li .history-delete:hover {
    opacity: 1;
}

.history li .history-delete:active {
    opacity: 1;
    background: #ff4d4d;
    color: white;
}

.history .empty-history {
    color: #999;
    font-size: 13px;
    padding: 10px 0;
    text-align: center;
}

.sidebar-bottom {
    flex-shrink: 0;
    padding-top: 10px;
    border-top: 1px solid #e0e0e0;
}

.sidebar-bottom button {
    width: 100%;
    border: none;
    background: #e8e8e8;
    color: #1a1a1a;
    padding: 10px;
    border-radius: 10px;
    cursor: pointer;
    margin-top: 8px;
    transition: .3s;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-bottom button:hover {
    background: #d0d0d0;
}

.sidebar-bottom button:active {
    background: #d0d0d0;
    transform: scale(0.97);
}

.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #ffffff;
    min-width: 0;
    height: 100%;
    height: -webkit-fill-available;
    overflow: hidden;
    transition: background 0.3s;
    position: relative;
}

.header {
    padding: 12px 14px;
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0;
    transition: border-color 0.3s;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 52px;
    background: inherit;
    z-index: 10;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.header .menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 20px;
    color: #1a1a1a;
    cursor: pointer;
    padding: 4px;
}

.header .menu-toggle:hover {
    color: #10a37f;
}

.header .menu-toggle:active {
    transform: scale(0.9);
}

.header h2 {
    font-size: 18px;
    color: #1a1a1a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

.header p {
    color: #666;
    font-size: 11px;
}

.header .chat-info {
    font-size: 11px;
    color: #999;
    white-space: nowrap;
    flex-shrink: 0;
}

.chat-box {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px 14px;
    scroll-behavior: smooth;
    min-height: 0;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.chat-box::-webkit-scrollbar {
    width: 4px;
}
.chat-box::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 20px;
}

#previewArea {
    padding: 0 12px 8px;
    flex-shrink: 0;
    max-height: 120px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: inherit;
}

#previewArea::-webkit-scrollbar {
    width: 3px;
}
#previewArea::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 10px;
}

.file-preview {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #f0f0f0;
    padding: 8px 10px;
    border-radius: 10px;
    margin-bottom: 4px;
    transition: background 0.3s;
}

.file-preview img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 8px;
}

.file-icon {
    font-size: 28px;
}

.file-info {
    flex: 1;
    min-width: 0;
    color: #1a1a1a;
}

.file-info b {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 12px;
}

.file-info span {
    font-size: 10px;
    opacity: 0.7;
}

.remove-file {
    background: #ff4d4d;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 4px 8px;
    cursor: pointer;
    flex-shrink: 0;
    font-size: 11px;
}

.remove-file:hover {
    background: #e04444;
}

.remove-file:active {
    transform: scale(0.95);
}

.input-container {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 8px 10px;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    background: #f7f7f7;
    border-top: 1px solid #e0e0e0;
    flex-shrink: 0;
    transition: background 0.3s, border-color 0.3s;
    position: relative;
    z-index: 10;
    min-height: 52px;
}

textarea {
    flex: 1;
    resize: none;
    border: none;
    outline: none;
    background: #ffffff;
    color: #1a1a1a;
    padding: 10px 12px;
    border-radius: 12px;
    max-height: 100px;
    font-size: 14px;
    transition: background 0.3s, color 0.3s;
    line-height: 1.5;
    min-height: 36px;
    -webkit-appearance: none;
    font-family: inherit;
    overflow-y: auto;
}

textarea::placeholder {
    color: #999;
}

.circle-btn {
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    background: #e8e8e8;
    color: #1a1a1a;
    font-size: 15px;
    transition: .3s;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.circle-btn:hover {
    background: #d0d0d0;
}

.circle-btn:active {
    background: #10a37f;
    color: white;
    transform: scale(0.92);
}

.send-btn {
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    background: #10a37f;
    color: white;
    font-size: 15px;
    transition: .3s;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.send-btn:hover {
    background: #0d8b6c;
}

.send-btn:active {
    background: #0d8b6c;
    transform: scale(0.92);
}

.message {
    display: flex;
    margin-bottom: 14px;
    align-items: flex-start;
    animation: messageIn 0.3s ease;
}

@keyframes messageIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.ai {
    justify-content: flex-start;
}
.message.ai .avatar {
    order: 0;
    margin-right: 8px;
    margin-left: 0;
}
.message.ai .bubble {
    order: 1;
    background: #f0f0f0;
    color: #1a1a1a;
    border-top-left-radius: 4px;
}

.message.user {
    justify-content: flex-end;
}
.message.user .avatar {
    order: 1;
    margin-left: 8px;
    margin-right: 0;
}
.message.user .bubble {
    order: 0;
    background: #d0e6ff;
    color: #1a1a1a;
    border-top-right-radius: 4px;
}

.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #10a37f;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
    font-size: 14px;
}

.user .avatar {
    background: #2563eb;
}

.bubble {
    padding: 10px 12px;
    border-radius: 12px;
    max-width: 82%;
    line-height: 1.6;
    transition: background 0.3s, color 0.3s;
    word-break: break-word;
    position: relative;
    font-size: 14px;
}

.bubble img {
    max-width: 100%;
    border-radius: 8px;
    margin-top: 4px;
    max-height: 200px;
    object-fit: contain;
}

.bubble p {
    margin-bottom: 4px;
}

.bubble-actions {
    display: flex;
    gap: 4px;
    margin-top: 6px;
    align-items: center;
    opacity: 0.5;
    transition: opacity 0.2s;
    flex-wrap: wrap;
}

.bubble-actions button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 13px;
    color: #555;
    transition: color 0.2s, transform 0.1s;
    padding: 2px 6px;
    border-radius: 4px;
}

.bubble-actions button:hover {
    opacity: 1;
}

.bubble-actions button:active {
    transform: scale(0.9);
}

.bubble-actions button.liked {
    color: #10a37f;
}
.bubble-actions button.disliked {
    color: #e74c3c;
}
.bubble-actions button.copied {
    color: #2ecc71;
}

.bubble-actions .action-divider {
    width: 1px;
    height: 14px;
    background: #ccc;
}

.message.user .bubble .edit-input {
    width: 100%;
    padding: 8px 10px;
    border: 2px solid #10a37f;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    background: white;
    color: #1a1a1a;
    resize: vertical;
    min-height: 50px;
    -webkit-appearance: none;
}

.message.user .bubble .edit-actions {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

.message.user .bubble .edit-actions button {
    padding: 6px 14px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 12px;
    transition: .3s;
}

.message.user .bubble .edit-actions .save-edit {
    background: #10a37f;
    color: white;
}

.message.user .bubble .edit-actions .save-edit:hover {
    background: #0d8b6c;
}

.message.user .bubble .edit-actions .save-edit:active {
    background: #0d8b6c;
    transform: scale(0.97);
}

.message.user .bubble .edit-actions .cancel-edit {
    background: #e8e8e8;
    color: #555;
}

.message.user .bubble .edit-actions .cancel-edit:hover {
    background: #d0d0d0;
}

.message.user .bubble .edit-actions .cancel-edit:active {
    background: #d0d0d0;
    transform: scale(0.97);
}

.toast-container {
    position: fixed;
    bottom: 70px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 99999;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: 90%;
    max-width: 380px;
}

.toast {
    background: #2d2f39;
    color: white;
    padding: 8px 16px;
    border-radius: 24px;
    font-size: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease forwards;
    pointer-events: auto;
    font-weight: 500;
    text-align: center;
    width: 100%;
    white-space: normal;
    word-break: break-word;
}

.toast.success {
    background: #10a37f;
}
.toast.error {
    background: #e74c3c;
}
.toast.info {
    background: #2d2f39;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(-10px) scale(0.95);
    }
}

.toast.hide {
    animation: fadeOut 0.25s ease forwards;
}

.plus-wrapper {
    position: relative;
    flex-shrink: 0;
}

.upload-menu {
    position: absolute;
    bottom: 52px;
    left: 0;
    width: 190px;
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    display: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    animation: popup .2s ease;
    z-index: 999;
    transition: background 0.3s;
}

.upload-menu.show {
    display: block;
}

.upload-option {
    width: 100%;
    border: none;
    background: none;
    color: #1a1a1a;
    text-align: left;
    padding: 10px 12px;
    cursor: pointer;
    transition: .3s;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.upload-option i {
    width: 20px;
    font-size: 14px;
}

.upload-option:hover {
    background: #f0f0f0;
}

.upload-option:active {
    background: #f0f0f0;
}

.settings-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    padding: 16px;
}

.settings-modal.show {
    display: flex;
}

.settings-box {
    width: 100%;
    max-width: 380px;
    background: #ffffff;
    border-radius: 14px;
    padding: 16px;
    animation: popup .25s;
    transition: background 0.3s;
    max-height: 85vh;
    overflow-y: auto;
    color: #1a1a1a;
    -webkit-overflow-scrolling: touch;
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.settings-header h2 {
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.settings-header h2 i {
    color: #10a37f;
}

.settings-header button {
    border: none;
    background: #ff4d4d;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
}

.settings-header button:hover {
    background: #e04444;
}

.settings-header button:active {
    transform: scale(0.9);
}

.setting-item {
    margin-bottom: 12px;
}

.setting-item label {
    display: block;
    margin-bottom: 4px;
    font-size: 12px;
    font-weight: 500;
}

.setting-item input[type=text],
.setting-item select {
    width: 100%;
    padding: 8px 10px;
    border: none;
    border-radius: 8px;
    background: #f0f0f0;
    color: #1a1a1a;
    transition: background 0.3s;
    font-size: 13px;
    -webkit-appearance: none;
}

.setting-item input[type=range] {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 3px;
    background: #ddd;
    border-radius: 2px;
    outline: none;
}

.setting-item input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #10a37f;
    cursor: pointer;
}

.save-btn {
    width: 100%;
    padding: 10px;
    border: none;
    border-radius: 10px;
    background: #10a37f;
    color: white;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: .3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.save-btn:hover {
    background: #0d8b6c;
}

.save-btn:active {
    transform: scale(0.97);
}

.camera-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.92);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 99999;
    flex-direction: column;
    padding: 16px;
}

.camera-modal.show {
    display: flex;
}

.camera-modal video {
    max-width: 100%;
    max-height: 55vh;
    border-radius: 12px;
    background: #000;
    transform: scaleX(-1);
    width: auto;
    height: auto;
}

.camera-modal .camera-controls {
    display: flex;
    gap: 10px;
    margin-top: 14px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}

.camera-modal .camera-controls button {
    padding: 10px 16px;
    border: none;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.camera-modal .camera-controls button:hover {
    transform: translateY(-2px);
}

.camera-modal .camera-controls button:active {
    transform: scale(0.95);
}

.camera-modal .camera-controls .capture-btn {
    background: #10a37f;
    color: white;
}

.camera-modal .camera-controls .close-camera-btn {
    background: #e74c3c;
    color: white;
}

.camera-modal .camera-preview {
    display: none;
    max-width: 100%;
    max-height: 55vh;
    border-radius: 12px;
}

.camera-modal .camera-preview.show {
    display: block;
}

.camera-modal video.hide {
    display: none;
}

/* ======================================== */
/* DARK MODE */
/* ======================================== */

body.dark-mode .app {
    background: #121212;
}

body.dark-mode .sidebar {
    background: #0d0d0d;
    border-color: #222;
}
body.dark-mode .sidebar .logo {
    color: #f0f0f0;
}
body.dark-mode .sidebar .history li {
    color: #f0f0f0;
}
body.dark-mode .sidebar .history li:hover {
    background: #1a1a1a;
}
body.dark-mode .sidebar .history li:active {
    background: #1a1a1a;
}
body.dark-mode .sidebar .history li i {
    color: #888;
}
body.dark-mode .sidebar .sidebar-bottom {
    border-color: #222;
}
body.dark-mode .sidebar .sidebar-bottom button {
    background: #1a1a1a;
    color: #f0f0f0;
}
body.dark-mode .sidebar .sidebar-bottom button:hover {
    background: #2a2a2a;
}
body.dark-mode .sidebar .sidebar-bottom button:active {
    background: #2a2a2a;
}
body.dark-mode .sidebar .user-info {
    background: #1a1a1a;
}
body.dark-mode .sidebar .user-info .name {
    color: #f0f0f0;
}
body.dark-mode .chat-area {
    background: #1a1a1a;
}
body.dark-mode .header {
    border-color: #333;
}
body.dark-mode .header h2 {
    color: #f0f0f0;
}
body.dark-mode .header p {
    color: #aaa;
}
body.dark-mode .header .menu-toggle {
    color: #f0f0f0;
}
body.dark-mode .message.ai .bubble {
    background: #2a2a2a;
    color: #f0f0f0;
}
body.dark-mode .message.user .bubble {
    background: #1a4a7a;
    color: #f0f0f0;
}
body.dark-mode .input-container {
    background: #1a1a1a;
    border-color: #333;
}
body.dark-mode textarea {
    background: #2a2a2a;
    color: #f0f0f0;
}
body.dark-mode .circle-btn {
    background: #2a2a2a;
    color: #f0f0f0;
}
body.dark-mode .circle-btn:hover {
    background: #3a3a3a;
}
body.dark-mode .circle-btn:active {
    background: #10a37f;
    color: white;
}
body.dark-mode .file-preview {
    background: #2a2a2a;
}
body.dark-mode .file-info {
    color: #f0f0f0;
}
body.dark-mode .upload-menu {
    background: #1a1a1a;
}
body.dark-mode .upload-option {
    color: #f0f0f0;
}
body.dark-mode .upload-option:hover {
    background: #2a2a2a;
}
body.dark-mode .upload-option:active {
    background: #2a2a2a;
}
body.dark-mode .settings-box {
    background: #1a1a1a;
    color: #f0f0f0;
}
body.dark-mode .setting-item input[type=text],
body.dark-mode .setting-item select {
    background: #2a2a2a;
    color: #f0f0f0;
}
body.dark-mode .save-btn {
    background: #10a37f;
}
body.dark-mode .history h3 {
    color: #999;
}
body.dark-mode .history .empty-history {
    color: #666;
}
body.dark-mode .chat-box::-webkit-scrollbar-thumb {
    background: #555;
}
body.dark-mode .sidebar::-webkit-scrollbar-thumb {
    background: #444;
}
body.dark-mode #previewArea::-webkit-scrollbar-thumb {
    background: #555;
}
body.dark-mode .bubble-actions button {
    color: #aaa;
}
body.dark-mode .bubble-actions button.liked {
    color: #10a37f;
}
body.dark-mode .bubble-actions button.disliked {
    color: #e74c3c;
}
body.dark-mode .bubble-actions button.copied {
    color: #2ecc71;
}
body.dark-mode .bubble-actions .action-divider {
    background: #444;
}
body.dark-mode .toast {
    background: #2a2a2a;
    color: #f0f0f0;
}
body.dark-mode .toast.success {
    background: #10a37f;
}
body.dark-mode .toast.error {
    background: #e74c3c;
}
body.dark-mode .message.user .bubble .edit-input {
    background: #2a2a2a;
    color: #f0f0f0;
    border-color: #10a37f;
}
body.dark-mode .message.user .bubble .edit-actions .cancel-edit {
    background: #2a2a2a;
    color: #aaa;
}

/* ======================================== */
/* RESPONSIVE */
/* ======================================== */

@media(min-width:769px) {
    .sidebar-overlay {
        display: none !important;
    }
    .header .menu-toggle {
        display: none !important;
    }
}

@media(max-width:768px) {
    .hero-page {
        padding: 0 20px;
    }

    .navbar {
        flex-wrap: wrap;
        gap: 10px;
    }

    .nav-links {
        display: none;
    }

    .nav-actions {
        display: none;
    }

    .mobile-menu-btn {
        display: block;
    }

    .hero-content {
        flex-direction: column;
        gap: 30px;
        padding: 10px 0 30px;
    }

    .hero-text {
        max-width: 100%;
        text-align: center;
    }

    .hero-title {
        font-size: 32px;
    }

    .hero-buttons {
        justify-content: center;
    }

    .hero-stats {
        justify-content: center;
    }

    .hero-image {
        min-height: 250px;
    }

    .hero-illustration {
        width: 280px;
        height: 280px;
    }

    .ai-icon-container {
        width: 80px;
        height: 80px;
        font-size: 32px;
    }

    .orb-1 {
        width: 150px;
        height: 150px;
    }
    .orb-2 {
        width: 120px;
        height: 120px;
    }
    .orb-3 {
        width: 100px;
        height: 100px;
    }

    .floating-card {
        font-size: 11px;
        padding: 8px 12px;
    }

    .floating-card i {
        font-size: 14px;
    }

    .card-1 {
        top: 10px;
        left: 10px;
    }
    .card-2 {
        bottom: 20px;
        right: 10px;
    }
    .card-3 {
        bottom: 60px;
        left: 0;
    }

    .app {
        flex-direction: column;
        height: 100vh;
        height: -webkit-fill-available;
        height: 100dvh;
    }

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        width: 280px;
        height: 100%;
        height: -webkit-fill-available;
        transform: translateX(-100%);
        border-right: none;
        border-radius: 0 16px 16px 0;
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.1);
        padding: 14px;
        z-index: 100;
        background: #ffffff;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay.active {
        display: block;
    }

    .header .menu-toggle {
        display: flex !important;
        align-items: center;
        justify-content: center;
    }

    .chat-area {
        height: 100%;
        height: -webkit-fill-available;
        min-height: 0;
    }

    .header {
        padding: 8px 10px;
        min-height: 44px;
    }

    .header h2 {
        font-size: 16px;
        max-width: 110px;
    }

    .header .chat-info {
        font-size: 10px;
    }

    .chat-box {
        padding: 10px 10px;
        flex: 1;
        min-height: 0;
    }

    .bubble {
        max-width: 88%;
        font-size: 13px;
        padding: 8px 10px;
    }

    .avatar {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }

    .message.ai .avatar {
        margin-right: 6px;
    }
    .message.user .avatar {
        margin-left: 6px;
    }

    .input-container {
        padding: 6px 8px;
        padding-bottom: max(6px, env(safe-area-inset-bottom));
        gap: 6px;
        min-height: 44px;
    }

    textarea {
        min-height: 32px;
        font-size: 13px;
        padding: 8px 10px;
        border-radius: 10px;
        max-height: 80px;
    }

    .circle-btn {
        width: 34px;
        height: 34px;
        font-size: 13px;
    }

    .send-btn {
        width: 38px;
        height: 38px;
        font-size: 13px;
        border-radius: 10px;
    }

    .upload-menu {
        width: 170px;
        bottom: 46px;
        left: 0;
    }

    .upload-option {
        padding: 8px 10px;
        font-size: 12px;
    }

    .settings-box {
        max-width: 100%;
        margin: 8px;
        max-height: 80vh;
        padding: 14px;
    }

    #previewArea {
        padding: 0 8px 4px;
        max-height: 80px;
    }

    .file-preview {
        padding: 6px 8px;
        gap: 8px;
        border-radius: 8px;
    }

    .file-preview img {
        width: 32px;
        height: 32px;
    }

    .file-icon {
        font-size: 22px;
    }

    .file-info b {
        font-size: 11px;
    }

    .file-info span {
        font-size: 9px;
    }

    .remove-file {
        padding: 2px 6px;
        font-size: 10px;
    }

    .toast-container {
        bottom: 60px;
        width: 92%;
    }

    .toast {
        font-size: 11px;
        padding: 6px 14px;
    }

    .camera-modal video {
        max-height: 45vh;
    }

    .camera-modal .camera-controls button {
        padding: 8px 14px;
        font-size: 12px;
    }

    .bubble-actions {
        opacity: 0.7;
    }

    .bubble-actions button {
        font-size: 12px;
        padding: 2px 4px;
    }

    .chat-box {
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }

    .login-box {
        padding: 32px 20px;
        margin: 12px;
    }

    .login-logo {
        font-size: 24px;
    }

    .login-logo i {
        font-size: 30px;
    }
}

@media(max-width:380px) {
    .hero-title {
        font-size: 26px;
    }

    .hero-illustration {
        width: 220px;
        height: 220px;
    }

    .ai-icon-container {
        width: 60px;
        height: 60px;
        font-size: 24px;
    }

    .orb-1 {
        width: 120px;
        height: 120px;
    }
    .orb-2 {
        width: 90px;
        height: 90px;
    }
    .orb-3 {
        width: 80px;
        height: 80px;
    }

    .header h2 {
        font-size: 14px;
        max-width: 80px;
    }

    .header .chat-info {
        font-size: 9px;
    }

    .bubble {
        font-size: 12px;
        padding: 6px 8px;
        max-width: 92%;
    }

    .avatar {
        width: 24px;
        height: 24px;
        font-size: 10px;
    }

    .circle-btn {
        width: 30px;
        height: 30px;
        font-size: 11px;
    }

    .send-btn {
        width: 34px;
        height: 34px;
        font-size: 11px;
    }

    textarea {
        font-size: 12px;
        padding: 6px 8px;
        min-height: 28px;
    }

    .input-container {
        padding: 4px 6px;
        gap: 4px;
        min-height: 38px;
    }

    .sidebar {
        width: 240px;
        padding: 10px;
    }

    .upload-menu {
        width: 150px;
    }

    .stat-number {
        font-size: 20px;
    }
}

@supports(padding: max(0px)) {
    .input-container {
        padding-bottom: max(6px, env(safe-area-inset-bottom));
    }

    .sidebar {
        padding-top: max(14px, env(safe-area-inset-top));
        padding-bottom: max(14px, env(safe-area-inset-bottom));
    }

    .camera-modal {
        padding-top: max(16px, env(safe-area-inset-top));
        padding-bottom: max(16px, env(safe-area-inset-bottom));
    }

    .hero-page {
        padding-top: max(0px, env(safe-area-inset-top));
        padding-bottom: max(0px, env(safe-area-inset-bottom));
    }
}

.circle-btn,
.send-btn,
.upload-option,
.new-chat,
.history li,
.sidebar-bottom button,
.btn-hero-primary,
.btn-hero-secondary,
.btn-outline,
.btn-primary {
    touch-action: manipulation;
    -webkit-touch-callout: none;
}

.chat-box,
.sidebar,
.history ul,
#previewArea,
.settings-box,
.hero-page {
    -webkit-overflow-scrolling: touch;
}

@supports (-webkit-touch-callout: none) {
    .input-container {
        padding-bottom: 6px;
    }
    .chat-area {
        height: -webkit-fill-available;
    }
}

@keyframes popup {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero-page::-webkit-scrollbar {
    width: 4px;
}
.hero-page::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}
/* ======================================== */
/* TRANSITION OVERLAY - Efek mengembang */
/* ======================================== */

.transition-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: #0a0a1a;
    pointer-events: none;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 50%;
    will-change: transform, opacity;
    display: flex;
    justify-content: center;
    align-items: center;
}

.transition-overlay.active {
    opacity: 1;
    transform: scale(20);
    border-radius: 0;
    pointer-events: auto;
}

.transition-overlay .transition-loader {
    position: absolute;
    width: 48px;
    height: 48px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top: 3px solid #10a37f;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.transition-overlay.active .transition-loader {
    opacity: 1;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

body.dark-mode .transition-overlay {
    background: #0a0a0a;
}

/* ======================================== */
/* RESPONSIVE UNTUK TRANSITION OVERLAY */
/* ======================================== */

@media(max-width:768px) {
    .transition-overlay.active {
        transform: scale(30);
    }
}

@media(max-width:380px) {
    .transition-overlay.active {
        transform: scale(40);
    }
}