/* === Variabel CSS (Konsisten dengan Halaman Utama/Baca) === */
:root {
    --primary-color: #0077cc;
    --text-color: #333; /* Sedikit lebih gelap dari #222 untuk readability */
    --light-gray: #ccc;
    --dark-gray: #666;
    --bg-light: #f8f8f8; /* Warna latar belakang yang lebih halus, konsisten */
    --bg-color: #fff; /* Latar belakang halaman utama */

    --spacing-xs: 0.5rem;   /* 8px */
    --spacing-sm: 1rem;     /* 16px */
    --spacing-md: 1.5rem;   /* 24px */
    --spacing-lg: 2rem;     /* 32px */
    --spacing-xl: 2.5rem;   /* 40px */
    --spacing-xxl: 3rem;    /* 48px */
    --content-max-width: 1200px; /* Lebar maksimal konten utama, konsisten */
    --border-color: #eee;
}

/* === RESET & BASE === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    line-height: 1.6;
    background: var(--bg-light);
    color: var(--text-color);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    text-decoration: none;
    color: var(--primary-color);
    transition: color 0.3s ease;
}

a:hover {
    color: #0056b3;
    text-decoration: underline;
}

/* === HEADER === */
header {
    display: flex;
    flex-direction: column; /* Menumpuk branding dan nav secara vertikal */
    align-items: center;    /* Pusatkan konten header */
    padding: var(--spacing-lg) var(--spacing-sm) var(--spacing-md);
    border-bottom: 1px solid var(--light-gray);
    background-color: var(--bg-color);
    max-width: var(--content-max-width);
    margin: 0 auto;
    width: 100%;
}

/* Wadah untuk logo dan grup teks (nama dan tagline) */
.header-branding {
    display: flex;
    align-items: center; /* Pusatkan vertikal logo dan grup teks */
    gap: var(--spacing-md); /* Jarak antara logo dan grup teks */
    margin-bottom: var(--spacing-md); /* Jarak antara branding dan nav */
    padding: 0 var(--spacing-sm); /* Tambahkan padding samping agar tidak terlalu mepet */
}

/* Menghilangkan margin bawah default dari h1 (berisi gambar) */
header h1 {
    margin-bottom: 0;
    line-height: 1;
}

/* Aturan untuk logo gambar */
.header-logo {
    max-width: 70px; /* Ukuran logo di desktop (sesuaikan sesuai kebutuhan) */
    height: auto;
    display: block;
    flex-shrink: 0;
}

/* Wadah untuk nama situs dan tagline */
.header-text-group {
    display: flex;
    flex-direction: column; /* Menumpuk nama dan tagline */
    align-items: flex-start; /* Nama dan tagline rata kiri dalam grup */
}

/* Styling untuk nama situs (CyberTadabbur) */
header h2 {
    font-size: 1.8rem; /* Ukuran nama situs agar menonjol */
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 0.2rem; /* Jarak kecil antara nama dan tagline */
    line-height: 1.2; /* Kerapatan baris */
    white-space: nowrap; /* Pastikan nama tidak pecah baris jika memungkinkan */
}

/* Styling untuk tagline */
.header-tagline {
    font-size: 0.95rem; /* Ukuran tagline lebih kecil dari nama */
    color: var(--dark-gray);
    margin-bottom: 0; /* Hapus margin bawah default dari p */
    font-style: italic;
    line-height: 1.4;
    white-space: nowrap; /* Pastikan tagline tidak pecah baris jika memungkinkan */
}

nav {
    display: flex;
    flex-wrap: wrap;
    gap: var(--spacing-sm);
    justify-content: center;
    padding: 0 var(--spacing-xs);
}

nav a {
    padding: var(--spacing-xs) var(--spacing-sm);
    color: var(--dark-gray);
    font-weight: 600;
    font-size: clamp(0.9rem, 2vw, 1rem);
    border-radius: 4px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

nav a:hover {
    background-color: var(--primary-color);
    color: #fff;
    text-decoration: none;
}

/* === MAIN CONTENT: Welcome Page Specifics === */
main {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--spacing-xxl) var(--spacing-sm);
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

main h2 { /* Ini adalah h2 untuk "Welcome to CyberTadabbur" di main content */
    font-size: 2.2rem;
    margin-bottom: var(--spacing-md);
    color: var(--text-color);
}

.welcome-text {
    font-size: 1.2rem;
    line-height: 1.8;
    max-width: 700px;
    margin: 0 auto var(--spacing-xl);
    color: var(--text-color);
}

.language-options {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--spacing-sm);
    margin-top: var(--spacing-lg);
    width: 100%;
    padding: 0 var(--spacing-sm);
}

.language-options li {
    flex: 0 0 auto;
}

.language-option-link {
    display: block;
    padding: var(--spacing-sm) var(--spacing-md);
    border: 1px solid var(--light-gray);
    border-radius: 8px;
    background-color: var(--bg-color);
    color: var(--primary-color);
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    min-width: 150px;
    text-align: center;
}

.language-option-link:hover {
    background-color: var(--primary-color);
    color: #fff;
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    text-decoration: none;
}

/* === FOOTER === */
footer {
    margin-top: var(--spacing-xl);
    padding: var(--spacing-md) var(--spacing-sm);
    border-top: 1px solid var(--border-color);
    text-align: center; /* Akan di-override oleh flexbox untuk itemnya */
    font-size: 0.9rem;
    color: var(--dark-gray);
    max-width: var(--content-max-width);
    margin-left: auto;
    margin-right: auto;
    flex-shrink: 0;
    background-color: var(--bg-color);

    display: flex; /* Jadikan footer sebagai flex container */
    flex-direction: row; /* Defaultnya sejajar di desktop */
    justify-content: center; /* Pusatkan item secara horizontal */
    align-items: center; /* Pusatkan item secara vertikal */
    gap: var(--spacing-sm); /* Jarak antara copyright dan tagline di desktop */
}

/* Styling untuk setiap bagian teks footer */
.footer-copyright,
.footer-tagline {
    /* font-size: inherit; (tidak perlu karena inherit dari footer) */
    white-space: nowrap; /* Coba pertahankan satu baris di desktop */
}

/* Tambahkan pemisah visual (misalnya titik atau garis) di desktop */
.footer-copyright:after {
    content: "|"; /* Tambahkan pemisah setelah copyright */
    margin-left: var(--spacing-sm); /* Jarak ke pemisah */
    color: var(--light-gray);
}


/* === RESPONSIVE LAYOUT === */
@media (max-width: 768px) {
    .header-logo {
        max-width: 50px; /* Ukuran logo di tablet/mobile */
    }

    /* Untuk mobile, branding kembali menumpuk secara vertikal */
    .header-branding {
        flex-direction: column; /* Logo dan grup teks menumpuk di mobile */
        gap: var(--spacing-xs); /* Jarak antar logo dan grup teks saat menumpuk */
        padding: 0 var(--spacing-sm);
    }
    .header-text-group {
        align-items: center; /* Pusatkan nama dan tagline saat menumpuk */
    }

    header h2 { /* Ukuran nama situs di mobile */
        font-size: 1.5rem;
        text-align: center;
        white-space: normal; /* Biarkan nama pecah baris jika perlu */
    }
    .header-tagline { /* Ukuran tagline di mobile */
        font-size: 0.85rem;
        text-align: center;
        white-space: normal; /* Biarkan tagline pecah baris jika perlu */
    }

    header p { /* Aturan ini khusus untuk paragraf di header yang bukan tagline */
        font-size: 1rem;
    }
    nav a {
        font-size: 0.85rem;
        padding: var(--spacing-xs) var(--spacing-sm);
    }

    main {
        padding: var(--spacing-lg) var(--spacing-xs);
    }
    main h2 { /* h2 di main content */
        font-size: 1.8rem;
    }
    .welcome-text {
        font-size: 1rem;
        padding: 0 var(--spacing-xs);
        margin-bottom: var(--spacing-lg);
    }

    /* === Perbaikan Tombol Bahasa di Mobile: Layout Lebih Dinamis === */
    .language-options {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: var(--spacing-sm);
        padding: 0 var(--spacing-md);
    }

    .language-options li {
        flex: 0 0 auto;
        margin-bottom: var(--spacing-xs);
    }

    .language-option-link {
        width: auto;
        min-width: 120px;
        font-size: 0.9rem;
        padding: var(--spacing-sm) var(--spacing-xs);
        text-align: center;
    }

    /* === Perbaikan Footer Stacking di Mobile === */
    footer {
        flex-direction: column; /* Mengubah arah flex menjadi kolom untuk stacking */
        text-align: center; /* Rata tengah teks */
        padding: var(--spacing-md) var(--spacing-xs); /* Padding responsif */
        font-size: 0.8rem; /* Ukuran font lebih kecil */
        gap: var(--spacing-xs); /* Jarak antar item saat menumpuk */
    }

    /* Hapus pemisah di mobile */
    .footer-copyright:after {
        content: none;
    }

    .footer-copyright,
    .footer-tagline {
        white-space: normal; /* Biarkan teks pecah baris di mobile */
    }
}

/* Tambahan media query untuk layar yang sangat kecil (misal: smartphone portrait) */
@media (max-width: 480px) {
    .header-logo {
        max-width: 70px; /* Ukuran logo di layar sangat kecil */
    }
    header h2 {
        font-size: 1.3rem; /* Ukuran nama situs di layar sangat kecil */
    }
    .header-tagline {
        font-size: 0.8rem; /* Ukuran tagline lebih kecil di layar sangat kecil */
    }

    .language-options {
        padding: 0 var(--spacing-sm);
    }
    .language-options li {
        min-width: 100px;
        margin-bottom: var(--spacing-xs);
    }
    .language-option-link {
        font-size: 0.95rem;
        padding: var(--spacing-sm);
        min-width: 150px;
    }

    footer {
        flex-direction: column; /* Pastikan tetap kolom */
    }
}

/* Spinner overlay */
#loading-spinner {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.85);
    display: none; /* Awalnya hidden */
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

/* Spinner animasi */
.spinner {
    border: 8px solid #f3f3f3;
    border-top: 8px solid #3498db;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

#loading-spinner p {
    margin-top: 15px;
    font-size: 1.1rem;
    color: #333;
}
