/* ==========================================================
   Storyland Workbook - Cleaned & Responsive CSS
   assets/css/style.css
   ========================================================== */

/* ---------- Reset ---------- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    width: 100%;
    overflow-x: hidden;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
    color: #333;
    background: #f5f5f5;
    line-height: 1.5;
}

/* ---------- Typography ---------- */
h1 { font-size: 28px; margin-bottom: 15px; }
h2 { font-size: 24px; margin-bottom: 12px; }
h3 { font-size: 20px; margin-bottom: 10px; }
h4 { font-size: 18px; margin-bottom: 8px; }

p { margin-bottom: 10px; }

/* ---------- Base & Responsive Images ---------- */

/* Aturan dasar agar SEMUA gambar di website otomatis responsif */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Gambar khusus di dalam Card Body */
.card-body img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin: 10px 0;
}

/* Gambar Header Card (jika gambar dipasang di paling atas kartu) */
.card-img-top {
    width: 100%;
    height: auto;
    display: block;
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

/* ---------- Image Utilities ---------- */

/* Gambar dengan bingkai thumbnail */
.img-thumbnail {
    padding: 4px;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 6px;
    max-width: 100%;
    height: auto;
}

/* Gambar Avatar / Foto Profil Lingkaran */
.img-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    display: inline-block;
}

/* Gambar Rata Tengah */
.img-center {
    margin-left: auto;
    margin-right: auto;
    display: block;
}

/* ---------- Link ---------- */
a {
    color: #0066cc;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ---------- Unified Container (Rata Tengah & Responsif) ---------- */
.container {
    width: 100%;
    max-width: 1100px;
    margin: 20px auto;
    padding: 0 15px;
}

.content {
    width: 100%;
    max-width: 1100px;
    margin: 25px auto;
    background: #fff;
    padding: 20px;
    border: 1px solid #ddd;
}

/* ---------- Unified Card (Rata Tengah & Responsif) ---------- */
.card {
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    width: 100%;
    max-width: 900px;
    margin: 20px auto;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.card-header {
    background: #eee;
    padding: 15px 20px;
    font-weight: bold;
    border-bottom: 1px solid #ddd;
}

.card-header h1, 
.card-header h2, 
.card-header h3 {
    margin: 0;
}

.card-body {
    padding: 20px;
}

/* ---------- Header & Topbar ---------- */
.topbar, .header {
    background: #2c3e50;
    color: #fff;
    padding: 0 20px;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 1000;
}

.logo a {
    color: #fff;
    text-decoration: none;
    font-size: 22px;
    font-weight: 700;
}

.main-menu {
    display: flex;
    align-items: center;
    gap: 18px;
}

.main-menu a {
    color: #fff;
    text-decoration: none;
    font-size: 15px;
    padding: 8px 10px;
    border-radius: 4px;
    transition: .2s;
}

.main-menu a:hover {
    background: #3d556b;
}

.menu-right {
    color: #fff;
    font-size: 14px;
    white-space: nowrap;
}

.menu-right a {
    color: #ffd54f;
    margin-left: 10px;
}

/* ---------- Menu (Standard) ---------- */
.menu {
    background: #222;
}

.menu ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
}

.menu a {
    display: block;
    color: #fff;
    padding: 12px 18px;
}

.menu a:hover {
    background: #444;
    text-decoration: none;
}

/* ---------- Login ---------- */
.login-container {
    width: 100%;
    max-width: 400px;
    margin: 60px auto;
    padding: 30px;
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 2px 12px rgba(0,0,0,.15);
}

.login-container h1 {
    text-align: center;
    margin-bottom: 10px;
    color: #2c3e50;
}

.login-container h2 {
    text-align: center;
    margin-bottom: 25px;
    color: #555;
}

.login-container label {
    display: block;
    margin-bottom: 6px;
    font-weight: bold;
}

.login-container input {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #ccc;
    border-radius: 5px;
}

.login-container button {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 5px;
    background: #2d89ef;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
}

.login-container button:hover {
    background: #1b6fc9;
}

.login-footer {
    margin-top: 20px;
    text-align: center;
}

/* ---------- Table ---------- */
.table, table {
    width: 100%;
    border-collapse: collapse;
    margin: 15px 0;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    overflow: hidden;
}

th, .table th {
    background: #003366;
    color: #fff;
    padding: 12px 15px;
    text-align: left;
}

td, .table td {
    padding: 10px 15px;
    border-bottom: 1px solid #ddd;
    vertical-align: middle;
}

tr:nth-child(even) {
    background: #fafafa;
}

tr:hover {
    background: #ffffe0;
}

.table-header-bg {
    background-color: #f8f9fa;
    color: #495057;
    font-weight: 600;
}

/* ---------- Forms ---------- */
label {
    display: block;
    margin-top: 12px;
    margin-bottom: 5px;
    font-weight: bold;
}

input[type=text],
input[type=password],
input[type=email],
input[type=number],
input[type=date],
select,
textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #bbb;
    border-radius: 4px;
}

textarea {
    min-height: 120px;
    resize: vertical;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #0066cc;
}

/* ---------- Buttons ---------- */
button,
input[type=submit],
input[type=button] {
    padding: 8px 18px;
    border: none;
    background: #0066cc;
    color: white;
    cursor: pointer;
    border-radius: 4px;
}

button:hover,
input[type=submit]:hover,
input[type=button]:hover {
    background: #004999;
}

.btn {
    display: inline-block;
    padding: 8px 18px;
    border-radius: 4px;
    color: #fff;
    font-weight: 500;
    text-decoration: none;
}

.btn-primary { background: #0066cc; }
.btn-success { background: #2e8b57; }
.btn-warning { background: #f39c12; }
.btn-danger  { background: #cc0000; }
.btn-secondary{ background: #666; }

.btn:hover {
    opacity: .9;
    text-decoration: none;
}

/* ---------- Alert ---------- */
.alert, .alert-box {
    padding: 12px 20px;
    margin: 15px 0;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
}

.alert-success { background-color: #d1e7dd; color: #0f5132; border: 1px solid #badbcc; }
.alert-error, .alert-danger { background-color: #f8d7da; color: #842029; border: 1px solid #f5c2c7; }
.alert-warning { background-color: #fff3cd; color: #856404; }
.alert-info { background-color: #d1ecf1; color: #0c5460; }

/* ---------- Grid ---------- */
.row {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

.col {
    flex: 1;
}

/* ---------- Dashboard Grid ---------- */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

.dashboard-card {
    background: #fff;
    border-radius: 8px;
    padding: 25px;
    text-align: center;
    text-decoration: none;
    color: #333;
    box-shadow: 0 2px 8px rgba(0,0,0,.08);
    transition: .2s;
}

.dashboard-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(0,0,0,.15);
}

.dashboard-card .icon {
    font-size: 42px;
    margin-bottom: 10px;
}

.dashboard-card h3 {
    margin: 10px 0;
}

.dashboard-card p {
    color: #666;
    font-size: 14px;
}

/* ---------- User Management & Toggle Switch ---------- */
.switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 24px;
    vertical-align: middle;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #dc3545;
    transition: .3s ease-in-out;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px; width: 18px;
    left: 3px; bottom: 3px;
    background-color: white;
    transition: .3s ease-in-out;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

input:checked + .slider {
    background-color: #198754;
}

input:checked + .slider:before {
    transform: translateX(22px);
}

.badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    display: inline-block;
    text-transform: capitalize;
}

.badge-active { background-color: #d1e7dd; color: #0f5132; }
.badge-pending { background-color: #fff3cd; color: #664d03; }
.badge-level {
    background-color: #e9ecef;
    color: #495057;
    border: 1px solid #ced4da;
    padding: 3px 6px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
}

.filter-container {
    margin-bottom: 20px;
    display: flex;
    gap: 10px;
    align-items: center;
}

.filter-input, .filter-select {
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
}

.filter-input { flex: 1; max-width: 300px; }

/* ---------- Footer ---------- */
.footer {
    margin-top: 40px;
    padding: 20px;
    text-align: center;
    background: #eee;
    border-top: 1px solid #ccc;
    color: #666;
}

/* ---------- Utility ---------- */
.text-left{text-align:left;}
.text-center{text-align:center;}
.text-right{text-align:right;}
.bold{font-weight:bold;}

.mt-10{margin-top:10px;}
.mt-20{margin-top:20px;}
.mt-30{margin-top:30px;}
.mb-10{margin-bottom:10px;}
.mb-20{margin-bottom:20px;}
.mb-30{margin-bottom:30px;}
.p-10{padding:10px;}
.p-20{padding:20px;}
.hidden{display:none;}

/* ---------- Quiz Styles ---------- */
.wb-quiz-container {
    font-family: system-ui, -apple-system, sans-serif;
    max-width: 650px;
    margin: 20px auto;
    padding: 20px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background-color: #ffffff;
}

.wb-drag-item {
    padding: 10px 16px;
    background-color: #3b82f6;
    color: white;
    border-radius: 6px;
    cursor: grab;
    font-weight: 600;
    user-select: none;
    display: inline-block;
    margin: 4px;
}

.wb-drag-item.dragging { opacity: 0.5; }
.wb-matching-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.wb-drop-target { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; border: 2px dashed #cbd5e1; border-radius: 8px; margin-bottom: 8px; }
.wb-drop-zone { min-width: 120px; min-height: 42px; display: flex; align-items: center; justify-content: center; }
.wb-ordering-list { display: flex; flex-direction: column; gap: 8px; }
.wb-ordering-list .wb-drag-item { display: block; }

.wb-slot-area, .wb-bank-area {
    min-height: 60px;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}
.wb-slot-area { border: 2px dashed #94a3b8; background-color: #f8fafc; }
.wb-bank-area { border: 1px solid #e2e8f0; background-color: #f1f5f9; }
.drag-over { border-color: #2563eb !important; background-color: #eff6ff !important; }
.correct { border-color: #22c55e !important; background-color: #f0fdf4 !important; }
.incorrect { border-color: #ef4444 !important; background-color: #fef2f2 !important; }

.wb-btn-check {
    margin-top: 16px;
    padding: 10px 20px;
    background-color: #0f172a;
    color: white;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
}
.wb-btn-check:hover { background-color: #334155; }

/* ---------- Responsive Breakpoints ---------- */
@media (max-width: 768px) {
    .row { display: block; }
    .menu ul { display: block; }
    .topbar { flex-direction: column; height: auto; padding: 10px; gap: 10px; text-align: center; }
    .main-menu { flex-wrap: wrap; justify-content: center; }
    .filter-container { flex-direction: column; align-items: stretch; }
    .filter-input { max-width: 100%; }
    table { font-size: 12px; }
}