@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root { --primary: #1e1b4b; --secondary: #4f46e5; --accent: #06b6d4; --text-dark: #1e293b; --bg-light: #f8fafc; --surface: rgba(255, 255, 255, 0.6); --glass-border: rgba(255, 255, 255, 0.4); --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1); }
body { font-family: 'Inter', sans-serif; margin: 0; padding: 0; background: linear-gradient(135deg, #e0e7ff 0%, #cffafe 100%); color: var(--text-dark); min-height: 100vh; overflow-x: hidden; }

.navbar { background: rgba(255,255,255,0.7); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--glass-border); box-shadow: var(--glass-shadow); padding: 15px 30px; display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; z-index: 100; margin-bottom: 25px; transition: all 0.3s ease; }
.navbar h2 { color: var(--primary); margin: 0; font-weight: 800; letter-spacing: 0.5px; }
.nav-links { display: flex; gap: 10px; align-items: center; flex-wrap: wrap;}
.nav-btn { background: none; border: 2px solid var(--secondary); color: var(--secondary); padding: 8px 12px; border-radius: 6px; font-weight: bold; cursor: pointer; transition: 0.3s; font-size: 13px;}
.nav-btn.active { background: var(--secondary); color: white; } 
.nav-btn:hover { background: var(--primary); color: white; border-color: var(--primary);}

.btn-icon-action:hover { transform: scale(1.05); box-shadow: 0 4px 8px rgba(0,0,0,0.2); border-color: transparent !important; }

.wa-status-badge { padding: 8px 15px; border-radius: 20px; font-weight: bold; font-size: 12px; display: flex; align-items: center; gap: 8px; cursor: pointer; transition: 0.3s;}
.wa-connected { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.wa-disconnected { background: #fff3cd; color: #856404; border: 1px solid #ffeeba; animation: pulse 1.5s infinite; }
@keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.5; } 100% { opacity: 1; } }
.main-content { padding: 0 20px 20px 20px; max-width: 1400px; margin: 0 auto; }
.page { display: none; animation: fadeIn 0.4s; } .page.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.grid-container { display: flex; gap: 20px; width: 100%; align-items: stretch; }
.col-left { width: 55%; background: var(--surface); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); padding: 25px; border-radius: 12px; box-shadow: var(--glass-shadow); border: 1px solid var(--glass-border); display: flex; flex-direction: column;}
.col-right { width: calc(45% - 20px); background: var(--surface); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); padding: 25px; border-radius: 12px; box-shadow: var(--glass-shadow); border: 1px solid var(--glass-border); display: flex; flex-direction: column; }
@media (max-width: 992px) { .grid-container { flex-direction: column; } .col-left, .col-right { width: 100%; } }
label { display: block; font-weight: 700; margin-bottom: 8px; color: var(--primary); font-size: 14px; }
input[type="text"], input[type="password"], input[type="file"], input[type="number"], input[type="datetime-local"], textarea, select { width: 100%; padding: 10px; border: 2px solid #e1e5eb; border-radius: 6px; box-sizing: border-box; font-family: inherit; transition: 0.3s; margin-bottom: 15px;}
input:focus, textarea:focus, select:focus { border-color: var(--secondary); outline: none; }
input:disabled, textarea:disabled, select:disabled, .btn-small:disabled { background-color: #e9ecef !important; cursor: not-allowed; opacity: 0.7; color: #888 !important; }
.template-header { display: flex; justify-content: space-between; margin-bottom: 5px; align-items: center; }
.btn-small { padding: 5px 10px; font-size: 12px; border: none; border-radius: 4px; cursor: pointer; font-weight: bold; display: flex; align-items: center; justify-content: center; gap: 5px;}
.btn-save-tpl { background: #28a745; color: white; }
.btn-action { border: none; padding: 14px; font-size: 16px; border-radius: 8px; cursor: pointer; font-weight: 800; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); width: 100%; margin-top: 10px;}
#btnSubmit { background: linear-gradient(135deg, var(--secondary) 0%, var(--accent) 100%); color: white; box-shadow: 0 4px 15px rgba(79, 70, 229, 0.4); } #btnSubmit:hover:not(:disabled) { transform: translateY(-3px); box-shadow: 0 8px 25px rgba(79, 70, 229, 0.6); } #btnSubmit:disabled { background: #e2e8f0; color: #94a3b8; box-shadow: none; cursor: not-allowed; }
#btnResetForm { background: #64748b; color: white; } #btnResetForm:hover { background: #475569; }
.table-wrapper { flex: 1 1 0; overflow-y: auto; height: 0; margin-bottom: 15px; border: 1px solid #e1e5eb; border-radius: 6px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { border-bottom: 1px solid #e1e5eb; padding: 10px; text-align: left; }
th { background-color: var(--primary); color: white; position: sticky; top: 0; z-index: 10;}
.empty-state { text-align: center; color: #aaa; padding: 50px 0; font-style: italic; }
#logMsg { background: #1a1a2e; color: #00ffcc; padding: 12px; border-radius: 6px; font-family: monospace; font-size: 13px;}

/* --- CSS OVERLAY & MODAL (Perbaikan Lebar Modal) --- */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); backdrop-filter: blur(3px); display: none; justify-content: center; align-items: center; z-index: 2000; animation: fadeIn 0.2s;}
.modal-content { background: white; padding: 30px; border-radius: 12px; text-align: center; width: 90%; max-width: 400px; box-shadow: 0 15px 30px rgba(0,0,0,0.3); transform: translateY(0); animation: slideUp 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);}
@keyframes slideUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
.modal-content img { width: 250px; height: 250px; margin: 20px 0; border: 10px solid #f4f7f6; border-radius: 10px;}
.modal-title { font-size: 20px; font-weight: 800; color: var(--primary); margin-top: 0; margin-bottom: 15px; }
.modal-text { font-size: 15px; color: #555; margin-bottom: 25px; line-height: 1.5; }
.modal-buttons { display: flex; gap: 10px; justify-content: center; }
.btn-modal { padding: 10px 20px; border: none; border-radius: 6px; font-weight: bold; cursor: pointer; flex: 1; font-size: 14px; transition: 0.2s;}
.btn-modal-primary { background: var(--secondary); color: white; } .btn-modal-primary:hover { background: var(--primary); }
.btn-modal-danger { background: #dc3545; color: white; } .btn-modal-danger:hover { background: #c82333; }
.btn-modal-cancel { background: #e1e5eb; color: #333; } .btn-modal-cancel:hover { background: #d3d7dd; }

.contact-list-wrap { max-height: 180px; overflow-y: auto; border: 1px solid #e1e5eb; background: white; border-radius: 6px; padding: 5px; text-align: left !important;}
.contact-item { padding: 8px 10px; border-bottom: 1px solid #f4f7f6; display: flex; align-items: center; justify-content: flex-start; cursor: pointer; transition: background 0.2s; width: 100%; box-sizing: border-box; text-align: left !important;}
.contact-item:hover { background: #f0f8ff; }
.contact-item input[type="checkbox"] { margin: 0 10px 0 0 !important; flex-shrink: 0; width: 16px; height: 16px; cursor: pointer; }
.contact-item span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-grow: 1; color: #666; font-size: 13.5px; text-align: left !important; display: block; margin: 0;}
.contact-item span b { color: var(--text-dark); }
.btn-add { background: var(--bg-light); color: var(--primary); border: 2px dashed var(--primary); padding: 10px; border-radius: 6px; cursor: pointer; font-weight: bold; width: 100%; margin-bottom: 20px; transition: 0.3s;}
.btn-add:hover:not(:disabled) { background: #e0e8ff; } .btn-add:disabled { border-color: #ccc; color: #aaa; cursor: not-allowed; }
.header-tag { display: inline-block; background: var(--secondary); color: white; padding: 4px 10px; border-radius: 4px; font-size: 11px; font-weight: bold; cursor: pointer; transition: 0.2s; box-shadow: 0 2px 4px rgba(0,0,0,0.1);}
.header-tag:hover { background: var(--primary); transform: translateY(-1px); }
.dash-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-bottom: 20px; }
.card { background: var(--surface); backdrop-filter: blur(10px); border: 1px solid var(--glass-border); padding: 25px; border-radius: 12px; box-shadow: var(--glass-shadow); text-align: center; transition: 0.3s; }
.card:hover { transform: translateY(-5px); box-shadow: 0 12px 40px 0 rgba(31, 38, 135, 0.2); }
.card h3 { margin: 0; color: #666; font-size: 16px; text-transform: uppercase; }
.card .num { font-size: 40px; font-weight: 900; margin: 10px 0 0 0; color: var(--primary); }
.card.success .num { color: #28a745; }
.card.failed .num { color: #dc3545; }
.dash-table { background: var(--surface); backdrop-filter: blur(10px); border: 1px solid var(--glass-border); padding: 25px; border-radius: 12px; box-shadow: var(--glass-shadow); height: 500px; display: flex; flex-direction: column;}
.dash-table h3 { margin-top: 0; color: var(--primary); border-bottom: 2px solid #eee; padding-bottom: 10px;}
.badge { padding: 4px 8px; border-radius: 4px; font-size: 11px; font-weight: bold; color: white; }
.badge-sukses { background: #28a745; } .badge-gagal { background: #dc3545; }

/* --- CSS LOGIN OVERLAY --- */
#loginOverlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(30, 27, 75, 0.85); backdrop-filter: blur(8px); display: flex; justify-content: center; align-items: center; z-index: 1500; }
.login-box { background: var(--surface); padding: 40px; border-radius: 16px; box-shadow: 0 25px 50px rgba(0,0,0,0.25); border: 1px solid var(--glass-border); width: 100%; max-width: 350px; text-align: center; animation: slideUp 0.5s cubic-bezier(0.4, 0, 0.2, 1); }
.login-box h2 { color: var(--primary); margin-top: 0; margin-bottom: 25px; }
.pwd-container { position: relative; }
.pwd-container input { padding-right: 40px !important; }
.pwd-toggle { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; color: #888; display: flex; align-items: center; padding: 5px; margin-top: -7px;}
.pwd-toggle:hover { color: var(--primary); }
.forgot-link { font-size: 13px; color: var(--secondary); cursor: pointer; text-decoration: none; font-weight: bold; transition: 0.2s; }
.forgot-link:hover { color: var(--primary); text-decoration: underline; }

/* --- CSS TOOLBAR FORMATTING & EMOJI --- */
.format-toolbar { display: flex; gap: 5px; margin-bottom: 5px; background: #e1e5eb; padding: 5px; border-radius: 6px; align-items: center; }
.format-btn { background: white; border: 1px solid #ccc; border-radius: 4px; cursor: pointer; padding: 4px 10px; font-weight: bold; font-size: 13px; transition: 0.2s; display: flex; align-items: center; justify-content: center; height: 28px; color: #444; }
.format-btn:hover { background: var(--secondary); color: white; border-color: var(--secondary); }
.emoji-picker-container { display: none; background: white; border: 1px solid #ccc; border-radius: 6px; padding: 10px; margin-bottom: 8px; max-height: 150px; overflow-y: auto; grid-template-columns: repeat(auto-fill, minmax(30px, 1fr)); gap: 5px; box-shadow: inset 0 2px 4px rgba(0,0,0,0.05); }
.emoji-picker-container.active { display: grid; animation: fadeIn 0.2s; }
.emoji-btn { font-size: 20px; cursor: pointer; text-align: center; border-radius: 4px; padding: 4px 0; transition: 0.2s; user-select: none; }
.emoji-btn:hover { background: #f0f8ff; transform: scale(1.2); }

/* --- CSS DEVICE HEALTH CARD & PREVIEW MODAL --- */
.health-card { border: 1px solid #e1e5eb; border-radius: 8px; padding: 15px; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; background: #fff;}
.indicator { width: 12px; height: 12px; border-radius: 50%; display: inline-block; margin-right: 8px; }
.status-ok { background-color: #28a745; box-shadow: 0 0 8px #28a745; }
.status-warn { background-color: #ffc107; box-shadow: 0 0 8px #ffc107; }
.status-err { background-color: #dc3545; box-shadow: 0 0 8px #dc3545; }
.progress-container { width: 100%; background: #e9ecef; border-radius: 4px; height: 8px; margin-top: 5px;}
.progress-bar { height: 100%; border-radius: 4px; transition: 0.4s; }
.preview-box { background: #f8faff; border: 1px solid #1E90FF; padding: 10px; border-radius: 6px; margin-bottom: 10px; text-align: left; font-size:13px; max-height: 150px; overflow-y:auto;}