@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700&display=swap');

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

body {
    background: linear-gradient(135deg, #0f2027, #203a43, #2c5364);
    background-attachment: fixed;
    color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.glass-container {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 45px rgba(0, 0, 0, 0.2);
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    transition: transform 0.3s ease;
}

.glass-container:hover {
    transform: translateY(-5px);
}

.glass-container.large {
    max-width: 800px;
    height: 85vh;
    display: flex;
    flex-direction: column;
    padding: 0;
}

h2 {
    text-align: center;
    margin-bottom: 30px;
    font-weight: 600;
    letter-spacing: 1px;
    color: #fff;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: #ccc;
}

.input-group input {
    width: 100%;
    padding: 12px 15px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    color: #fff;
    font-size: 16px;
    outline: none;
    transition: all 0.3s ease;
}

.input-group input:focus {
    background: rgba(255, 255, 255, 0.2);
    border-color: #00d2ff;
    box-shadow: 0 0 10px rgba(0, 210, 255, 0.3);
}

.btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(45deg, #00d2ff, #3a7bd5);
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 210, 255, 0.3);
}

.btn:hover {
    box-shadow: 0 6px 20px rgba(0, 210, 255, 0.5);
    transform: scale(1.02);
}

.link-text {
    text-align: center;
    margin-top: 20px;
    font-size: 14px;
}

.link-text a {
    color: #00d2ff;
    text-decoration: none;
    transition: color 0.3s;
}

.link-text a:hover {
    color: #3a7bd5;
    text-decoration: underline;
}

.alert {
    padding: 10px;
    background: rgba(255, 75, 75, 0.2);
    border-left: 4px solid #ff4b4b;
    margin-bottom: 20px;
    border-radius: 4px;
    font-size: 14px;
}

/* Chat Styles */
.chat-header {
    padding: 20px 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0,0,0,0.1);
    border-radius: 20px 20px 0 0;
}

.chat-header h3 {
    font-weight: 600;
}

.chat-header .logout-btn {
    background: rgba(255, 75, 75, 0.2);
    color: #ff4b4b;
    padding: 8px 15px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.3s;
}

.chat-header .logout-btn:hover {
    background: rgba(255, 75, 75, 0.4);
    color: #fff;
}

.chat-messages {
    flex: 1;
    padding: 20px 30px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message {
    background: rgba(255, 255, 255, 0.05);
    padding: 12px 18px;
    border-radius: 15px 15px 15px 0;
    max-width: 75%;
    align-self: flex-start;
    animation: fadeIn 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.message.self {
    align-self: flex-end;
    background: linear-gradient(45deg, #00d2ff, #3a7bd5);
    border-radius: 15px 15px 0 15px;
    border: none;
    box-shadow: 0 4px 15px rgba(0, 210, 255, 0.2);
}

.message .sender {
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 5px;
    opacity: 0.7;
}

.message.self .sender {
    display: none;
}

.message .text {
    font-size: 15px;
    line-height: 1.4;
    word-break: break-word; /* Penting untuk chat panjang di layar HP */
}

.message .time {
    font-size: 10px;
    opacity: 0.5;
    text-align: right;
    margin-top: 5px;
}

.chat-input {
    padding: 20px 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    gap: 15px;
    background: rgba(0,0,0,0.1);
    border-radius: 0 0 20px 20px;
}

.chat-input input {
    flex: 1;
    min-width: 0;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 15px 20px;
    border-radius: 15px;
    color: white;
    outline: none;
    font-size: 15px;
    transition: all 0.3s;
}

.chat-input input:focus {
    background: rgba(255, 255, 255, 0.15);
    border-color: #00d2ff;
}

.chat-input button {
    width: auto;
    padding: 0 25px;
    border-radius: 15px;
    flex-shrink: 0;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ================================================== */
/* MOBILE OPTIMIZATIONS (HP & TABLET)                 */
/* ================================================== */
@media (max-width: 600px) {
    body {
        align-items: flex-start; /* Mencegah layar terpotong di bagian atas saat di-scroll */
        overflow-x: hidden;
    }

    /* Container untuk Login & Register */
    .glass-container {
        width: 100%;
        min-height: 100dvh; /* Menggunakan dvh (dynamic viewport height) agar sinkron dengan bar browser HP */
        border-radius: 0;
        border: none;
        padding: 30px 20px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        box-shadow: none;
    }

    .glass-container:hover {
        transform: none; /* Matikan animasi hover di HP (bikin lag) */
    }

    /* Container Spesifik untuk Layout Chat */
    .glass-container.large {
        justify-content: flex-start;
        padding: 0;
        height: 100dvh; /* Kunci setinggi layar, mencegah scroll luar */
    }

    .chat-header {
        padding: 15px 15px;
        border-radius: 0;
    }

    .chat-header h3 {
        font-size: 16px;
    }

    .chat-header span {
        display: none; /* Sembunyikan tulisan "Logged in as" biar hemat tempat */
    }

    .chat-messages {
        padding: 15px;
    }

    .message {
        max-width: 85%; /* Lebarkan batas pesan di HP karena layarnya sempit */
    }

    .chat-input {
        padding: 10px 10px;
        border-radius: 0;
        gap: 8px; /* Dekatkan jarak antar tombol biar pas */
    }

    .chat-input input {
        padding: 12px 15px;
        font-size: 16px; /* SANGAT PENTING: 16px mencegah browser iOS/iPhone melakukan auto-zoom saat ngetik */
        border-radius: 12px;
    }

    .attach-btn {
        padding: 0 15px;
        font-size: 20px; /* Perbesar area sentuh untuk jempol */
        border-radius: 12px;
    }

    .chat-input button#send-btn {
        padding: 0 15px;
        font-size: 14px;
        border-radius: 12px;
    }
}
