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

:root {
    --primary: #00b4d8;
    --primary-dark: #0096c7;
    --primary-light: #48cae4;
    --bg-dark: #0a0a0f;
    --bg-card: rgba(15, 17, 23, 0.8);
    --text: #ffffff;
    --text-muted: #a0a0b0;
    --border: rgba(255, 255, 255, 0.1);
    --message-me: linear-gradient(135deg, #00b4d8, #0096c7);
    --message-other: rgba(255, 255, 255, 0.1);
}

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    height: 100vh;
    overflow: hidden;
}

.app {
    max-width: 500px;
    margin: 0 auto;
    height: 100vh;
    background: var(--bg-dark);
    position: relative;
    box-shadow: 0 0 40px rgba(0,0,0,0.3);
}

/* Auth Page */
.auth-page {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-container {
    width: 100%;
    max-width: 360px;
}

.auth-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border-radius: 32px;
    padding: 40px 28px;
    text-align: center;
    border: 1px solid var(--border);
}

.auth-logo {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.auth-logo i {
    font-size: 32px;
    color: white;
}

.auth-card h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text);
}

.auth-subtitle {
    color: var(--text-muted);
    margin-bottom: 32px;
}

.auth-tabs {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border);
}

.auth-tab {
    flex: 1;
    background: none;
    border: none;
    padding: 12px;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.3s;
}

.auth-tab.active {
    color: var(--primary);
    border-bottom: 2px solid var(--primary);
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
}

.input-group {
    display: flex;
    align-items: center;
    background: rgba(0,0,0,0.3);
    border-radius: 60px;
    padding: 4px 20px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
    transition: all 0.3s;
}

.input-group:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 20px rgba(0,180,216,0.2);
}

.input-group i {
    color: var(--primary);
    font-size: 18px;
    margin-right: 12px;
}

.auth-input {
    flex: 1;
    border: none;
    background: none;
    padding: 16px 0;
    font-size: 16px;
    color: var(--text);
    outline: none;
}

.auth-input::placeholder {
    color: var(--text-muted);
}

.auth-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    border-radius: 60px;
    padding: 14px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.auth-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,180,216,0.3);
}

.auth-error {
    color: #ff6b6b;
    font-size: 12px;
    margin-top: 16px;
}

.auth-footer {
    text-align: center;
    margin-top: 20px;
    color: rgba(255,255,255,0.6);
    font-size: 12px;
}

/* Chat Page */
.chat-page {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Header */
.chat-header {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.group-avatar {
    position: relative;
    cursor: pointer;
}

.group-avatar img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.online-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background: #00ff9d;
    border-radius: 50%;
    border: 2px solid var(--bg-dark);
}

.group-info {
    cursor: pointer;
}

.group-info h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 2px;
    color: var(--text);
}

.group-status {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.icon-btn {
    background: none;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 20px;
    transition: all 0.2s;
}

.icon-btn:hover {
    background: rgba(255,255,255,0.1);
    color: var(--primary);
}

/* Menu Dropdown */
.menu-dropdown {
    position: absolute;
    top: 70px;
    right: 16px;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    border: 1px solid var(--border);
    min-width: 200px;
    z-index: 200;
    overflow: hidden;
    display: none;
}

.menu-dropdown.show {
    display: block;
    animation: slideDown 0.2s ease;
}

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

.menu-item {
    padding: 14px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    color: var(--text);
}

.menu-item:hover {
    background: rgba(255,255,255,0.1);
}

.menu-item i {
    width: 20px;
    color: var(--primary);
}

.menu-divider {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

/* Messages Area */
.messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
}

.messages-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.message {
    display: flex;
    max-width: 85%;
}

.message-me {
    align-self: flex-end;
}

.message-other {
    align-self: flex-start;
}

.message-bubble {
    padding: 10px 16px;
    border-radius: 20px;
    position: relative;
}

.message-me .message-bubble {
    background: var(--message-me);
    color: white;
    border-bottom-right-radius: 4px;
}

.message-other .message-bubble {
    background: var(--message-other);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    color: var(--text);
    border-bottom-left-radius: 4px;
}

.message-sender {
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 4px;
    opacity: 0.7;
}

.message-text {
    font-size: 14px;
    line-height: 1.4;
    word-break: break-word;
}

.message-time {
    font-size: 10px;
    margin-top: 4px;
    text-align: right;
    opacity: 0.6;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.message-delete {
    background: none;
    border: none;
    color: rgba(255,255,255,0.5);
    cursor: pointer;
    font-size: 11px;
    opacity: 0;
    transition: opacity 0.2s;
}

.message:hover .message-delete {
    opacity: 1;
}

.message-delete:hover {
    color: #ff6b6b;
}

/* Voice Message */
.voice-message {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 180px;
}

.voice-play {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    color: inherit;
}

.voice-wave {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 3px;
    height: 24px;
}

.voice-wave span {
    width: 3px;
    background: currentColor;
    border-radius: 2px;
}

.voice-wave.playing span {
    animation: waveAnim 0.5s ease infinite alternate;
}

.voice-wave span:nth-child(1) { height: 8px; animation-delay: 0s; }
.voice-wave span:nth-child(2) { height: 16px; animation-delay: 0.1s; }
.voice-wave span:nth-child(3) { height: 24px; animation-delay: 0.2s; }
.voice-wave span:nth-child(4) { height: 16px; animation-delay: 0.3s; }
.voice-wave span:nth-child(5) { height: 8px; animation-delay: 0.4s; }

@keyframes waveAnim {
    from { height: 5px; }
    to { height: 20px; }
}

.voice-duration {
    font-size: 11px;
}

/* Input Area - DI ATAS, BUKAN KE BAWAH */
.input-area {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-top: 1px solid var(--border);
    position: sticky;
    bottom: 0;
}

.input-icon {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.input-icon.voice {
    background: rgba(255,255,255,0.1);
    color: var(--text-muted);
}

.input-icon.voice:hover {
    background: rgba(255,255,255,0.2);
    color: var(--primary);
}

.input-icon.send {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}

.input-icon.send:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 15px rgba(0,180,216,0.3);
}

.message-input-wrapper {
    flex: 1;
    background: rgba(0,0,0,0.3);
    border-radius: 28px;
    padding: 8px 16px;
    border: 1px solid var(--border);
}

.message-input {
    width: 100%;
    border: none;
    background: none;
    padding: 6px 0;
    font-size: 15px;
    resize: none;
    outline: none;
    font-family: inherit;
    max-height: 100px;
    color: var(--text);
}

.message-input::placeholder {
    color: var(--text-muted);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    backdrop-filter: blur(8px);
}

.modal-container {
    position: relative;
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    width: 90%;
    max-width: 380px;
    border-radius: 28px;
    overflow: hidden;
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
}

.modal-body {
    padding: 20px;
}

/* Group Profile */
.group-profile {
    text-align: center;
}

.group-avatar-large {
    position: relative;
    display: inline-block;
    margin-bottom: 20px;
}

.group-avatar-large img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
}

.change-avatar {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 32px;
    height: 32px;
    background: var(--primary);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.group-field {
    text-align: left;
    margin-bottom: 16px;
}

.group-field label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    display: block;
    margin-bottom: 4px;
}

.field-value {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0,0,0,0.3);
    padding: 12px 16px;
    border-radius: 16px;
    border: 1px solid var(--border);
}

.field-value span {
    font-size: 14px;
    color: var(--text);
}

.edit-field {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-size: 14px;
}

.field-input, .field-textarea {
    width: 100%;
    padding: 12px;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--primary);
    border-radius: 16px;
    font-size: 14px;
    outline: none;
    color: var(--text);
}

.group-info-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    font-size: 13px;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
}

.group-info-row i {
    width: 24px;
    color: var(--primary);
}

.copy-link {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    margin-left: auto;
}

/* Members List */
.members-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 400px;
    overflow-y: auto;
}

.member-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(0,0,0,0.3);
    border-radius: 20px;
    border: 1px solid var(--border);
}

.member-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
}

.member-info {
    flex: 1;
}

.member-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
}

.member-status {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.member-badges {
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-badge {
    background: var(--primary);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 600;
}

.admin-badge.super {
    background: #ffaa44;
    color: #333;
}

/* Add Admin */
.add-admin-section {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.add-admin-title {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text);
}

.add-admin-select {
    width: 100%;
    padding: 12px;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--border);
    border-radius: 16px;
    margin-bottom: 12px;
    font-size: 14px;
    color: var(--text);
}

.add-admin-select option {
    background: var(--bg-dark);
}

.add-admin-confirm {
    width: 100%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border: none;
    padding: 12px;
    border-radius: 16px;
    color: white;
    font-weight: 600;
    cursor: pointer;
}

.admin-badge-small {
    background: var(--primary);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 9px;
    margin-left: 6px;
    display: inline-block;
}

/* Share Modal */
.share-text {
    text-align: center;
    margin-bottom: 16px;
    color: var(--text-muted);
}

.share-link-box {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.share-link {
    flex: 1;
    padding: 12px;
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--border);
    border-radius: 16px;
    font-size: 12px;
    color: var(--text);
}

.copy-share {
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--border);
    padding: 0 16px;
    border-radius: 16px;
    cursor: pointer;
    color: var(--primary);
}

.share-buttons {
    display: flex;
    gap: 12px;
}

.share-wa, .share-tg {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 40px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.share-wa {
    background: #075e54;
    color: white;
}

.share-tg {
    background: #0088cc;
    color: white;
}

/* Voice Recorder */
.voice-container {
    max-width: 340px;
}

.voice-body {
    text-align: center;
}

.recorder-wave {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
    height: 80px;
    margin-bottom: 20px;
}

.recorder-wave span {
    width: 6px;
    background: var(--primary);
    border-radius: 3px;
    transition: height 0.1s ease;
}

.recorder-wave.recording span {
    animation: recorderWave 0.3s ease infinite alternate;
}

.recorder-wave.recording span:nth-child(1) { height: 20px; animation-delay: 0s; }
.recorder-wave.recording span:nth-child(2) { height: 40px; animation-delay: 0.1s; }
.recorder-wave.recording span:nth-child(3) { height: 60px; animation-delay: 0.2s; }
.recorder-wave.recording span:nth-child(4) { height: 40px; animation-delay: 0.3s; }
.recorder-wave.recording span:nth-child(5) { height: 20px; animation-delay: 0.4s; }
.recorder-wave.recording span:nth-child(6) { height: 45px; animation-delay: 0.5s; }
.recorder-wave.recording span:nth-child(7) { height: 25px; animation-delay: 0.6s; }
.recorder-wave.recording span:nth-child(8) { height: 55px; animation-delay: 0.7s; }
.recorder-wave.recording span:nth-child(9) { height: 35px; animation-delay: 0.8s; }
.recorder-wave.recording span:nth-child(10) { height: 50px; animation-delay: 0.9s; }

@keyframes recorderWave {
    from { height: 15px; }
    to { height: 60px; }
}

.recorder-time {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text);
}

.recorder-preview audio {
    width: 100%;
    margin-bottom: 20px;
}

.recorder-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.recorder-start, .recorder-stop, .recorder-send, .recorder-cancel {
    padding: 12px 24px;
    border: none;
    border-radius: 40px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.recorder-start {
    background: #ff4444;
    color: white;
}

.recorder-stop {
    background: #ffaa44;
    color: #333;
}

.recorder-send {
    background: #00ff9d;
    color: #333;
}

.recorder-cancel {
    background: rgba(255,255,255,0.2);
    color: var(--text);
}

/* Toast */
.toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.9);
    color: white;
    padding: 10px 20px;
    border-radius: 40px;
    font-size: 13px;
    z-index: 2000;
    animation: toastFade 2s ease forwards;
}

@keyframes toastFade {
    0%, 70% { opacity: 1; }
    100% { opacity: 0; visibility: hidden; }
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.05);
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}