/* --- FILE: static/style.css --- */
* { box-sizing: border-box; }
body { margin: 0; font-family: sans-serif; background: #343541; color: white; display: flex; height: 100vh; overflow: hidden; transition: background 0.3s, color 0.3s; }

.mobile-header { display: none; background: #202123; height: 60px; width: 100%; align-items: center; justify-content: space-between; padding: 0 15px; border-bottom: 1px solid #4d4d4f; z-index: 10; transition: background 0.3s;}
.hamburger-btn, .mobile-new-btn { background: transparent; border: none; color: #d1d1d1; font-size: 24px; cursor: pointer; }
.mobile-title { font-size: 16px; font-weight: bold; color: #19c37d; }
.sidebar-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); z-index: 998; }

.sidebar { width: 260px; background: #202123; padding: 10px; display: flex; flex-direction: column; border-right: 1px solid #4d4d4f; z-index: 999; }
.close-sidebar-btn { display: none; background: transparent; border: none; color: #8e8ea0; font-size: 24px; cursor: pointer; text-align: right; margin-bottom: 10px;}

.new-chat-btn { background: transparent; border: 1px solid #4d4d4f; color: white; padding: 12px; border-radius: 6px; cursor: pointer; margin-bottom: 15px; font-weight: bold; width: 100%; text-align: left; transition: 0.2s; }
.new-chat-btn:hover { background: #2a2b32; border-color: #19c37d; }

.main-menu-container { margin-bottom: 15px; border-bottom: 1px solid #4d4d4f; padding-bottom: 10px; }

.history-list { flex: 1; overflow-y: auto; }
.history-item-container { display: flex; align-items: center; margin-bottom: 5px; position: relative; }
.history-item { flex: 1; padding: 12px 10px; border-radius: 6px; cursor: pointer; font-size: 13px; background: #2a2b32; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 35px; }
.history-item.active { background: #444654; border: 1px solid #19c37d; }
.delete-btn { background: transparent; border: none; color: #ef4444; cursor: pointer; padding: 8px; display: block; position: absolute; right: 2px; font-size: 16px; transition: transform 0.2s; z-index: 2;}

.sidebar-bottom { margin-top: auto; border-top: 1px solid #4d4d4f; padding-top: 10px; }
.menu-btn { background: transparent; border: none; color: #d1d1d1; padding: 12px 10px; width: 100%; text-align: left; border-radius: 6px; cursor: pointer; font-size: 13px; font-weight: bold; transition: 0.2s; }
.menu-btn:hover { background: #2a2b32; color: white; }
.logout-btn { color: #ef4444 !important; }
.login-btn-sidebar { background: #19c37d !important; color: white !important; text-align: center !important; }

.main { flex: 1; display: flex; flex-direction: column; background: #343541; transition: background 0.3s; position: relative; width: 100%;}

.top-right-auth { position: absolute; top: 15px; right: 20px; z-index: 100; display: flex; gap: 10px; align-items: center;}
.lang-switch { background-color: #202123; border: 1px solid #565869; color: #ececf1; padding: 8px 15px; border-radius: 8px; font-size: 13px; font-weight: bold; cursor: pointer; outline: none; appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ececf1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e"); background-repeat: no-repeat; background-position: right 10px center; background-size: 14px; padding-right: 30px; transition: all 0.2s ease; }

.label-status { padding: 3px 8px; border-radius: 12px; font-size: 10px; font-weight: 900; letter-spacing: 0.5px; text-transform: uppercase; }
.label-pro { background: linear-gradient(135deg, #FFD700 0%, #FDB931 100%); color: #1a1a1a; box-shadow: 0 0 5px rgba(255,215,0,0.4); border: none; }
.label-free { background: #444654; color: #d1d1d1; border: 1px solid #565869; }
.watermark-sidebar { text-align: center; font-size: 13px; color: #d1d1d1; margin-top: 15px; padding-bottom: 10px; display: flex; flex-direction: column; align-items: center; gap: 8px;}

.chat-container { flex: 1; overflow-y: auto; padding: 60px 0 20px 0; scroll-behavior: smooth;}
.message-row { display: flex; flex-direction: column; padding: 25px 20px; width: 100%; border-bottom: 1px solid rgba(0,0,0,0.1); }
.user-row { background: #343541; }
.bot-row { background: #444654; }
.message-content { max-width: 750px; margin: 0 auto; line-height: 1.6; font-size: 15px; width: 100%; white-space: normal; position: relative;}

.message-content table { display: block; width: 100%; overflow-x: auto; border-spacing: 0; white-space: normal; border-collapse: collapse; margin: 15px 0; }
.message-content pre { background: #000000; padding: 15px; border-radius: 8px; overflow-x: auto; border: 1px solid #4d4d4f;}
.message-content code { color: #19c37d;}
.message-content th, .message-content td { border: 1px solid #565869; padding: 10px; text-align: left; min-width: 120px;}
.message-content th { background: #444654; color: #19c37d; }

.action-buttons { display: flex; gap: 15px; margin-top: 10px; align-items: center; flex-wrap: wrap;}
.action-btn { background: transparent; border: none; cursor: pointer; font-size: 12px; color: #d1d1d1; }
.action-btn:hover { color: #19c37d; }

.suggestion-box { max-width: 750px; margin: 15px auto 0 auto; display: flex; gap: 8px; flex-wrap: wrap; width: 100%; }
.sug-btn { background: #3e3f4b; border: 1px solid #565869; color: #d1d1d1; padding: 8px 15px; border-radius: 20px; cursor: pointer; font-size: 13px; transition: 0.2s;}
.sug-btn:hover { background: #2a2b32; border-color: #19c37d; color: white;}

.input-area { padding: 20px; width: 100%; transition: padding 0.5s ease;}
.input-wrapper { width: 100%; max-width: 750px; margin: auto; display: flex; align-items: center; background: #40414f; border-radius: 15px; padding: 8px 12px;}

.main.is-empty { justify-content: center; }
.main.is-empty .chat-container { display: none; }
.main.is-empty .input-area { padding-bottom: 10vh; background: transparent; }

.welcome-container { text-align: center; margin-bottom: 25px; display: none; padding: 0 15px; }
.main.is-empty .welcome-container { display: block; }
.welcome-title { font-size: 2.2rem; font-weight: bold; color: #d1d1d1; margin-bottom: 15px; margin-top: 0; }
.welcome-title span { color: #19c37d; }
.welcome-subtitle { font-size: 1.1rem; color: #8e8ea0; line-height: 1.6; max-width: 600px; margin: 0 auto; }

.mobile-login-box { background: rgba(68, 70, 84, 0.5); border: 1px dashed #565869; padding: 20px; border-radius: 15px; margin: 20px auto; max-width: 400px; text-align: center; }

.welcome-suggestions { display: none; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 20px; }
.main.is-empty .welcome-suggestions { display: flex; }
.welcome-sug-btn { background: rgba(0,0,0,0.2); border: 1px solid #4d4d4f; color: #d1d1d1; padding: 10px 15px; border-radius: 20px; cursor: pointer; font-size: 13px; transition: 0.2s; font-weight: bold;}
.welcome-sug-btn:hover { background: #2a2b32; border-color: #19c37d; color: white; }

.pro-input-btn { background: rgba(255, 215, 0, 0.15); border: 1px solid #FFD700; color: #FFD700; border-radius: 8px; padding: 8px 12px; font-size: 13px; font-weight: bold; cursor: pointer; margin-right: 8px;}
.mic-btn { background: transparent; border: none; font-size: 22px; cursor: pointer; padding: 0 10px;}
input { flex: 1; min-width: 0; background: transparent; border: none; color: white; padding: 12px 10px; outline: none; font-size: 16px; }
.send-btn { background: #19c37d; color: white; border: none; padding: 12px 18px; border-radius: 10px; cursor: pointer; font-weight: bold; margin-left: 5px; min-width: 80px;}

.input-disclaimer { max-width: 750px; margin: 15px auto 5px auto; text-align: center; font-size: 11px; color: #8e8ea0; }

.sholat-footer-area { text-align: center; padding-bottom: 20px; }
.sholat-mini-list { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; font-size: 10px; color: #8e8ea0; opacity: 0.7; margin-bottom: 4px; }
.sholat-mini-item { border-right: 1px solid #4d4d4f; padding-right: 8px; line-height: 1.2; }
.sholat-mini-item:last-child { border: none; }
.btn-sync-mini { background: none; border: none; color: #19c37d; font-size: 10px; cursor: pointer; text-decoration: underline; padding: 0; }

.typing-indicator { display: inline-flex; align-items: center; gap: 8px; padding: 12px 16px; background: rgba(25, 195, 125, 0.15); border-radius: 20px; margin-top: 10px; border: 1px solid rgba(25, 195, 125, 0.3); }
.dot { width: 10px; height: 10px; background-color: #19c37d; border-radius: 50%; animation: loadingBounce 1.4s infinite ease-in-out both; }
.dot:nth-child(1) { animation-delay: -0.32s; }
.dot:nth-child(2) { animation-delay: -0.16s; }
@keyframes loadingBounce { 0%, 80%, 100% { transform: translateY(0) scale(0.6); opacity: 0.4; } 40% { transform: translateY(-8px) scale(1.1); opacity: 1; } }

.btn-loading { display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 0 5px; }
.btn-dot { width: 6px; height: 6px; background-color: white; border-radius: 50%; animation: waveBounce 1.2s infinite ease-in-out; }
.btn-dot:nth-child(1) { animation-delay: -0.24s; }
.btn-dot:nth-child(2) { animation-delay: -0.12s; }
@keyframes waveBounce { 0%, 80%, 100% { transform: translateY(0); opacity: 0.6; } 40% { transform: translateY(-5px); opacity: 1; } }

.office-box { background: rgba(0,0,0,0.2); border: 1px solid #4d4d4f; padding: 15px; border-radius: 8px; text-align: center; color: #8e8ea0; font-size: 12px; margin-top: 10px; line-height: 1.5; }

@media (max-width: 768px) {
    body { flex-direction: column; }
    .mobile-header { display: flex; }
    .desktop-lang { display: none !important; }
    .sidebar { position: fixed; left: -300px; top: 0; height: 100%; width: 280px; box-shadow: 5px 0 15px rgba(0,0,0,0.5); z-index: 999; transition: 0.3s; }
    .sidebar.active { left: 0; }
    .close-sidebar-btn { display: block; }
    .main { height: calc(100vh - 60px); }
    .chat-container { padding: 20px 0; }
    .message-row { padding: 15px; }
    .welcome-title { font-size: 1.8rem; }
    .welcome-subtitle { font-size: 0.95rem; }
    .main.is-empty .input-area { padding-bottom: 5vh; }
    .input-area { padding: 10px 10px 15px 10px; background: #343541; border-top: 1px solid #4d4d4f; padding-bottom: calc(15px + env(safe-area-inset-bottom)); }
    .input-wrapper { border-radius: 25px; padding: 5px 8px;}
    .pro-input-btn { padding: 6px; font-size: 11px; }
    input { font-size: 15px; padding: 10px;}
    .send-btn { padding: 10px 15px; border-radius: 20px;}
    .mobile-login-box { margin: 15px 10px; padding: 15px; }
    .input-disclaimer { margin-top: 10px; font-size: 10px; line-height: 1.3;}
}

/* MODAL STYLES */
.modal { display: none; position: fixed; z-index: 10000; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(0,0,0,0.7); }
.modal-content { background-color: #202123; margin: 5vh auto; padding: 25px; border: 1px solid #4d4d4f; border-radius: 15px; width: 92%; max-width: 450px; max-height: 85vh; overflow-y: auto; color: white;}
.modal-header { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #4d4d4f; padding-bottom: 15px; margin-bottom: 15px; }
.modal-header h2 { margin: 0; font-size: 18px; }
.close-btn { color: #8e8ea0; font-size: 28px; font-weight: bold; cursor: pointer; background: none; border: none; padding: 0;}
.setting-item { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,0.05); }
.danger-btn { background: #ef4444; color: white; border: none; padding: 10px 15px; border-radius: 8px; cursor: pointer; font-weight: bold; }
.toggle-btn { background: #444654; color: white; border: 1px solid #565869; padding: 10px 15px; border-radius: 8px; cursor: pointer; font-weight: bold;}
.modal-input { width: 100%; padding: 12px; border-radius: 8px; background: #343541; color: white; border: 1px solid #565869; font-size: 15px; margin-top: 10px; outline: none; }
.payment-submit { width: 100%; padding: 15px; background: #19c37d; color: white; border: none; border-radius: 8px; font-size: 16px; font-weight: bold; margin-top: 20px; cursor: pointer; transition: 0.2s;}
.payment-submit:disabled { background: #4d4d4f; cursor: not-allowed; }
.export-option-btn { width: 100%; padding: 15px; background: #343541; color: white; border: 1px solid #565869; border-radius: 10px; font-size: 14px; font-weight: bold; margin-top: 10px; cursor: pointer; text-align: left; display: flex; gap: 10px;}
.story-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.story-btn { background: #3e3f4b; border: 1px solid #565869; color: white; padding: 12px; border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: bold; text-align: center; }

/* USTADZ LIVE CHAT MODAL CSS */
.ustadz-item { background: #343541; border: 1px solid #565869; border-radius: 10px; padding: 15px; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; cursor: pointer; transition: 0.2s;}
.ustadz-item:hover { border-color: #19c37d; background: rgba(25, 195, 125, 0.1); }
.ustadz-info h3 { margin: 0 0 5px 0; font-size: 16px; }
.ustadz-info p { margin: 0; font-size: 12px; color: #8e8ea0; }
.badge-online { background: #25D366; color: white; font-size: 10px; padding: 3px 8px; border-radius: 10px; font-weight: bold; }
.badge-offline { background: #4d4d4f; color: white; font-size: 10px; padding: 3px 8px; border-radius: 10px; font-weight: bold; }

.chat-disclaimer { background: rgba(239, 68, 68, 0.1); border: 1px solid #ef4444; padding: 10px; border-radius: 8px; font-size: 11px; color: #ff8a8a; margin-bottom: 15px; text-align: justify; line-height: 1.4;}
.timer-box { font-size: 24px; font-weight: bold; color: #FFD700; text-align: center; margin-bottom: 10px; font-family: monospace; letter-spacing: 2px;}
.live-chat-box { background: #343541; height: 300px; border-radius: 10px; border: 1px solid #565869; padding: 15px; overflow-y: auto; margin-bottom: 10px; display: flex; flex-direction: column; gap: 10px;}
.lc-bubble { max-width: 80%; padding: 10px 15px; border-radius: 15px; font-size: 13px; line-height: 1.4;}
.lc-user { background: #19c37d; color: white; align-self: flex-end; border-bottom-right-radius: 2px;}
.lc-ustadz { background: #444654; color: white; align-self: flex-start; border-bottom-left-radius: 2px; border: 1px solid #565869;}
.lc-system { background: rgba(239, 68, 68, 0.15); color: #ff8a8a; align-self: center; text-align: center; font-size: 11px; border: 1px solid #ef4444; width: 95%; padding: 10px; border-radius: 8px; margin-top: 5px; margin-bottom: 5px;}

.spinner { border: 4px solid rgba(255,255,255,0.1); border-top: 4px solid #19c37d; border-radius: 50%; width: 40px; height: 40px; animation: spin 1s linear infinite; margin: 20px auto; }
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* RATING & ULASAN CSS KHUSUS JAMAAH */
.star-rating-jamaah { font-size: 40px; color: #565869; margin: 20px 0; cursor: pointer; display: flex; justify-content: center; gap: 8px; }
.star-rating-jamaah .star { transition: transform 0.2s; }
.star-rating-jamaah .star:hover { transform: scale(1.2); }
.ulasan-input { width: 100%; padding: 15px; border-radius: 12px; background: rgba(0,0,0,0.3); border: 1px solid #4d4d4f; color: white; margin-bottom: 20px; outline: none; font-size: 14px; resize: none; transition: 0.3s; }
.ulasan-input:focus { border-color: #19c37d; box-shadow: 0 0 10px rgba(25, 195, 125, 0.2); }

/* THEME STYLES */
body.light-mode { background: #ffffff; color: #202123; }
body.light-mode .mobile-header { background: #f9f9f9; border-color: #e5e5e5; }
body.light-mode .sidebar { background: #f9f9f9; border-color: #e5e5e5; }
body.light-mode .new-chat-btn { color: #202123; border-color: #d1d1d1; }
body.light-mode .history-item { background: #ececf1; color: #202123; }
body.light-mode .menu-btn { color: #444; }
body.light-mode .main { background: #ffffff; }
body.light-mode .user-row { background: #ffffff; }
body.light-mode .bot-row { background: #f7f7f8; border-top: 1px solid #e5e5e5; border-bottom: 1px solid #e5e5e5; }
body.light-mode .input-wrapper { background: #f0f0f0; border: 1px solid #d1d1d1; box-shadow: none; }
body.light-mode input { color: #202123; }
body.light-mode .modal-content { background-color: #ffffff; color: #202123; border-color: #e5e5e5; }
body.light-mode .modal-header { border-color: #e5e5e5; }
body.light-mode .toggle-btn, body.light-mode .export-option-btn, body.light-mode .modal-input, body.light-mode .story-btn { background: #f9f9f9; color: black; border-color: #d1d1d1; }
body.light-mode .message-content pre { background: #f0f0f0; border-color: #d1d1d1; }
body.light-mode .welcome-title { color: #202123; }
body.light-mode .welcome-sug-btn { background: #f9f9f9; border-color: #d1d1d1; color: #444; }
body.light-mode .label-free { background: #e5e5e5; color: #666; border-color: #ccc; }
body.light-mode .watermark-sidebar { color: #444; }
body.light-mode .mobile-login-box { background: #f9f9f9; border-color: #d1d1d1; }
body.light-mode .office-box { background: #f9f9f9; border-color: #d1d1d1; color: #666; }
body.light-mode .sholat-mini-item { border-color: #ccc; }
body.light-mode .ustadz-item { background: #f9f9f9; border-color: #ccc; }
body.light-mode .live-chat-box { background: #f0f0f0; border-color: #ccc; }
body.light-mode .lc-ustadz { background: #ffffff; color: #000; border-color: #ccc; }
body.light-mode .ulasan-input { background: #f9f9f9; color: #000; border-color: #ccc;}
body.light-mode .lang-switch { background-color: #f9f9f9; color: #333; border-color: #ccc; background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23333333' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e"); }

#searchModal .modal-content { background-color: #121212; border: 1px solid #333; border-radius: 16px; padding: 30px; max-width: 650px; margin: 8vh auto; color: #fff; box-shadow: 0 10px 40px rgba(0,0,0,0.8); }
.search-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; }
.search-header h2 { margin: 0; font-size: 26px; font-weight: 500; }
.search-input-wrapper { position: relative; width: 100%; margin-bottom: 30px; background: #202123; border: 1px solid #333; border-radius: 30px; display: flex; align-items: center; padding: 0 20px; }
.search-input-wrapper input { width: 100%; background: transparent; border: none; padding: 15px 10px; color: white; font-size: 16px; outline: none; }
.search-input-wrapper svg { fill: #888; width: 22px; height: 22px; }
.search-section-title { font-size: 15px; font-weight: bold; margin-bottom: 10px; color: #fff; }
.search-result-item { display: flex; justify-content: space-between; align-items: center; padding: 15px 10px; border-bottom: 1px solid #222; cursor: pointer; color: #ececf1; border-radius: 8px; transition: 0.2s; }
.search-result-item:hover { background: rgba(255,255,255,0.08); }
.search-result-title { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 85%; }
.search-result-date { font-size: 13px; color: #8e8ea0; }
body.light-mode #searchModal .modal-content { background-color: #ffffff; color: #000; border-color: #ddd; }
body.light-mode .search-input-wrapper { background: #f9f9f9; border-color: #ccc; }
body.light-mode .search-input-wrapper input { color: #000; }
body.light-mode .search-section-title { color: #000; }
body.light-mode .search-result-item { color: #333; border-color: #eee; }
body.light-mode .search-result-item:hover { background: #f0f0f0; }

input[type="file"]::file-selector-button { background-color: #444654; color: white; border: 1px solid #565869; padding: 5px 10px; border-radius: 5px; cursor: pointer; }