/* =========================================================
   KlikNovel - Custom Styles
   ========================================================= */

/* Fonts & Base */
@import url('https://fonts.googleapis.com/css2?family=Noto+Serif&display=swap');

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

html {
    margin: 0;
    padding: 0;
    height: 100%;
}

body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: #f8f9fb;
    font-family: 'Noto Serif', 'Segoe UI', system-ui, sans-serif;
    user-select: none;
    -webkit-user-select: none;
}

main {
    flex: 1;
}

/* ===== HEADER ===== */
.site-header {
    position: relative;
    top: 0;
    background: #fff;
    z-index: 1000;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.header-container {
    padding: 5px 30px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.site-logo {
    flex: 1;
}

.site-logo img {
    max-height: 35px;
    height: auto;
    width: auto;
}

.site-logo a {
    font-weight: bold;
    font-size: 1.5rem;
    text-decoration: none;
    color: #111;
}

.menu-user-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.main-nav {
    display: flex;
    flex: 1;
    text-align: center;
}

.nav-menu {
    list-style: none;
    display: flex;
    gap: 1rem;
    margin: 0;
    padding: 0;
}

.nav-menu li {
    margin: 0 10px;
}

.nav-menu a {
    text-decoration: none;
    color: #333;
    font-weight: 500;
}

.user-icon img {
    border-radius: 50%;
}

.menu-toggle {
    display: none;
    flex-direction: column;
    cursor: pointer;
}

.menu-toggle span {
    width: 25px;
    height: 3px;
    background: #333;
    margin: 4px 0;
}

/* Tombol Login di Header */
.kliknovel-login-button {
    display: inline-block;
    padding: 8px 16px;
    background-color: #2d6cdf;
    color: #fff;
    border-radius: 6px;
    font-weight: bold;
    text-decoration: none;
    font-size: 0.95rem;
    transition: background-color 0.2s ease;
}

.kliknovel-login-button:hover {
    background-color: #1a56bb;
}

/* ===== LAYOUT UMUM ===== */
.homepage-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.novel-section {
    margin-top: 40px;
}

.novel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 20px;
}

.novel-card {
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    text-align: center;
    transition: transform 0.3s;
}

.novel-card:hover {
    transform: scale(1.05);
}

.novel-card img {
    width: 100%;
    height: 250px;
    object-fit: cover;
}

.novel-card h3 {
    padding: 10px;
    font-size: 16px;
}

.genre-group {
    margin-top: 30px;
}

.genre-group h3 {
    font-size: 20px;
    margin-bottom: 15px;
}

/* ===== HALAMAN STATIS ===== */
.page-container {
    max-width: 960px;
    margin: 50px auto 80px;
    padding: 0 20px;
    color: #333;
}

.page-container h1 {
    text-align: center;
    font-weight: 700;
    font-size: 2.5rem;
    margin-bottom: 50px;
    color: #222;
}

.page-container h2 {
    text-align: left;
    font-weight: 700;
    font-size: 1.5rem;
    margin-top: 30px;
    margin-bottom: 8px;
    color: #222;
}

.page-container p {
    font-size: 1.1em;
    color: #444;
    margin-bottom: 20px;
    line-height: 1.6;
}

.page-container a {
    color: #0073aa;
    text-decoration: underline;
}

.page-container a:hover {
    text-decoration: none;
}

/* ===== MODAL LOGIN ===== */
.login-modal {
    position: fixed;
    z-index: 9999;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-modal-content {
    background: #fff;
    padding: 2rem;
    border-radius: 10px;
    max-width: 400px;
    width: 90%;
    position: relative;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.close-login-modal {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 1.5rem;
    cursor: pointer;
}

.login-modal-content input[type="email"],
.login-modal-content input[type="password"] {
    width: 100%;
    padding: 10px;
    margin-bottom: 12px;
    border: 1px solid #bbb;
    border-radius: 4px;
    font-size: 1rem;
    box-sizing: border-box;
}

.remember-label {
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    margin-bottom: 1rem;
}

.remember-label input {
    margin-right: 6px;
}

.login-modal-content button {
    width: 100%;
    padding: 10px;
    background: #2d6cdf;
    color: white;
    border: none;
    border-radius: 5px;
    font-weight: bold;
    font-size: 1rem;
    cursor: pointer;
}

.login-modal-content button:hover {
    background: #1a56bb;
}

.login-modal-content a {
    color: #2d6cdf;
    text-decoration: none;
}

.login-modal-content a:hover {
    text-decoration: underline;
}

/* ===== NOTIFIKASI ===== */
.notif-wrapper {
    display: flex;
    justify-content: center;
    margin: 0 0 0.85rem;
}

.notif-box {
    max-width: 600px;
    width: 100%;
    padding: 1rem 1.5rem;
    border-radius: 10px;
    font-size: 0.95rem;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.notif-box.success {
    background-color: #e6ffed;
    border: 1px solid #a3e6b3;
    color: #216e39;
}

.notif-box.warning {
    background-color: #fff8e1;
    border: 1px solid #ffdf85;
    color: #8a6d3b;
}

.notif-box.error {
    background-color: #ffe6e6;
    border: 1px solid #ff9999;
    color: #a94442;
}

.notif-dismiss {
    background: none;
    border: none;
    font-size: 1.2rem;
    line-height: 1;
    color: #999;
    cursor: pointer;
    padding: 0 8px;
}

/* ===== SEPARATOR & GOOGLE SIGNIN ===== */
.separator {
    position: relative;
    text-align: center;
    margin: 30px 0 20px;
}

.separator span {
    background: white;
    padding: 0 12px;
    color: #666;
    font-size: 0.9em;
    position: relative;
    z-index: 1;
}

.separator::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 0;
    height: 1px;
    width: 100%;
    background: #ddd;
    z-index: 0;
}

.google-signin-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

/* ===== IKLAN ====== */


/* ===== FOOTER ===== */
.site-footer {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 1rem 0;
    color: #555;
    line-height: 1.5;
    margin-bottom: 1.2em;
}

.footer-main {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    gap: 0.2rem;
}

.footer-menu {
    display: flex;
    gap: 0.5rem;
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-menu-right {
    font-weight: 100;
    gap: 0.35rem;
}

.footer-separator {
    margin: 0 10px;
    color: #aaa;
}

.footer-menu a {
    color: inherit;
    text-decoration: none;
}

.footer-menu a:hover {
    text-decoration: underline;
}

.footer-credit {
    font-size: 0.8rem;
    opacity: 0.9;
    display: inline-flex;
    align-items: center;
}

.heart {
    color: #ff4d4d;
    margin: 0 3px;
    display: inline-flex;
}

.bendera {
    height: 13px;
    margin-left: 5px;
    vertical-align: middle;
}

/* =========================================================
   RESPONSIVE STYLES (Mobile & Tablet)
   ========================================================= */

/* Tablet (max-width: 768px) */
@media (max-width: 768px) {

         /* ===== HEADER MOBILE - RESET TOTAL ===== */
    .header-container {
        padding: 8px 15px;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    .site-logo {
        order: 2;
        flex: 1;
        text-align: center;
    }

    .site-logo img {
        max-height: 40px;
    }

    /* Toggle di KIRI */
    .menu-toggle {
        display: flex;
        order: 1;
        cursor: pointer;
        z-index: 1001;
    }

    .menu-toggle span {
        width: 25px;
        height: 3px;
        background: #333;
        margin: 4px 0;
        display: block;
    }

    /* User icon di KANAN */
    .user-icon {
        order: 3;
        display: block;
    }

    /* Menu container - slide dari KIRI (karena toggle di kiri) */
    .menu-user-wrapper {
        position: fixed;
        top: 0;
        left: -100%;
        width: 260px;
        height: 100vh;
        background: #fff;
        display: block;
        transition: left 0.3s ease;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.15);
        z-index: 1000;
        padding-top: 60px;
        overflow-y: auto;
    }

    .menu-user-wrapper.active {
        left: 0;
    }

    /* Menu items - rapat ke kiri */
    .nav-menu {
        display: block;
        list-style: none;
        padding: 0;
        margin: 0;
    }

    .nav-menu li {
        display: block;
        margin: 0;
        padding: 0;
        border-bottom: 1px solid #eee;
    }

    .nav-menu a {
        display: block;
        padding: 12px 20px;
        font-size: 0.95rem;
        color: #333;
        text-decoration: none;
        background: #fff;
    }

    .nav-menu a:hover {
        background: #f5f5f5;
    }

    /* Tombol login - sebagai item menu tambahan */
    .kliknovel-login-button {
        display: block;
        margin: 16px;
        padding: 10px 16px;
        background: #2d6cdf;
        color: #fff;
        text-align: center;
        border-radius: 6px;
        font-size: 0.9rem;
        font-weight: 500;
        text-decoration: none;
    }

    .kliknovel-login-button:hover {
        background: #1a56bb;
    }

    /* Novel Grid */
    .novel-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .novel-card img {
        height: 180px;
    }

    .novel-card h3 {
        font-size: 0.8rem;
        padding: 8px 5px;
    }

    /* Homepage Container */
    .homepage-container {
        padding: 12px;
    }

    .novel-section {
        margin-top: 24px;
    }

    /* Modal Login */
    .login-modal-content {
        width: 92%;
        padding: 1.5rem;
        max-height: 90vh;
        overflow-y: auto;
    }

    .close-login-modal {
        top: 8px;
        right: 12px;
        font-size: 1.3rem;
    }

    /* Page Container (Halaman Statis) */
    .page-container {
        margin: 20px auto 40px;
        padding: 0 16px;
    }

    .page-container h1 {
        font-size: 1.6rem;
        margin-bottom: 20px;
    }

    .page-container h2 {
        font-size: 1.2rem;
    }

    .page-container p {
        font-size: 0.95rem;
        margin-bottom: 1.2em !important;
        line-height: 1.7 !important;
    }

    /* Notifikasi */
    .notif-box {
        padding: 0.75rem 1rem;
        font-size: 0.85rem;
    }

    /* Genre Group */
    .genre-group h3 {
        font-size: 1.2rem;
    }
}

/* Mobile Kecil (max-width: 480px) */
@media (max-width: 480px) {

    /* Novel Grid */
    .novel-grid {
        gap: 10px;
    }

    .novel-card img {
        height: 150px;
    }

    /* Modal Login */
    .login-modal-content {
        width: 95%;
        padding: 1.2rem;
    }

    .login-modal-content h2 {
        font-size: 1.2rem;
    }

    .login-modal-content input {
        font-size: 16px;
        padding: 10px;
    }

    /* Footer */
    .footer-main {
        flex-direction: column;
        gap: 8px;
    }

    .footer-menu {
        flex-wrap: wrap;
        justify-content: center;
    }

    .footer-separator {
        display: none;
    }

    .footer-credit {
        font-size: 0.7rem;
    }
}

/* PWA Standalone Mode (dibuka sebagai aplikasi dari home screen) */
@media (display-mode: standalone) {
    body {
        padding-top: env(safe-area-inset-top);
        padding-bottom: env(safe-area-inset-top);
    }

    .site-header {
        padding-top: env(safe-area-inset-top);
    }
}