/* ==========================================
   FILE: assets/style.css
   ========================================== */

/* --- GLOBAL --- */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { background-color: #ffffff; color: #000; overflow-x: hidden; font-family: 'Montserrat', sans-serif; min-height: 100vh; transition: background-color 0.3s, color 0.3s; }
.hidden { display: none !important; }
.container { max-width: 800px; margin: 0 auto; padding: 40px 20px; }
.loader { text-align: center; color: #999; font-style: italic; margin-top: 20px; }

/* --- DARK MODE TOGGLE BUTTON --- */
.theme-toggle-btn {
    position: fixed; bottom: 30px; right: 30px;
    background: #222; color: #fff; border: none; border-radius: 50%;
    width: 50px; height: 50px; font-size: 1.5rem;
    cursor: pointer; z-index: 1000; box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    transition: transform 0.3s, background 0.3s; display: flex; align-items: center; justify-content: center;
}
.theme-toggle-btn:hover { transform: scale(1.1); }

/* --- DARK MODE STYLES (OVERRIDE) --- */
body.dark-mode { background-color: #121212; color: #e0e0e0; }
.dark-mode .theme-toggle-btn { background: #f0f0f0; color: #222; box-shadow: 0 4px 10px rgba(255,255,255,0.1); }
.dark-mode .card { background: #1e1e1e; border-color: #333; }
.dark-mode .card:hover { border-color: #d4a373; box-shadow: 0 4px 15px rgba(255,255,255,0.02); }
.dark-mode .card-title, .dark-mode .article-title { color: #fff; }
.dark-mode .card-excerpt { color: #bbb; }
.dark-mode .list-header { background-color: #121212; border-bottom-color: #333; }
.dark-mode .article-content { color: #ccc; }
.dark-mode .comment-section { background: #1e1e1e; }
.dark-mode .comment-form input, .dark-mode .comment-form textarea { background: #121212; border-color: #333; color: #fff; }
.dark-mode .comment-name { color: #ddd; }
.dark-mode .comment-text { color: #aaa; }
.dark-mode .comment-item { border-bottom-color: #333; }
.dark-mode .btn-like { background: #1e1e1e; border-color: #e74c3c; }
.dark-mode .login-box { background: #1e1e1e; box-shadow: 0 10px 25px rgba(0,0,0,0.8); }
.dark-mode .login-input { background: #121212; border-color: #333; color: #fff; }
.dark-mode .btn-cancel { background: #333; color: #ccc; border-color: #444; }
.dark-mode .btn-cancel:hover { background: #444; }
.dark-mode .title-item, .dark-mode .font-blue { color: #ccc; }
.dark-mode .btn-main { color: #ccc; }
.dark-mode .btn-main:hover { color: #fff !important; } 
.dark-mode .btn-main::before { background-color: #222; }
.dark-mode .btn-main:hover::before { background-color: #333; }
.dark-mode .nav-write { color: #ccc; border-color: #444; }
.dark-mode .nav-write:hover { background: #fff; color: #111; border-color: #fff; }

/* Dark Mode Admin */
.dark-mode #admin-wrapper { background-color: #121212; color: #e0e0e0; }
.dark-mode .admin-panel { background: #1e1e1e; }
.dark-mode .panel-title { color: #fff; }
.dark-mode label { color: #bbb; }
.dark-mode .input-admin { background: #121212; border-color: #333; color: #fff; }
.dark-mode .list-item { background: #1e1e1e; border-bottom-color: #333; }
.dark-mode .btn-edit-open { background: #333; color: #fff; border-color: #444; }
.dark-mode .btn-edit-open:hover { background: #555; }
.dark-mode #settings-panel { background: #2a2108; border-color: #5c4708; }

/* --- LOGIN OVERLAY --- */
#login-overlay {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85); 
    z-index: 9999; 
    display: flex; justify-content: center; align-items: center;
}
.login-box {
    background: white; padding: 40px; border-radius: 8px;
    text-align: center; width: 320px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    transition: 0.3s;
}
.login-input { 
    width: 100%; padding: 12px; margin-bottom: 15px; 
    border: 1px solid #ddd; border-radius: 4px; text-align: center; font-size: 1rem;
    font-family: 'Montserrat', sans-serif;
}
.login-btn-group { display: flex; gap: 10px; margin-top: 10px; }
.btn-cancel { flex: 1; padding: 12px; cursor: pointer; border: 1px solid #ccc; background: #f0f0f0; border-radius: 4px; font-weight: 600; font-family: 'Montserrat', sans-serif; }
.btn-cancel:hover { background: #e0e0e0; }
.btn-login { flex: 1; padding: 12px; cursor: pointer; border: none; background: #222; color: white; border-radius: 4px; font-weight: 600; font-family: 'Montserrat', sans-serif; }
.btn-login:hover { background: #000; }
#login-msg { color: #d32f2f; font-size: 0.85rem; margin-top: 15px; font-weight: 600; min-height: 20px; }

/* --- HOME --- */
#view-home { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 50px 20px; }
#view-home h1 { font-size: 2.5rem; font-weight: 500; letter-spacing: -0.5px; margin-bottom: 40px; }
.avatar { width: 220px; height: auto; display: block; margin: 0 auto; margin-bottom: 50px; transition: 0.3s; }

/* --- BUTTONS --- */
.buttons-row { display: flex; gap: 30px; flex-wrap: wrap; justify-content: center; width: 100%; max-width: 950px; align-items: center; }
.btn-torn {
    font-family: 'Montserrat', sans-serif; font-weight: 600; font-size: 13px; letter-spacing: 1px; 
    text-transform: uppercase; text-decoration: none; color: #fff; position: relative; 
    padding: 20px 30px; background: transparent; z-index: 1; max-width: 220px; cursor: pointer;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: transform 0.2s;
}
.btn-torn::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0; background-color: #222; z-index: -1; 
    filter: url(#torn-effect); clip-path: polygon(2% 5%, 98% 2%, 100% 95%, 3% 98%); transition: background-color 0.3s, transform 0.3s;
}
.btn-torn:hover { transform: scale(1.05); color: #fff; }
.btn-torn:hover::before { background-color: #000; transform: rotate(-1.5deg); }
.btn-main { color: #111; }
.btn-main::before { background-color: #eee; filter: url(#torn-effect) drop-shadow(3px 3px 5px rgba(0,0,0,0.2)); transform: rotate(1deg); }
.btn-main:hover { color: #000 !important; } 
.btn-main:hover::before { background-color: #fff; transform: rotate(2deg); }

/* --- STORIES --- */
#view-stories { min-height: 100vh; text-align: left; }
.stories-nav { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; padding: 0 10px; }

/* STICKY HEADER (TETAP DIAM SAAT DISCROLL) */
.list-header { 
    text-align: center; margin-bottom: 50px; border-bottom: 1px solid #eee; 
    padding-bottom: 20px; padding-top: 20px;
    position: sticky; top: 0; background-color: #fcfcfc; z-index: 100;
    transition: background-color 0.3s;
}

.list-header h2 { font-family: 'Montserrat', sans-serif; font-size: 2rem; text-transform: uppercase; letter-spacing: 2px; margin-top: 10px; }
.nav-link { text-decoration: none; color: #d4a373; font-size: 0.9rem; font-weight: 600; cursor: pointer; transition: 0.2s;}
.nav-link:hover { text-decoration: underline; color: #b88655;}
.nav-write { text-decoration: none; color: #555; font-size: 0.8rem; font-weight: 600; border: 1px solid #ddd; padding: 6px 15px; border-radius: 20px; transition: all 0.3s ease; cursor: pointer; }
.nav-write:hover { background-color: #222; color: #fff; border-color: #222; }

.card { background: white; border: 1px solid #f0f0f0; border-radius: 4px; margin-bottom: 25px; padding: 25px; transition: 0.2s; }
.card:hover { border-color: #d4a373; transform: translateY(-2px); box-shadow: 0 4px 15px rgba(0,0,0,0.03); }
.card-date { font-size: 0.8rem; color: #aaa; font-family: 'Montserrat', sans-serif; display: block; margin-bottom: 5px; }
.card-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 10px; font-family: 'Montserrat', sans-serif; cursor: pointer; color: #222; transition: 0.2s;}
.card-title:hover { color: #d4a373; }
.card-excerpt { color: #555; font-family: 'Merriweather', serif; font-size: 0.95rem; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* --- READ VIEW --- */
#view-read { min-height: 100vh; }
.article-header { text-align: center; margin-bottom: 50px; border-bottom: 1px solid #eee; padding-bottom: 40px; margin-top: 40px; }
.article-meta { font-family: 'Montserrat', sans-serif; color: #999; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 15px; }
.article-title { font-family: 'Montserrat', sans-serif; font-size: 2.5rem; font-weight: 700; line-height: 1.2; color: #111; }

/* FONT TULISAN TANGAN UNTUK ISI CERITA */
.article-content { font-family: 'Shadows Into Light', cursive; font-size: 24px; letter-spacing: 1.5px; line-height: 2; color: #222; }
.article-content p { margin-bottom: 28px; }

/* LIKE SECTION */
.like-section { text-align: center; margin: 60px 0; padding-top: 30px; border-top: 1px solid #eee; }
.btn-like { background: transparent; border: 2px solid #e74c3c; color: #e74c3c; border-radius: 50px; padding: 10px 25px; font-family: 'Montserrat', sans-serif; font-weight: 600; cursor: pointer; transition: 0.2s; display: inline-flex; align-items: center; gap: 8px; font-size: 1rem; }
.btn-like:hover { background: #ffebee; }
.dark-mode .btn-like:hover { background: #3a1515; }
.btn-like.liked { background-color: #e74c3c; color: white; cursor: default; border-color: #e74c3c; }
.btn-like span { font-size: 1.2rem; }

/* COMMENT SECTION */
.comment-section { background: #f9f9f9; padding: 30px; border-radius: 8px; margin-bottom: 50px; font-family: 'Montserrat', sans-serif; font-size: 1rem; line-height: 1.5; transition: 0.3s; }
.comment-section h3 { margin-bottom: 20px; font-size: 1.2rem; font-weight: 700;}
.comment-form input, .comment-form textarea { width: 100%; padding: 12px; margin-bottom: 10px; border: 1px solid #ddd; border-radius: 4px; font-family: 'Montserrat', sans-serif; transition: 0.3s;}
.comment-form button { background: #222; color: white; border: none; padding: 10px 20px; border-radius: 4px; cursor: pointer; font-weight: 600; font-family: 'Montserrat', sans-serif;}
.comment-form button:hover { background: #000; }
.comment-list { margin-top: 30px; }
.comment-item { border-bottom: 1px solid #eee; padding: 20px 0; transition: 0.3s;}
.comment-item:last-child { border-bottom: none; }
.comment-name { font-weight: 700; color: #333; display: block; font-size: 0.95rem; }

/* FONT TULISAN TANGAN UNTUK ISI KOMENTAR */
.comment-text { color: #444; font-family: 'Shadows Into Light', cursive; font-size: 21px; line-height: 1.6; margin-top: 8px; }
.comment-date { font-size: 0.75rem; color: #aaa; margin-top: 8px; display: block; font-family: 'Montserrat', sans-serif;}

/* --- ADMIN --- */
#admin-wrapper { background-color: #f4f4f4; min-height: 100vh; font-family: 'Merriweather', serif; padding-bottom: 50px; transition: 0.3s;}
.admin-header { background: #222; color: white; padding: 25px; border-radius: 8px; margin-bottom: 30px; display: flex; justify-content: space-between; align-items: center; }
.admin-header h1 { font-family: 'Montserrat', sans-serif; font-size: 1.2rem; text-transform: uppercase; letter-spacing: 2px; }
.admin-actions button { background: transparent; border: 1px solid #555; color: #ccc; padding: 5px 10px; border-radius: 4px; cursor: pointer; margin-left: 10px; font-family: 'Montserrat', sans-serif; font-size: 0.8rem;}
.admin-actions button:hover { background: #444; color: white; }
.admin-panel { background: white; padding: 30px; border-radius: 8px; box-shadow: 0 4px 15px rgba(0,0,0,0.05); margin-bottom: 40px; transition: 0.3s;}
.panel-title { font-family: 'Montserrat', sans-serif; font-weight: 700; margin-bottom: 20px; color: #222; }
.form-group { margin-bottom: 20px; }
label { display: block; margin-bottom: 8px; font-family: 'Montserrat', sans-serif; font-size: 0.85rem; font-weight: 600; color: #555; }
.input-admin { width: 100%; padding: 12px; border: 1px solid #ddd; border-radius: 4px; font-family: 'Merriweather', serif; font-size: 1rem; transition: 0.3s;}
.btn-admin { cursor: pointer; font-family: 'Montserrat', sans-serif; text-transform: uppercase; font-weight: 600; border: none; padding: 12px 25px; border-radius: 4px; background: #222; color: white; font-size: 0.85rem;}
.btn-admin:hover { background: #000; }
.btn-delete { background: #fff0f0; color: #c0392b; }
.btn-delete:hover { background: #e74c3c; color: white; }
.btn-save { background: #27ae60; color: white; }
.list-item { padding: 20px; border-bottom: 1px solid #eee; display: flex; justify-content: space-between; align-items: center; background: white; transition: 0.3s;}
.btn-edit-open { background: transparent; border: 1px solid #ddd; padding: 8px 15px; cursor: pointer; font-family: 'Montserrat', sans-serif; font-size: 0.8rem; font-weight: 600; transition: 0.3s;}
.btn-edit-open:hover { background: #222; color: white; border-color: #222;}

@media (max-width: 768px) {
    .buttons-row { flex-direction: column; width: 85%; gap: 15px; }
    .btn-torn { width: 100%; max-width: 100%; }
    .btn-torn::before { filter: none; clip-path: none; border-radius: 4px; transform: none !important; }
    .article-content { font-size: 21px; }
    .theme-toggle-btn { width: 45px; height: 45px; bottom: 20px; right: 20px; font-size: 1.2rem;}
}