/* chats.css - Style untuk halaman chat Garz AI (LENGKAP) */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #0a0a0a;
}

.security-warning-chat {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(239,68,68,0.95);
    color: white;
    padding: 10px 16px;
    border-radius: 12px;
    font-size: 12px;
    z-index: 10001;
    backdrop-filter: blur(4px);
    cursor: pointer;
    display: none;
    animation: shakeWarning 0.5s ease;
}

@keyframes shakeWarning {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

body.premium-theme {
    background: linear-gradient(135deg, #0a0a0a 0%, #0f0f1a 100%);
}

body.premium-theme .sidebar {
    background: rgba(10,10,10,0.95);
    backdrop-filter: blur(10px);
    border-right: 1px solid rgba(99,102,241,0.3);
}

body.premium-theme .main-header {
    background: rgba(10,10,10,0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(99,102,241,0.3);
}

body.premium-theme .mode-icon {
    box-shadow: 0 0 15px rgba(99,102,241,0.5);
    animation: premiumGlow 2s infinite;
}

@keyframes premiumGlow {
    0%, 100% { box-shadow: 0 0 5px rgba(99,102,241,0.3); }
    50% { box-shadow: 0 0 20px rgba(99,102,241,0.8); }
}

body.premium-theme .message-bubble {
    border: 1px solid rgba(99,102,241,0.2);
    background: rgba(26,26,26,0.9);
    backdrop-filter: blur(5px);
}

body.premium-theme .message.user .message-bubble {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border: none;
    box-shadow: 0 4px 15px rgba(99,102,241,0.3);
}

body.premium-theme .typing-thinking {
    background: rgba(26,26,26,0.9);
    backdrop-filter: blur(5px);
    border: 1px solid rgba(99,102,241,0.3);
}

body.premium-theme .input-wrapper {
    border: 1px solid rgba(99,102,241,0.3);
    background: rgba(26,26,26,0.9);
}

body.premium-theme .send-btn {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    box-shadow: 0 2px 10px rgba(99,102,241,0.3);
}

body.premium-theme .premium-badge-header {
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    color: white;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: 12px;
    animation: premiumBadgePulse 2s infinite;
}

@keyframes premiumBadgePulse {
    0%, 100% { opacity: 0.8; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.05); }
}

.limit-modal, .apierror-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.95);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}

.limit-modal.show, .apierror-modal.show {
    display: flex;
}

.limit-modal-content, .apierror-content {
    background: linear-gradient(135deg, #1a1a1a, #0f0f0f);
    border-radius: 32px;
    padding: 40px;
    width: 90%;
    max-width: 400px;
    text-align: center;
    border: 1px solid rgba(99,102,241,0.3);
}

.apierror-content {
    border: 1px solid rgba(239,68,68,0.3);
}

.limit-modal-content i, .apierror-content i {
    font-size: 64px;
    margin-bottom: 20px;
}

.limit-modal-content i {
    color: #f59e0b;
}

.apierror-content i {
    color: #ef4444;
}

.limit-modal-content h3, .apierror-content h3 {
    color: white;
    font-size: 24px;
    margin-bottom: 12px;
}

.limit-modal-content p, .apierror-content p {
    color: #9ca3af;
    font-size: 14px;
    margin-bottom: 24px;
    line-height: 1.6;
}

.upgrade-now-btn {
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    border: none;
    padding: 14px 28px;
    border-radius: 40px;
    color: white;
    font-weight: 700;
    cursor: pointer;
    font-size: 16px;
    width: 100%;
}

.close-limit-btn, .apierror-content button {
    background: rgba(255,255,255,0.1);
    border: none;
    padding: 10px 20px;
    border-radius: 40px;
    color: white;
    cursor: pointer;
    margin-top: 12px;
    width: 100%;
}

.apierror-content button {
    background: #6366f1;
}

.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(8px);
    z-index: 198;
    display: none;
}

.sidebar-overlay.open {
    display: block;
}

.sidebar {
    position: fixed;
    top: 0;
    left: -300px;
    bottom: 0;
    width: 300px;
    background: #111;
    z-index: 199;
    transition: left 0.3s ease;
    padding: 20px 0;
    overflow-y: auto;
    border-right: 1px solid rgba(99,102,241,0.2);
}

.sidebar.open {
    left: 0;
}

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

.sidebar-logo {
    font-size: 18px;
    font-weight: 800;
    background: linear-gradient(135deg, #fff, #a5b4fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.close-sidebar {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
}

.close-sidebar:hover {
    background: #1a1a1a;
}

.sidebar-section {
    padding: 20px;
}

.section-title {
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
    margin-bottom: 16px;
    letter-spacing: 0.5px;
}

.new-chat-btn {
    width: 100%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border: none;
    border-radius: 30px;
    padding: 10px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.history-list {
    max-height: 300px;
    overflow-y: auto;
}

.history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    margin-bottom: 6px;
    border-radius: 12px;
    cursor: pointer;
    color: #9ca3af;
    font-size: 13px;
    transition: 0.2s;
}

.history-item:hover {
    background: #1a1a1a;
    color: white;
}

.history-item.active {
    background: rgba(99,102,241,0.2);
    color: #6366f1;
}

.history-actions {
    display: flex;
    gap: 8px;
    opacity: 0;
    transition: 0.2s;
}

.history-item:hover .history-actions {
    opacity: 1;
}

.edit-chat-name {
    cursor: pointer;
    color: #9ca3af;
    font-size: 12px;
}

.edit-chat-name:hover {
    color: #f59e0b;
}

.delete-history {
    cursor: pointer;
    color: #9ca3af;
    font-size: 12px;
}

.delete-history:hover {
    color: #ef4444;
}

.sidebar-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    color: #d4d4d4;
    cursor: pointer;
    transition: 0.2s;
    font-size: 14px;
}

.sidebar-menu-item:hover {
    color: #6366f1;
    transform: translateX(4px);
}

.sidebar-menu-item i {
    width: 24px;
}

.sidebar-profile {
    padding: 20px;
    border-top: 1px solid #1a1a1a;
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: auto;
    cursor: pointer;
}

.sidebar-profile:hover {
    background: #1a1a1a;
}

.profile-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
}

.profile-name {
    font-weight: 600;
    font-size: 14px;
    color: white;
}

.profile-email {
    font-size: 11px;
    color: #6b7280;
}

.logout-btn {
    margin: 16px;
    padding: 10px;
    background: rgba(239,68,68,0.15);
    border: 1px solid #ef4444;
    color: #ef4444;
    border-radius: 30px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #0a0a0a;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

.main-header {
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #1a1a1a;
    background: #0a0a0a;
}

.menu-btn {
    background: none;
    border: none;
    font-size: 22px;
    color: white;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.menu-btn:hover {
    background: #1a1a1a;
}

.mode-indicator {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mode-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #1a1a1a;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.mode-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mode-text {
    color: white;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-area {
    flex: 1;
    overflow-y: auto;
    padding: 24px 20px;
    display: flex;
    flex-direction: column;
}

.chat-wrapper {
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
}

.landing-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    height: 100%;
    min-height: 450px;
}

.landing-logo {
    width: 130px;
    height: 130px;
    border-radius: 50%;
    margin-bottom: 28px;
    cursor: pointer;
    animation: logoFloat 2.5s ease-in-out infinite;
    transition: transform 0.2s;
}

.landing-logo:hover {
    transform: scale(1.05);
}

@keyframes logoFloat {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-18px) rotate(4deg); }
}

.landing-logo img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 0 35px rgba(99,102,241,0.5);
    border: 2px solid rgba(99,102,241,0.4);
}

.landing-title {
    font-size: 32px;
    font-weight: 800;
    background: linear-gradient(135deg, #fff, #a5b4fc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 12px;
}

.landing-subtitle {
    color: #6b7280;
    font-size: 14px;
    font-weight: 500;
}

.message {
    display: flex;
    gap: 14px;
    margin-bottom: 24px;
    animation: fadeIn 0.3s ease;
}

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

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

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
    overflow: hidden;
}

.message-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.message.user .message-avatar {
    background: #6366f1;
}

.message-bubble {
    background: #1a1a1a;
    padding: 12px 18px;
    border-radius: 20px;
    line-height: 1.6;
    font-size: 14px;
    max-width: 80%;
    color: #e2e8f0;
    border: 1px solid #2a2a2a;
    transition: all 0.3s;
}

.message.user .message-bubble {
    background: #6366f1;
    color: white;
    border: none;
}

.typing-thinking {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: #1a1a1a;
    border-radius: 24px;
    width: fit-content;
    color: #a5b4fc;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s;
}

.typing-thinking img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}

.thinking-dots {
    display: flex;
    gap: 6px;
}

.thinking-dots span {
    width: 8px;
    height: 8px;
    background: #6366f1;
    border-radius: 50%;
    animation: thinkingBounce 1.4s infinite;
}

.thinking-dots span:nth-child(1) { animation-delay: 0s; }
.thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes thinkingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-8px); opacity: 1; }
}

.code-block-wrapper {
    position: relative;
    margin: 12px 0;
    border-radius: 12px;
    overflow: hidden;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #1a1a1a;
    border-bottom: 1px solid #2a2a2a;
    font-size: 12px;
    color: #9ca3af;
}

.code-buttons {
    display: flex;
    gap: 8px;
}

.copy-code-btn, .preview-code-btn {
    background: rgba(99,102,241,0.2);
    border: none;
    color: #a5b4fc;
    padding: 4px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 11px;
}

.copy-code-btn:hover, .preview-code-btn:hover {
    background: rgba(99,102,241,0.4);
}

.message-bubble pre {
    margin: 0;
    padding: 16px;
    overflow-x: auto;
    background: #0a0a0a;
}

.preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.95);
    z-index: 1001;
    display: none;
    align-items: center;
    justify-content: center;
}

.preview-modal.show {
    display: flex;
}

.preview-content {
    width: 90%;
    max-width: 1000px;
    height: 80vh;
    background: white;
    border-radius: 16px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.preview-header {
    padding: 12px 16px;
    background: #1a1a1a;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #2a2a2a;
}

.preview-header h4 {
    color: white;
}

.close-preview {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
}

.preview-frame {
    flex: 1;
    width: 100%;
    border: none;
    background: white;
}

.input-footer {
    padding: 16px 22px;
    background: #0a0a0a;
    border-top: 1px solid #1a1a1a;
    transition: all 0.3s;
}

.input-container {
    max-width: 900px;
    margin: 0 auto;
    position: relative;
}

.input-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 32px;
    padding: 4px 4px 4px 20px;
    transition: all 0.3s;
}

.input-group {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.chat-input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 12px 0;
    color: white;
    font-size: 14px;
    outline: none;
    min-width: 0;
}

.ai-select-wrapper {
    display: flex;
    align-items: center;
    background: #2a2a2a;
    border-radius: 30px;
    padding: 6px 12px;
    gap: 8px;
    cursor: pointer;
    flex-shrink: 0;
}

.ai-select-wrapper img {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    object-fit: cover;
}

.ai-select-wrapper .ai-groq-logo {
    width: 22px;
    height: 22px;
    background: #f97316;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 12px;
    color: white;
}

.ai-select-wrapper span {
    color: white;
    font-size: 13px;
    font-weight: 500;
}

.ai-select-wrapper i {
    font-size: 11px;
    color: #6b7280;
}

.ai-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    margin-bottom: 8px;
    background: #1a1a1a;
    border-radius: 16px;
    overflow: hidden;
    min-width: 170px;
    z-index: 100;
    display: none;
    border: 1px solid #2a2a2a;
}

.ai-dropdown.show {
    display: block;
}

.ai-option {
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: 0.2s;
    color: white;
    font-size: 14px;
}

.ai-option:hover {
    background: #2a2a2a;
}

.ai-option img {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    object-fit: cover;
}

.ai-option .ai-groq-logo {
    width: 22px;
    height: 22px;
    background: #f97316;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 12px;
    color: white;
}

.ai-option.active {
    background: #6366f1;
}

.upload-btn {
    background: none;
    border: none;
    color: #6b7280;
    font-size: 18px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: 0.2s;
    flex-shrink: 0;
}

.upload-btn:hover {
    background: #2a2a2a;
    color: #6366f1;
}

.send-btn {
    background: #6366f1;
    border: none;
    border-radius: 28px;
    padding: 8px 20px;
    color: white;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    transition: 0.2s;
    flex-shrink: 0;
}

.send-btn:hover {
    background: #8b5cf6;
    transform: translateY(-1px);
}

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

.file-preview {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: #1a1a1a;
    border-radius: 20px;
    margin-bottom: 10px;
    width: fit-content;
}

.file-preview img {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    object-fit: cover;
}

.cancel-file {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
}

.footer-note {
    text-align: center;
    margin-top: 12px;
    font-size: 9px;
    color: #4b5563;
    letter-spacing: 2px;
}

.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: #10b981;
    color: white;
    padding: 10px 20px;
    border-radius: 30px;
    font-size: 13px;
    z-index: 1002;
    animation: toastFade 2.5s forwards;
}

@keyframes toastFade {
    0% { opacity: 0; transform: translateX(-50%) translateY(20px); }
    10% { opacity: 1; transform: translateX(-50%) translateY(0); }
    90% { opacity: 1; }
    100% { opacity: 0; transform: translateX(-50%) translateY(-20px); }
}

.edit-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(8px);
    z-index: 1003;
    display: none;
    align-items: center;
    justify-content: center;
}

.edit-modal.show {
    display: flex;
}

.edit-modal-content {
    background: #1a1a1a;
    border-radius: 24px;
    padding: 24px;
    width: 90%;
    max-width: 400px;
    border: 1px solid #2a2a2a;
}

.edit-modal-content h3 {
    color: white;
    margin-bottom: 16px;
}

.edit-modal-content input {
    width: 100%;
    padding: 12px;
    background: #0a0a0a;
    border: 1px solid #2a2a2a;
    border-radius: 12px;
    color: white;
    margin-bottom: 20px;
}

.edit-modal-buttons {
    display: flex;
    gap: 12px;
}

.btn-save {
    background: #6366f1;
    border: none;
    color: white;
    padding: 10px 20px;
    border-radius: 30px;
    cursor: pointer;
}

.btn-cancel {
    background: #2a2a2a;
    border: none;
    color: white;
    padding: 10px 20px;
    border-radius: 30px;
    cursor: pointer;
}

@media (max-width: 768px) {
    .message-bubble { max-width: 85%; font-size: 15px; padding: 12px 16px; }
    .mode-text { font-size: 16px; }
    .landing-logo { width: 120px; height: 120px; }
    .send-btn { padding: 10px 20px; font-size: 14px; }
    .message-avatar { width: 42px; height: 42px; }
    .main-header { padding: 14px 18px; }
    .chat-area { padding: 20px 16px; }
    .input-footer { padding: 12px 16px; }
    .ai-select-wrapper { padding: 5px 10px; }
    .ai-select-wrapper span { font-size: 12px; }
    .ai-select-wrapper img, .ai-select-wrapper .ai-groq-logo { width: 20px; height: 20px; font-size: 11px; }
    .chat-input { font-size: 15px; padding: 12px 0; }
}

@media (max-width: 480px) {
    .message-bubble { font-size: 14px; padding: 10px 14px; }
    .landing-logo { width: 100px; height: 100px; }
    .landing-title { font-size: 28px; }
    .ai-select-wrapper span { font-size: 11px; }
    .ai-select-wrapper { padding: 4px 8px; }
    .send-btn { padding: 8px 16px; font-size: 13px; }
}
