/* RESET */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

:root {
    --primary-color: #ff2963;
    --primary-hover: #ff4f7a;
    --bg-gradient: linear-gradient(45deg, #0d6137, #27095b);
    --dark-bg: #1e1e1e;
    --card-bg: rgba(255, 255, 255, 0.08);
    --accent-color: #00ffd5;
    --download-bg: #28a745;
}

/* BODY */
body {
    width: 100%;
    min-height: 100vh;
    background: #0d6137; /* Fallback */
}

/* HERO CONTAINER */
.hero {
    width: 100%;
    min-height: 100vh;
    background: var(--bg-gradient);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    color: #fff;
    padding: 80px 20px 40px 20px;
}

/* TITLE */
.hero h1 {
    font-size: 48px;
    font-weight: 600;
    margin-bottom: 35px;
    text-align: center;
    line-height: 1.3;
    width: 100%;
    max-width: 800px;
}

.hero h1 span {
    color: var(--primary-color);
}

/* HEADER BUTTONS (FIXED TOP) */
.auth-btn, #userInfo {
    position: absolute;
    top: 20px;
    z-index: 10;
}

.auth-btn { left: 20px; }
#userInfo { right: 20px; }

.auth-btn button {
    padding: 8px 16px;
    margin-right: 5px;
    cursor: pointer;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.1);
    color: white;
    backdrop-filter: blur(5px);
    transition: 0.3s;
    font-size: 14px;
}

#userInfo {
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0,0,0,0.3);
    padding: 6px 15px;
    border-radius: 30px;
    backdrop-filter: blur(5px);
}

#userInfo button {
    background: var(--primary-color);
    border: none;
    color: white;
    padding: 4px 12px;
    border-radius: 15px;
    cursor: pointer;
    font-size: 11px;
    font-weight: bold;
}

/* LANGUAGE BAR */
.language-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.language-bar select {
    padding: 8px 12px;
    border-radius: 8px;
    border: none;
    background: white;
    font-size: 14px;
}

#swapLang {
    padding: 8px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    border: none;
    background: var(--primary-color);
    color: white;
}

/* TEXTAREA */
textarea {
    width: 100%;
    max-width: 700px;
    height: 250px;
    background: rgba(255,255,255,0.12);
    backdrop-filter: blur(10px);
    color: #fff;
    font-size: 16px;
    border: 1px solid rgba(255,255,255,0.15);
    outline: none;
    padding: 20px;
    border-radius: 15px;
    resize: none;
    margin-bottom: 15px;
}

/* CONTROL AREA & BUTTONS (INLINE FIX) */
.row {
    width: 100%;
    max-width: 700px;
    display: flex;
    flex-direction: row; /* Tetap sejajar */
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap; /* Mencegah tombol turun ke bawah */
    margin-bottom: 10px;
}

.row select {
    flex: 2; /* Box suara lebih lebar */
    height: 48px;
    padding: 0 10px;
    border: none;
    border-radius: 12px;
    background: #403d84;
    color: #fff;
    outline: none;
    font-size: 13px;
    min-width: 0; /* Mencegah overflow */
}

.row button {
    flex: 1; /* Tombol Listen & Translate bagi rata */
    background: var(--primary-color);
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    padding: 12px 5px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    white-space: nowrap; /* Teks tidak kepotong baris baru */
    transition: 0.3s ease;
}

/* POSTER SECTION */
.poster-row {
    width: 100%;
    max-width: 700px;
    display: flex;
    gap: 8px;
    margin-top: 5px;
}

#generatePosterBtn {
    flex: 1;
    background: var(--primary-color);
    color: #fff;
    font-size: 14px;
    padding: 12px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
}

/* STYLE BARU UNTUK DOWNLOAD BUTTON */
#downloadBtn {
    background: var(--download-bg);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    padding: 12px 25px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    margin-top: 15px;
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
    transition: all 0.3s ease;
}

button:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

#downloadBtn:hover {
    background: #218838;
    box-shadow: 0 6px 20px rgba(40, 167, 69, 0.4);
}

/* HISTORY SECTION */
.section {
    margin-top: 40px;
    width: 100%;
    max-width: 700px;
    background: rgba(0,0,0,0.1);
    padding: 20px;
    border-radius: 15px;
}

.section h2 {
    margin-bottom: 20px;
    font-size: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.section button[onclick="clearHistory()"] {
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.2);
    font-size: 12px;
    padding: 6px 15px;
    border-radius: 20px;
    color: #fff;
    flex: none;
}

.history-item {
    background: var(--card-bg);
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 10px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

/* RESPONSIVE BREAKPOINTS */
@media (max-width: 768px) {
    .hero { padding-top: 120px; } /* Tambah space atas agar h1 turun */
    .hero h1 { font-size: 32px; }
    textarea { height: 180px; }
}

@media (max-width: 480px) {
    .hero { padding-top: 140px; } /* Khusus Samsung A6+ biar judulnya lebih turun lagi */
    .hero h1 { font-size: 24px; margin-bottom: 20px; }
    
    /* Header Mobile */
    .auth-btn, #userInfo { top: 15px; } /* Naikkan sedikit posisi tombol auth agar tidak kena status bar */
    .auth-btn button { padding: 6px 10px; font-size: 11px; }
    #userInfo { padding: 4px 10px; max-width: 140px; }
    #userInfo b { display: none; }

    /* Pengaturan Baris Tombol agar tetap Sejajar */
    .row { 
        flex-direction: row !important; 
        gap: 5px; 
        flex-wrap: nowrap !important;
    }
    
    .row select {
        flex: 1.5;
        font-size: 11px;
        height: 40px;
    }

    .row button {
        flex: 1;
        font-size: 11px;
        padding: 10px 2px;
    }

    #generatePosterBtn, #downloadBtn {
        width: 100%;
        font-size: 12px;
        padding: 12px;
    }
}