/* === CSS Navbar & Layout Utama (Bersih) === */

/* Reset dasar */
body, html {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f4f7f6;
    color: #333;
    line-height: 1.6;
}

/* Container untuk Konten Utama */
.container {
    max-width: 1100px;
    margin: 20px auto;
    padding: 0 15px;
}
.page-content {
    min-height: 80vh;
}

/* Navbar Atas */
.navbar {
    background-color: #fff;
    border-bottom: 1px solid #ddd;
    padding: 10px 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.container-navbar {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.navbar-brand {
    font-size: 1.5em;
    font-weight: bold;
    color: #2a6ce1;
    text-decoration: none;
}
.navbar-nav {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 15px; /* Jarak antar menu */
}
.navbar-nav a {
    text-decoration: none;
    color: #555;
    font-weight: 500;
    padding: 8px 0;
}
/* Tombol di Navbar */
.navbar .btn {
    padding: 8px 16px;
    border-radius: 5px;
    font-weight: bold;
    background-color: #2a6ce1;
    color: #fff;
}
.navbar .btn-outline {
    background-color: #fff;
    color: #2a6ce1;
    border: 1px solid #2a6ce1;
}

/* Footer */
.site-footer {
    text-align: center;
    margin-top: 40px;
    padding: 20px 0;
    border-top: 1px solid #eee;
    color: #999;
    font-size: 0.9em;
}
.container-footer {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 15px;
}
/* Tombol */
.btn {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 5px;
    text-decoration: none;
    border: 1px solid transparent;
    cursor: pointer;
    font-weight: bold;
    background-color: #2a6ce1;
    color: #fff;
}
.btn.btn-primary { background-color: #2a6ce1; color: #fff; }
.btn.btn-outline { background-color: #fff; color: #2a6ce1; border-color: #2a6ce1; }
.btn-block { display: block; width: 100%; text-align: center; }

/* Form Container */
.form-container {
    max-width: 450px;
    margin: 30px auto;
    padding: 30px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
.form-container h2 {
    margin-top: 0;
    text-align: center;
}
.form-container p {
    text-align: center;
    color: #777;
    margin-bottom: 20px;
}
.form-group {
    margin-bottom: 15px;
}
.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 5px;
    box-sizing: border-box; /* Penting */
}
.form-footer {
    text-align: center;
    margin-top: 20px;
    font-size: 0.9em;
}

/* Alerts */
.alert {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 5px;
}
.alert-error { background-color: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-success { background-color: #d4edda; color: #155724; border: 1px solid #c3e6cb; }

/* Footer */
.site-footer {
    text-align: center;
    margin-top: 40px;
    padding: 20px 0;
    border-top: 1px solid #eee;
    color: #999;
    font-size: 0.9em;
}
/* === CSS Halaman Dashboard === */

.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.dashboard-header h2 {
    margin: 0;
}

.empty-state {
    background-color: #fff;
    padding: 40px;
    text-align: center;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.form-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.form-item {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.form-item-title {
    margin: 0 0 5px 0;
    color: #2a6ce1;
}

.form-item-links a {
    text-decoration: none;
    font-weight: 500;
    margin-left: 15px;
    color: #2a6ce1;
}
.btn-link { /* Ubah style link biasa */
    padding: 6px 12px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: 500;
    border: 1px solid #ddd;
    background-color: #f9f9f9;
    color: #333;
}
.btn-link:hover {
    background-color: #f1f1f1;
}

.form-item-info span {
    font-size: 0.9em;
    color: #777;
    margin-right: 10px;
}

.status-badge {
    font-weight: bold;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 0.8em;
}
.status-open { background-color: #d4edda; color: #155724; }
.status-closed { background-color: #f8d7da; color: #721c24; }

/* === CSS Form Builder === */

.form-builder-container {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.builder-toolbox {
    width: 200px;
    flex-shrink: 0;
    background: #fff;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
.builder-toolbox h3 {
    margin-top: 0;
    text-align: center;
}
.builder-toolbox .btn {
    margin-bottom: 10px;
    background-color: #f0f0f0;
    color: #333;
    border: 1px solid #ddd;
    text-align: left;
}
.builder-toolbox .btn:hover {
    background-color: #e0e0e0;
}

.builder-canvas {
    flex-grow: 1;
}

.canvas-header {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    margin-bottom: 20px;
}

#form-fields-canvas {
    min-height: 200px;
    border: 2px dashed #ccc;
    padding: 10px;
    border-radius: 8px;
    background: #fafafa;
}
#form-fields-canvas:empty::after {
    content: "Seret atau klik field dari 'Peralatan' ke sini.";
    display: block;
    text-align: center;
    padding: 40px;
    color: #999;
}

.canvas-footer {
    margin-top: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}
.save-status {
    font-weight: bold;
}

/* Styling per Field (Pertanyaan) */
.field-wrapper {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-bottom: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.field-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    background: #f9f9f9;
    border-bottom: 1px solid #eee;
}
.field-drag-handle {
    cursor: move;
    color: #999;
}
.field-type-label {
    flex-grow: 1;
    color: #555;
}
.delete-field {
    color: #c0392b;
    text-decoration: none;
    font-size: 0.9em;
}
.field-content {
    padding: 15px;
}
.field-footer {
    margin-top: 10px;
    font-size: 0.9em;
}

/* Styling Opsi (Radio/Checkbox) */
.field-options {
    margin-top: 10px;
}
.options-list .option-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 5px;
}
.options-list .option-label {
    flex-grow: 1;
    padding: 6px;
    border: 1px solid #ccc;
    border-radius: 4px;
}
.remove-option {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    border-radius: 50%;
    cursor: pointer;
    width: 24px;
    height: 24px;
    font-weight: bold;
}
.add-option {
    font-size: 0.9em;
    margin-top: 5px;
}

/* Ghost class untuk Sortable.js */
.sortable-ghost {
    opacity: 0.4;
    background: #d1e7fd;
}
/* === CSS Form Publik === */

body.public-form-page {
    background-color: #e9ebee; /* Latar belakang sedikit abu-abu */
}

.public-form-container {
    max-width: 700px;
    margin: 30px auto;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.public-form-header {
    padding: 25px 30px;
    border-bottom: 2px solid #f0f0f0;
}
.public-form-header h1 {
    margin: 0 0 10px 0;
    color: #2a6ce1;
}
.public-form-header p {
    margin: 0;
    font-size: 1.1em;
    color: #555;
}

.public-form {
    padding: 30px;
}

.required-star {
    color: #c0392b;
    margin-left: 5px;
}

/* Styling untuk grup radio/checkbox */
.options-group {
    margin-top: 10px;
}
.options-group .option-item {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}
.options-group .option-item input {
    margin-right: 10px;
}
.options-group .option-item label {
    margin-bottom: 0; /* Override style form-group */
    font-weight: normal;
}
.field-options-info {
    padding: 10px;
    background-color: #f0f4f8;
    border-radius: 4px;
    font-size: 0.9em;
    color: #555;
}
.btn-link-download {
    display: inline-block;
    padding: 4px 8px;
    background-color: #e6f7ff;
    border: 1px solid #91d5ff;
    border-radius: 4px;
    color: #096dd9;
    text-decoration: none;
    font-size: 0.9em;
    font-weight: 500;
}
.btn-link-download:hover {
    background-color: #d0efff;
}

/* CSS untuk tombol aksi baru */
.btn-link i { margin-right: 4px; }
.btn-link-warning { color: #e67e22; }
.btn-link-success { color: #2ecc71; }
.btn-link-danger { color: #e74c3c; }

/* === CSS Setelan Tampilan (Form Builder) === */
.canvas-settings-box {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    margin-bottom: 20px;
}
.canvas-settings-box h3 {
    margin-top: 0;
}
.form-group-flex {
    display: flex;
    gap: 20px;
    align-items: flex-end;
}
.form-group input[type="color"] {
    width: 60px;
    height: 40px;
    padding: 2px;
    border: 1px solid #ccc;
    border-radius: 5px;
}
.current-header-image {
    margin: 15px 0;
    padding: 10px;
    background: #f9f9f9;
    border: 1px solid #eee;
    border-radius: 5px;
}
.current-header-image p {
    margin: 0 0 5px 0;
    font-weight: 500;
}
.current-header-image img {
    max-width: 300px;
    max-height: 100px;
    border-radius: 4px;
}
.current-header-image a {
    margin-left: 10px;
    font-size: 0.9em;
}

/* === CSS Form Publik (Tambahan Banner) === */

.public-form-container {
    /* Menambahkan overflow: hidden agar border-radius 
       tetap rapi memotong gambar header */
    overflow: hidden; 
}

.public-form-banner {
    width: 100%;
    max-height: 250px; /* Batasi tinggi banner agar tidak berlebihan */
    overflow: hidden;
    background-color: #f0f0f0; /* Warna jika gambar gagal dimuat */
}

.public-form-banner img {
    width: 100%;
    height: auto; /* Biarkan tinggi gambar proporsional */
    display: block;
}

/* Mengganti warna bintang 'wajib' ke warna tema */
.required-star {
    color: #2a6ce1; /* Default jika tema tidak ada */
    margin-left: 5px;
    font-weight: bold;
}
/* CSS untuk tombol Share WhatsApp */
.btn-link-wa { 
    color: #25D366; /* Warna hijau WA */
}
.btn-link-wa:hover {
    color: #128C7E; /* Warna hijau WA (gelap) */
}
/* === CSS UNTUK LAYOUT TAB RESPON === */

.tab-container {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    overflow: hidden;
    margin-top: 20px;
}

.tab-headers {
    display: flex;
    background-color: #f9f9f9;
    border-bottom: 1px solid #ddd;
    padding: 0 20px;
}

.tab-link {
    border: none;
    background: none;
    padding: 15px 20px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 500;
    color: #555;
    border-bottom: 3px solid transparent;
    margin-bottom: -1px; /* Trik agar border menyatu */
}
.tab-link i {
    margin-right: 8px;
}

.tab-link:hover {
    color: #333;
}

.tab-link.active {
    color: #2a6ce1; /* Warna biru tema */
    border-bottom-color: #2a6ce1;
}

/* Konten Tab */
.tab-content {
    display: none; /* Sembunyikan semua konten by default */
    padding: 20px;
}
.tab-content.active {
    display: block; /* Tampilkan hanya yang aktif */
}

/* Kontainer untuk grafik */
.chart-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 30px;
}
.chart-box {
    border: 1px solid #eee;
    padding: 15px;
    border-radius: 8px;
}
.chart-box h4 {
    margin-top: 0;
    text-align: center;
}

/* === MY DRIVE GRID SYSTEM === */
.drive-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); /* Kotak responsif */
    gap: 20px;
    margin-top: 20px;
}

.drive-card {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
}

.drive-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

/* Area Ikon/Thumbnail */
.card-icon {
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f9f9f9;
    font-size: 3em; /* Ukuran Ikon FontAwesome */
}
.card-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Agar gambar full kotak */
}

/* Area Info File */
.card-info {
    padding: 10px;
}
.file-name {
    font-size: 0.9em;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; /* ... jika nama kepanjangan */
    margin-bottom: 5px;
}
.file-meta {
    font-size: 0.75em;
    color: #888;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.delete-icon {
    color: #e74c3c;
    padding: 2px 5px;
    border-radius: 3px;
}
.delete-icon:hover {
    background: #ffe6e6;
}

/* === MODAL PREVIEW === */
.modal {
    display: none; /* Hidden by default */
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5); /* Black w/ opacity */
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: #fefefe;
    padding: 0;
    border-radius: 8px;
    width: 90%;
    max-width: 800px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    overflow: hidden;
    animation: fadeIn 0.3s;
}

.modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-header h3 { margin: 0; font-size: 1.1em; }

.close-modal {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}
.close-modal:hover { color: #000; }

.modal-body {
    padding: 20px;
    min-height: 200px;
    display: flex; /* Untuk memusatkan konten preview */
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
}

@keyframes fadeIn {
    from {opacity: 0; transform: scale(0.95);}
    to {opacity: 1; transform: scale(1);}
}

/* === CSS DRAG & DROP ZONE === */
.upload-area {
    border: 2px dashed #ccc;
    border-radius: 10px;
    background-color: #f9f9f9;
    padding: 40px;
    text-align: center;
    margin-bottom: 30px;
    position: relative;
    transition: all 0.3s ease;
}

/* Saat file di-drag di atas area ini */
.upload-area.drag-over {
    border-color: #2a6ce1;
    background-color: #e6f0ff;
}

.upload-icon {
    font-size: 3em;
    color: #ccc;
    margin-bottom: 15px;
}

.upload-area.drag-over .upload-icon {
    color: #2a6ce1;
}

.file-input {
    display: none; /* Sembunyikan input asli */
}

.drag-overlay {
    display: none;
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(42, 108, 225, 0.8);
    color: white;
    font-size: 1.5em;
    font-weight: bold;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
}

.upload-area.drag-over .drag-overlay {
    display: flex; /* Tampilkan overlay saat drag */
}
/* === Builder Toolbar === */
.builder-actions {
    background: #fff;
    padding: 10px 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.builder-actions .right-actions {
    display: flex;
    gap: 10px;
}

/* === Settings Toggle === */
.settings-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}
.settings-toggle:hover { color: #2a6ce1; }

/* === Form Controls di Public View (Agar rapi saat PDF) === */
.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #f9f9f9;
    box-sizing: border-box;
}

/* --- Styling Navbar Dasar --- */
.navbar {
    background-color: #2a6ce1; /* Warna biru sesuai theme-color Anda */
    padding: 15px 0;
    color: white;
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 90%;
    margin: 0 auto;
    max-width: 1200px;
}

.nav-brand {
    color: white;
    font-weight: bold;
    text-decoration: none;
    font-size: 1.2rem;
}

.navbar-nav {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
}

.nav-item {
    position: relative; /* Penting untuk posisi dropdown */
    margin-left: 20px;
}

.nav-link {
    color: white;
    text-decoration: none;
    font-weight: 500;
    padding: 10px;
    display: block;
}

/* --- LOGIKA DROPDOWN (Penting) --- */
.dropdown-menu {
    display: none; /* Sembunyikan secara default */
    position: absolute;
    top: 100%;
    right: 0;
    background-color: white;
    min-width: 180px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    border-radius: 5px;
    padding: 10px 0;
    z-index: 1000;
    list-style: none;
}

.dropdown-menu li a {
    color: #333;
    padding: 10px 20px;
    display: block;
    text-decoration: none;
    font-size: 14px;
}

.dropdown-menu li a:hover {
    background-color: #f0f0f0;
    color: #2a6ce1;
}

/* Tampilkan dropdown saat nav-item di-hover */
.nav-item.dropdown:hover .dropdown-menu {
    display: block;
}

/* Garis pemisah */
.divider {
    height: 1px;
    background-color: #eee;
    margin: 5px 0;
}

.text-danger {
    color: #dc3545 !important;
}

.text-danger:hover {
    background-color: #ffeaea !important;
}
