<?php
/* Smarty version 4.5.3, created on 2026-03-08 22:17:58
  from '/var/www/html/kaptembwa/system/plugin/ui/genieacs_installer.tpl' */

/* @var Smarty_Internal_Template $_smarty_tpl */
if ($_smarty_tpl->_decodeProperties($_smarty_tpl, array (
  'version' => '4.5.3',
  'unifunc' => 'content_69adcb66ee9628_61343126',
  'has_nocache_code' => false,
  'file_dependency' => 
  array (
    'f41027db023b21cadf2d15f16f11792d94346d2a' => 
    array (
      0 => '/var/www/html/kaptembwa/system/plugin/ui/genieacs_installer.tpl',
      1 => 1772949143,
      2 => 'file',
    ),
  ),
  'includes' => 
  array (
    'file:sections/header.tpl' => 1,
    'file:sections/footer.tpl' => 1,
  ),
),false)) {
function content_69adcb66ee9628_61343126 (Smarty_Internal_Template $_smarty_tpl) {
$_smarty_tpl->_subTemplateRender("file:sections/header.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, $_smarty_tpl->cache_lifetime, array(), 0, false);
?>

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

:root {
    --primary: #a78bfa;
    --primary-dark: #8b5cf6;
    --success: #86efac;
    --success-dark: #4ade80;
    --error: #fca5a5;
    --bg-light: #fafafa;
    --bg-card: #ffffff;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --border: #e5e7eb;
    --shadow: rgba(0, 0, 0, 0.05);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-light);
    transition: background 0.3s ease;
}

.installer-wrapper {
    min-height: calc(100vh - 100px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.installer-card {
    width: 100%;
    max-width: 500px;
    background: var(--bg-card);
    border-radius: 20px;
    box-shadow: 0 4px 20px var(--shadow);
    overflow: hidden;
    border: 1px solid var(--border);
    transition: all 0.3s ease;
}

.installer-header {
    padding: 50px 40px 40px;
    text-align: center;
    background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);
    position: relative;
}

.installer-logo {
    width: 80px;
    height: 80px;
    background: transparent;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    font-size: 48px;
    color: var(--primary-dark);
    box-shadow: none;
}

.installer-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.installer-header p {
    font-size: 15px;
    color: var(--text-secondary);
    font-weight: 400;
}

.installer-body {
    padding: 40px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-primary);
    font-size: 12px;
    letter-spacing: 0.3px;
}

.form-group label span {
    color: var(--error);
}

.form-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    transition: all 0.3s ease;
    background: var(--bg-card);
    color: var(--text-primary);
    font-family: inherit;
    line-height: 1.4;
    height: 38px;
    box-sizing: border-box;
}

.form-input::placeholder {
    color: #9ca3af;
    font-size: 13px;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg-card);
    box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.08);
}

/* Password Input with Toggle */
.password-input-wrapper {
    position: relative;
    width: 100%;
}

.password-input-wrapper .form-input {
    padding-right: 42px;
}

.password-toggle-btn {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.password-toggle-btn:hover {
    background: rgba(167, 139, 250, 0.1);
    color: var(--primary);
}

.password-toggle-btn i {
    font-size: 14px;
}

/* Dark Mode Password Toggle */
.dark-mode .password-toggle-btn,
body.dark-mode .password-toggle-btn {
    color: #94a3b8;
}

.dark-mode .password-toggle-btn:hover,
body.dark-mode .password-toggle-btn:hover {
    background: rgba(167, 139, 250, 0.15);
    color: var(--primary);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Tambah jarak khusus antar baris form */
.form-row + .form-row {
    margin-top: 20px;
}

.btn-install {
    width: 100%;
    padding: 11px 24px;
    background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
    color: var(--primary-dark);
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 24px;
    box-shadow: 0 2px 8px rgba(167, 139, 250, 0.15);
    height: 42px;
}

.btn-install:hover:not(:disabled) {
    transform: translateY(-2px);
    background: linear-gradient(135deg, #ede9fe 0%, #ddd6fe 100%);
    box-shadow: 0 4px 12px rgba(167, 139, 250, 0.25);
}
/* Dark Mode - Text Putih & Background Biru */
.dark-mode .btn-install,
body.dark-mode .btn-install {
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(30, 27, 75, 0.4);
}

.dark-mode .btn-install:hover:not(:disabled),
body.dark-mode .btn-install:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(49, 46, 129, 0.6);
}

/* Dark Mode Button - Match Header */
.dark-mode .btn-install,
body.dark-mode .btn-install {
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
    box-shadow: 0 4px 12px rgba(30, 27, 75, 0.4);
}

.dark-mode .btn-install:hover:not(:disabled),
body.dark-mode .btn-install:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(49, 46, 129, 0.6);
}

.btn-install:active:not(:disabled) {
    transform: translateY(0);
}

.btn-install:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-install .spinner {
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.install-progress {
    display: none;
    margin-top: 24px;
    padding: 20px;
    background: var(--bg-light);
    border-radius: 12px;
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid var(--border);
}

.install-progress.show {
    display: block;
    animation: slideDown 0.3s ease;
}

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

.progress-item {
    padding: 10px 0;
    font-size: 14px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0;
    animation: fadeIn 0.4s ease forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

.progress-item.success { 
    color: #059669;
}

.progress-item.error { 
    color: #dc2626;
}

.progress-item i {
    font-size: 16px;
    min-width: 16px;
}

.installer-footer {
    padding: 24px 40px;
    background: var(--bg-light);
    border-top: 1px solid var(--border);
    text-align: center;
}

.installer-footer p {
    margin: 0;
    font-size: 13px;
    color: var(--text-secondary);
}

.success-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(5px);
    z-index: 999999;
    animation: fadeInOverlay 0.3s ease;
}

.success-overlay.show {
    display: block !important;
}

@keyframes fadeInOverlay {
    from { opacity: 0; }
    to { opacity: 1; }
}

.success-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-card);
    padding: 50px 40px;
    border-radius: 20px;
    text-align: center;
    max-width: 440px;
    width: calc(100% - 40px);
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--border);
    z-index: 1000000;
    animation: slideUpModal 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes slideUpModal {
    from {
        opacity: 0;
        transform: translate(-50%, -40%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.success-icon {
    width: 90px;
    height: 90px;
    background: linear-gradient(135deg, var(--success) 0%, var(--success-dark) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 28px;
    color: #fff;
    font-size: 42px;
    box-shadow: 0 8px 24px rgba(74, 222, 128, 0.3);
}

.success-modal h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.success-modal p {
    margin-bottom: 30px;
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 15px;
}

.btn-dashboard {
    display: inline-block;
    padding: 14px 32px;
    background: linear-gradient(135deg, var(--success) 0%, var(--success-dark) 100%);
    color: #fff;
    text-decoration: none;
    border-radius: 12px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(74, 222, 128, 0.3);
    font-size: 15px;
}

.btn-dashboard:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(74, 222, 128, 0.4);
    color: #fff;
}

/* Dark Mode */
.dark-mode,
body.dark-mode {
    --bg-light: #0f172a;
    --bg-card: #1e293b;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border: #334155;
    --shadow: rgba(0, 0, 0, 0.3);
}

.dark-mode .installer-header,
body.dark-mode .installer-header {
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
}

.dark-mode .installer-logo,
body.dark-mode .installer-logo {
    color: #ffffff;
    opacity: 0.95;
}

.dark-mode .form-input,
body.dark-mode .form-input {
    background: #0f172a;
    color: #f1f5f9;
}

.dark-mode .form-input::placeholder,
body.dark-mode .form-input::placeholder {
    color: #64748b;
}

.dark-mode .install-progress,
body.dark-mode .install-progress {
    background: #0f172a;
}

/* Custom Scrollbar */
.install-progress::-webkit-scrollbar {
    width: 6px;
}

.install-progress::-webkit-scrollbar-track {
    background: transparent;
}

.install-progress::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 10px;
}

.install-progress::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Responsive */
@media (max-width: 600px) {
    .installer-wrapper {
        padding: 20px 15px;
        align-items: flex-start;
        padding-top: 40px;
    }
    
    .installer-card {
        border-radius: 16px;
    }
    
    .installer-header {
        padding: 40px 30px 30px;
    }
    
    .installer-logo {
        width: 70px;
        height: 70px;
        font-size: 32px;
    }
    
    .installer-header h1 {
        font-size: 24px;
    }
    
    .installer-header p {
        font-size: 14px;
    }
    
    .installer-body {
        padding: 30px 25px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 24px;
    }
    
    .installer-footer {
        padding: 20px 25px;
    }
    
    .success-modal {
        padding: 40px 25px;
        max-width: calc(100% - 30px);
        width: calc(100% - 30px);
    }
    
    .success-icon {
        width: 80px;
        height: 80px;
        font-size: 38px;
    }
    
    .success-modal h2 {
        font-size: 22px;
    }
    
    .success-modal p {
        font-size: 14px;
        margin-bottom: 25px;
    }
    
    .btn-dashboard {
        padding: 12px 28px;
        font-size: 14px;
    }
}

/* ==========================================
   MODERN CONFIRMATION MODAL STYLES
   ========================================== */

/* Modal Overlay */
.modal-overlay-installer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    animation: fadeInModal 0.2s ease;
}

@keyframes fadeInModal {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Modal Container */
.modal-container-installer {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 540px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: slideUpModal 0.3s ease;
    display: flex;
    flex-direction: column;
}

@keyframes slideUpModal {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Modal Header */
.modal-header-installer {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    padding: 18px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header-installer h4 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-header-installer h4 i {
    font-size: 20px;
}

.modal-close-btn-installer {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    line-height: 1;
}

.modal-close-btn-installer:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* Modal Body */
.modal-body-installer {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

/* Info Box */
.info-box-installer {
    background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);
    border: 1px solid #d8b4fe;
    border-radius: 12px;
    padding: 16px;
    display: flex;
    gap: 14px;
    margin-bottom: 20px;
}

.info-box-installer .info-icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 20px;
}

.info-box-installer .info-content {
    flex: 1;
}

.info-box-installer .info-content strong {
    color: var(--primary-dark);
    font-size: 15px;
    display: block;
    margin-bottom: 4px;
}

.info-box-installer .info-content p {
    margin: 0;
    color: #6b21a8;
    font-size: 13px;
    line-height: 1.5;
}

/* Section */
.section-installer {
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}

.section-header-installer {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 14px;
}

.section-header-installer i {
    color: var(--primary);
}

/* Checklist Items */
.checklist-installer {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.checklist-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.checklist-item:hover {
    border-color: var(--primary);
    background: linear-gradient(135deg, #faf5ff 0%, #fff 100%);
}

.checklist-item i {
    color: var(--primary);
    font-size: 16px;
    margin-top: 2px;
    flex-shrink: 0;
}

.checklist-item .item-content {
    flex: 1;
}

.checklist-item .item-content strong {
    display: block;
    margin-bottom: 4px;
    color: var(--text-primary);
}

.checklist-item .item-content span {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Cron Box */
.cron-box {
    background: #1e293b;
    border-radius: 8px;
    padding: 14px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 12px;
    color: #e2e8f0;
    margin-top: 12px;
    overflow-x: auto;
}

.cron-box .cron-comment {
    color: #64748b;
    margin-bottom: 4px;
}

.cron-box .cron-command {
    color: #4ade80;
    word-break: break-all;
}

/* Modal Footer */
.modal-footer-installer {
    padding: 16px 24px;
    background: var(--bg-light);
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.btn-cancel-installer {
    padding: 10px 20px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.btn-cancel-installer:hover {
    background: var(--bg-light);
    border-color: var(--text-secondary);
}

.btn-confirm-installer {
    padding: 10px 20px;
    border: none;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(139, 92, 246, 0.3);
}

.btn-confirm-installer:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, #7c3aed 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(139, 92, 246, 0.4);
}

/* Dark Mode */
.dark-mode .modal-container-installer,
body.dark-mode .modal-container-installer {
    background: var(--bg-card);
}

.dark-mode .modal-header-installer,
body.dark-mode .modal-header-installer {
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
}

.dark-mode .info-box-installer,
body.dark-mode .info-box-installer {
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
    border-color: #4c1d95;
}

.dark-mode .info-box-installer .info-icon,
body.dark-mode .info-box-installer .info-icon {
    background: linear-gradient(135deg, #6d28d9 0%, #7c3aed 100%);
}

.dark-mode .info-box-installer .info-content strong,
body.dark-mode .info-box-installer .info-content strong {
    color: #c4b5fd;
}

.dark-mode .info-box-installer .info-content p,
body.dark-mode .info-box-installer .info-content p {
    color: #a5b4fc;
}

.dark-mode .section-installer,
body.dark-mode .section-installer {
    background: #0f172a;
    border-color: var(--border);
}

.dark-mode .section-header-installer,
body.dark-mode .section-header-installer {
    color: #f1f5f9;
    border-bottom-color: var(--border);
}

.dark-mode .checklist-item,
body.dark-mode .checklist-item {
    background: var(--bg-card);
    border-color: var(--border);
    color: #f1f5f9;
}

.dark-mode .checklist-item:hover,
body.dark-mode .checklist-item:hover {
    background: linear-gradient(135deg, #1e1b4b 0%, var(--bg-card) 100%);
    border-color: var(--primary);
}

.dark-mode .checklist-item .item-content strong,
body.dark-mode .checklist-item .item-content strong {
    color: #f1f5f9;
}

.dark-mode .checklist-item .item-content span,
body.dark-mode .checklist-item .item-content span {
    color: #94a3b8;
}

.dark-mode .modal-footer-installer,
body.dark-mode .modal-footer-installer {
    background: #0f172a;
    border-top-color: var(--border);
}

.dark-mode .btn-cancel-installer,
body.dark-mode .btn-cancel-installer {
    background: var(--bg-card);
    border-color: var(--border);
    color: #cbd5e1;
}

.dark-mode .btn-cancel-installer:hover,
body.dark-mode .btn-cancel-installer:hover {
    background: var(--border);
}

.dark-mode .btn-confirm-installer,
body.dark-mode .btn-confirm-installer {
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 100%);
    box-shadow: 0 4px 12px rgba(30, 27, 75, 0.4);
}

.dark-mode .btn-confirm-installer:hover,
body.dark-mode .btn-confirm-installer:hover {
    box-shadow: 0 8px 20px rgba(49, 46, 129, 0.6);
}

/* Responsive - Tablet */
@media (max-width: 768px) {
    .modal-overlay-installer {
        padding: 16px;
    }

    .modal-container-installer {
        max-height: 85vh;
    }

    .modal-header-installer {
        padding: 14px 18px;
    }

    .modal-header-installer h4 {
        font-size: 16px;
    }

    .modal-body-installer {
        padding: 18px;
    }

    .modal-footer-installer {
        padding: 14px 18px;
        flex-direction: column-reverse;
    }

    .btn-cancel-installer,
    .btn-confirm-installer {
        width: 100%;
        justify-content: center;
    }
}

/* Responsive - Mobile */
@media (max-width: 480px) {
    .modal-overlay-installer {
        padding: 10px;
    }

    .modal-container-installer {
        border-radius: 12px;
        max-height: 90vh;
    }

    .modal-header-installer {
        padding: 12px 16px;
    }

    .modal-header-installer h4 {
        font-size: 15px;
    }

    .modal-close-btn-installer {
        width: 28px;
        height: 28px;
        font-size: 18px;
    }

    .modal-body-installer {
        padding: 14px;
    }

    .info-box-installer {
        padding: 12px;
        gap: 12px;
    }

    .info-box-installer .info-icon {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }

    .info-box-installer .info-content strong {
        font-size: 14px;
    }

    .info-box-installer .info-content p {
        font-size: 12px;
    }

    .section-installer {
        padding: 12px;
        margin-bottom: 12px;
    }

    .section-header-installer {
        font-size: 13px;
        margin-bottom: 12px;
        padding-bottom: 8px;
    }

    .checklist-item {
        padding: 10px 12px;
        font-size: 12px;
    }

    .checklist-item i {
        font-size: 14px;
    }

    .cron-box {
        padding: 12px;
        font-size: 11px;
    }

    .modal-footer-installer {
        padding: 12px 14px;
        gap: 10px;
    }

    .btn-cancel-installer,
    .btn-confirm-installer {
        padding: 10px 16px;
        font-size: 13px;
    }
}
</style>

<div class="installer-wrapper">
    <div class="installer-card">
        <div class="installer-header">
            <div class="installer-logo">
                <i class="ion ion-cloud"></i>
            </div>
            <h1>GenieACS Manager</h1>
            <p>TR-069 Device Management for PHPNuxBill</p>
        </div>
        
        <div class="installer-body">
            <form id="install-form" onsubmit="return false;">
                <div class="form-row">
                    <div class="form-group">
                        <label>Database Host</label>
                        <input type="text" class="form-input" id="db_host" value="localhost" placeholder="localhost">
                    </div>
                    <div class="form-group">
                        <label>Database Name <span>*</span></label>
                        <input type="text" class="form-input" id="db_database" placeholder="phpnuxbill" required>
                    </div>
                </div>
                
                <div class="form-row">
                    <div class="form-group">
                        <label>Username <span>*</span></label>
                        <input type="text" class="form-input" id="db_username" placeholder="root" required>
                    </div>
                    <div class="form-group">
                        <label>Password</label>
                        <input type="password" class="form-input" id="db_password" placeholder="••••••••">
                    </div>
                </div>
                
                <button type="button" class="btn-install" id="btn-install" onclick="runInstall()">
                    <i class="fa fa-download"></i>
                    <span>Install Now</span>
                </button>
            </form>
            
            <div class="install-progress" id="progress-log"></div>
        </div>
        
        <div class="installer-footer">
            <p>Version 1.0.0 • By ExO</p>
        </div>
    </div>
</div>

<!-- Confirmation Modal -->
<div class="modal-overlay-installer" id="confirmModalOverlay" style="display: none;">
    <div class="modal-container-installer">
        <div class="modal-header-installer">
            <h4><i class="fa fa-info-circle"></i> Konfirmasi Instalasi</h4>
            <button class="modal-close-btn-installer" onclick="closeConfirmModal()">&times;</button>
        </div>
        <div class="modal-body-installer">
            <!-- Info Box -->
            <div class="info-box-installer">
                <div class="info-icon">
                    <i class="fa fa-lightbulb-o"></i>
                </div>
                <div class="info-content">
                    <strong>Perhatian!</strong>
                    <p>Pastikan Anda sudah memahami persyaratan berikut sebelum melanjutkan instalasi.</p>
                </div>
            </div>
            
            <!-- Database Section -->
            <div class="section-installer">
                <div class="section-header-installer">
                    <i class="fa fa-database"></i>
                    <span>Konfigurasi Database</span>
                </div>
                <div class="checklist-installer">
                    <div class="checklist-item">
                        <i class="fa fa-check-circle"></i>
                        <div class="item-content">
                            <strong>Gunakan Database PHPNuxBill</strong>
                            <span>Database Host, Database Name, Username, dan Password harus sama persis dengan database yang digunakan PHPNuxBill.</span>
                        </div>
                    </div>
                </div>
            </div>
            
            <!-- Cronjob Section -->
            <div class="section-installer">
                <div class="section-header-installer">
                    <i class="fa fa-clock-o"></i>
                    <span>Cronjob Wajib</span>
                </div>
                <div class="checklist-installer">
                    <div class="checklist-item">
                        <i class="fa fa-check-circle"></i>
                        <div class="item-content">
                            <strong>Buat Cronjob Sync Device</strong>
                            <span>Setelah instalasi selesai, wajib membuat cronjob untuk sinkronisasi device secara otomatis.</span>
                        </div>
                    </div>
                </div>
                <div class="cron-box">
                    <div class="cron-comment"># Sync Device Cronjob (Setiap 5 Menit)</div>
                    <div class="cron-command">*/5 * * * * cd /path/to/phpnuxbill/system && php cron_acs_sync.php</div>
                </div>
            </div>
        </div>
        <div class="modal-footer-installer">
            <button type="button" class="btn-cancel-installer" onclick="closeConfirmModal()">
                <i class="fa fa-times"></i> Batal
            </button>
            <button type="button" class="btn-confirm-installer" onclick="proceedInstall()">
                <i class="fa fa-check"></i> Ya, Lanjutkan Install
            </button>
        </div>
    </div>
</div>

<!-- Success Modal -->
<div class="success-overlay" id="success-modal">
    <div class="success-modal">
        <div class="success-icon">
            <i class="fa fa-check"></i>
        </div>
        <h2>Installation Complete!</h2>
        <p>GenieACS Manager has been installed successfully. You can now start managing your TR-069 devices.</p>
        <a href="<?php echo $_smarty_tpl->tpl_vars['_url']->value;?>
plugin/genieacs_manager" class="btn-dashboard">
            Open GenieACS Manager
        </a>
    </div>
</div>

<?php echo '<script'; ?>
>
var logQueue = [];
var isProcessingLog = false;

function addLog(message, type) {
    logQueue.push({ message: message, type: type });
    processLogQueue();
}

function processLogQueue() {
    if (isProcessingLog || logQueue.length === 0) return;
    
    isProcessingLog = true;
    var logData = logQueue.shift();
    
    var log = document.getElementById('progress-log');
    log.classList.add('show');
    
    var icon = logData.type === 'success' ? 'fa-check' : (logData.type === 'error' ? 'fa-times' : 'fa-circle-o-notch fa-spin');
    var item = document.createElement('div');
    item.className = 'progress-item ' + logData.type;
    item.innerHTML = '<i class="fa ' + icon + '"></i> ' + logData.message;
    
    log.appendChild(item);
    log.scrollTop = log.scrollHeight;
    
    // Delay setiap log item (800ms - lebih lambat untuk efek installing)
    setTimeout(function() {
        isProcessingLog = false;
        processLogQueue();
    }, 800);
}

function runInstall() {
    var db_database = document.getElementById('db_database').value;
    var db_username = document.getElementById('db_username').value;
    
    if (!db_database || !db_username) {
        alert('Please fill in database name and username');
        return;
    }
    
    // Show confirmation modal
    showConfirmModal();
}

function showConfirmModal() {
    document.getElementById('confirmModalOverlay').style.display = 'flex';
    document.body.style.overflow = 'hidden';
}

function closeConfirmModal() {
    document.getElementById('confirmModalOverlay').style.display = 'none';
    document.body.style.overflow = '';
}

// Close modal on overlay click
document.addEventListener('click', function(e) {
    if (e.target.id === 'confirmModalOverlay') {
        closeConfirmModal();
    }
});

// Close modal on Escape key
document.addEventListener('keydown', function(e) {
    if (e.key === 'Escape') {
        var confirmModal = document.getElementById('confirmModalOverlay');
        if (confirmModal.style.display === 'flex') {
            closeConfirmModal();
        }
    }
});

function proceedInstall() {
    // Close confirmation modal
    closeConfirmModal();
    
    var btn = document.getElementById('btn-install');
    var db_host = document.getElementById('db_host').value;
    var db_database = document.getElementById('db_database').value;
    var db_username = document.getElementById('db_username').value;
    var db_password = document.getElementById('db_password').value;
    
    // Disable button
    btn.disabled = true;
    btn.innerHTML = '<div class="spinner"></div><span>Installing...</span>';
    
    // Clear and show log
    document.getElementById('progress-log').innerHTML = '';
    addLog('Preparing installation sequence...', '');
    
    $.ajax({
        url: '<?php echo $_smarty_tpl->tpl_vars['_url']->value;?>
plugin/genieacs_installer/run-install',
        type: 'POST',
        data: {
            db_host: db_host,
            db_database: db_database,
            db_username: db_username,
            db_password: db_password
        },
        dataType: 'json',
        success: function(response) {
            if (response.success) {
                // Show details dengan delay queue
                if (response.details) {
                    response.details.forEach(function(detail) {
                        addLog(detail, 'success');
                    });
                }
                
                // Show success modal setelah semua log selesai
                // Hitung total delay: jumlah items x 800ms + buffer 1000ms
                var totalDelay = (response.details ? response.details.length * 800 : 0) + 1000;
                setTimeout(function() {
                    document.getElementById('success-modal').classList.add('show');
                }, totalDelay);
            } else {
                addLog('Error: ' + response.message, 'error');
                btn.disabled = false;
                btn.innerHTML = '<i class="fa fa-download"></i><span>Retry</span>';
            }
        },
        error: function(xhr, status, error) {
            addLog('Connection error: ' + error, 'error');
            btn.disabled = false;
            btn.innerHTML = '<i class="fa fa-download"></i><span>Retry</span>';
        }
    });
}
<?php echo '</script'; ?>
>

<?php $_smarty_tpl->_subTemplateRender("file:sections/footer.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, $_smarty_tpl->cache_lifetime, array(), 0, false);
}
}
