/* ===== RESET & DASAR ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background: #0b141a;
    height: 100vh;
    overflow: hidden;
}

/* ===== AUTH PAGES (LOGIN & REGISTER) ===== */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0b141a 0%, #1a2a33 100%);
    position: relative;
    overflow-y: auto;
    padding: 20px;
}

.auth-page::before {
    content: '';
    position: fixed;
    width: 150%;
    height: 150%;
    background: radial-gradient(circle, rgba(0, 168, 132, 0.08) 0%, rgba(0, 0, 0, 0) 70%);
    top: -25%;
    left: -25%;
    animation: rotate 40s linear infinite;
    pointer-events: none;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.auth-wrapper {
    width: 100%;
    max-width: 440px;
    position: relative;
    z-index: 2;
    margin: auto;
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-header .logo {
    width: 80px;
    height: 80px;
    background: #00a884;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    box-shadow: 0 10px 30px rgba(0, 168, 132, 0.4);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); box-shadow: 0 10px 30px rgba(0, 168, 132, 0.4); }
    50% { transform: scale(1.05); box-shadow: 0 20px 40px rgba(0, 168, 132, 0.6); }
    100% { transform: scale(1); box-shadow: 0 10px 30px rgba(0, 168, 132, 0.4); }
}

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

.auth-header h1 {
    color: white;
    font-size: 32px;
    font-weight: 500;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.auth-header p {
    color: #8696a0;
    font-size: 15px;
    font-weight: 300;
}

.auth-card {
    background: #1f2c34;
    border-radius: 30px;
    padding: 40px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.05);
    animation: slideUpFade 0.6s ease;
}

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

.auth-card h2 {
    color: #e9edef;
    font-size: 26px;
    font-weight: 400;
    margin-bottom: 35px;
    text-align: center;
    letter-spacing: -0.3px;
}

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

.input-group label {
    display: block;
    color: #aebac1;
    font-size: 14px;
    margin-bottom: 8px;
    margin-left: 5px;
    font-weight: 400;
}

.input-group label i {
    color: #00a884;
    margin-right: 6px;
    width: 18px;
}

.input-group input {
    width: 100%;
    padding: 16px 20px;
    background: #2a3942;
    border: 2px solid transparent;
    border-radius: 16px;
    outline: none;
    color: #e9edef;
    font-size: 15px;
    transition: all 0.3s ease;
}

.input-group input:focus {
    border-color: #00a884;
    background: #1f2c34;
    box-shadow: 0 0 0 5px rgba(0, 168, 132, 0.15);
}

.input-group input::placeholder {
    color: #5f6f7a;
    font-weight: 300;
}

/* Upload foto profil */
.profile-upload-container {
    display: flex;
    align-items: center;
    gap: 20px;
    background: #2a3942;
    padding: 15px;
    border-radius: 16px;
    border: 2px dashed #3b4a54;
    transition: all 0.3s;
}

.profile-upload-container:hover {
    border-color: #00a884;
    background: #2a3a44;
}

.profile-preview {
    width: 70px;
    height: 70px;
    background: #3b4a54;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #8696a0;
    border: 3px solid #00a884;
    overflow: hidden;
}

.profile-preview i {
    font-size: 28px;
}

.profile-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.upload-btn {
    background: #00a884;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    flex: 1;
}

.upload-btn:hover {
    background: #008f72;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 168, 132, 0.4);
}

.upload-btn i {
    margin-right: 8px;
}

.auth-btn {
    width: 100%;
    padding: 16px;
    background: #00a884;
    color: white;
    border: none;
    border-radius: 16px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 15px;
    margin-bottom: 25px;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
    letter-spacing: 0.5px;
}

.auth-btn:hover {
    background: #008f72;
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0, 168, 132, 0.4);
}

.auth-btn:active {
    transform: translateY(0);
}

.auth-btn i {
    margin-right: 8px;
}

.auth-btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.auth-btn:active::after {
    width: 300px;
    height: 300px;
}

.auth-footer {
    text-align: center;
    color: #8696a0;
    font-size: 15px;
    padding-top: 10px;
    border-top: 1px solid #2a3942;
}

.auth-footer a {
    color: #00a884;
    text-decoration: none;
    font-weight: 600;
    margin-left: 5px;
    transition: color 0.3s;
}

.auth-footer a:hover {
    color: #00c4a0;
    text-decoration: underline;
}

.error-message-premium {
    background: rgba(220, 53, 69, 0.12);
    border: 1px solid #dc3545;
    color: #ff9aa2;
    padding: 14px 16px;
    border-radius: 14px;
    margin-bottom: 25px;
    font-size: 14px;
    text-align: center;
    animation: shake 0.5s ease;
    backdrop-filter: blur(5px);
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* ===== CHAT CONTAINER ===== */
.chat-container {
    display: flex;
    height: 100vh;
    background: #0b141a;
    position: relative;
}

/* ===== SIDEBAR PREMIUM ===== */
.sidebar {
    width: 380px;
    background: #111b21;
    border-right: 1px solid #2a3942;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    position: relative;
    z-index: 10;
}

.sidebar.collapsed {
    margin-left: -380px;
}

/* Tombol Toggle Sidebar */
.toggle-sidebar {
    position: absolute;
    left: 380px;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 60px;
    background: #1f2c34;
    border: 1px solid #2a3942;
    border-left: none;
    border-radius: 0 10px 10px 0;
    color: #8696a0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.3s;
    z-index: 5;
}

.toggle-sidebar:hover {
    background: #2a3942;
    color: #e9edef;
}

.toggle-sidebar.collapsed {
    left: 0;
}

/* User Profile */
.user-profile {
    padding: 20px 16px;
    background: #1f2c34;
    display: flex;
    align-items: center;
    gap: 15px;
    height: 80px;
}

.user-profile .avatar {
    width: 50px;
    height: 50px;
    background: #0b8a49;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s;
    overflow: hidden;
}

.user-profile .avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-profile .avatar:hover {
    transform: scale(1.05);
}

.user-info {
    flex: 1;
}

.user-info h3 {
    color: #e9edef;
    font-size: 17px;
    font-weight: 500;
    margin-bottom: 4px;
}

.user-info .status {
    color: #8696a0;
    font-size: 13px;
}

.user-info .status i {
    margin-right: 4px;
}

.logout-btn {
    background: transparent;
    color: #8696a0;
    border: 1px solid #2a3942;
    padding: 8px 15px;
    border-radius: 30px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.3s;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logout-btn:hover {
    background: #dc3545;
    color: white;
    border-color: #dc3545;
}

/* Search Bar */
.search-container {
    padding: 12px 16px;
    background: #111b21;
}

.search-box {
    background: #1f2c34;
    border-radius: 30px;
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.search-box i {
    color: #8696a0;
    font-size: 16px;
}

.search-box input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #e9edef;
    font-size: 14px;
}

.search-box input::placeholder {
    color: #5f6f7a;
}

.contact-count {
    color: #8696a0;
    font-size: 12px;
    background: #2a3942;
    padding: 3px 8px;
    border-radius: 30px;
}

/* Users/Contacts List */
.users-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 8px;
}

.users-list::-webkit-scrollbar {
    width: 6px;
}

.users-list::-webkit-scrollbar-track {
    background: #111b21;
}

.users-list::-webkit-scrollbar-thumb {
    background: #2a3942;
    border-radius: 10px;
}

.users-list h4 {
    padding: 16px 12px 8px;
    color: #00a884;
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.users-list h4 i {
    margin-right: 8px;
}

.user-item {
    display: flex;
    align-items: center;
    padding: 12px;
    margin: 2px 0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.user-item:hover {
    background: #1f2c34;
}

.user-item.active {
    background: #2a3942;
}

.user-item .avatar-small {
    width: 50px;
    height: 50px;
    background: #0b8a49;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 18px;
    margin-right: 12px;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.user-item .avatar-small img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.online-indicator {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background: #00a884;
    border: 2px solid #1f2c34;
    border-radius: 50%;
    z-index: 2;
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-details .name {
    color: #e9edef;
    font-weight: 400;
    font-size: 16px;
    margin-bottom: 4px;
}

.user-details .last-message {
    color: #8696a0;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===== CHAT AREA PREMIUM ===== */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #0b141a;
    position: relative;
}

.chat-header {
    padding: 10px 20px;
    background: #1f2c34;
    display: flex;
    align-items: center;
    gap: 15px;
    height: 70px;
    border-left: 1px solid #2a3942;
}

.chat-header .avatar {
    width: 45px;
    height: 45px;
    background: #0b8a49;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    font-weight: bold;
    overflow: hidden;
    flex-shrink: 0;
}

.chat-header .avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.chat-header-info {
    flex: 1;
}

.chat-header-info h2 {
    color: #e9edef;
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 4px;
}

.chat-header-info p {
    color: #8696a0;
    font-size: 13px;
}

.chat-header-info p i {
    margin-right: 4px;
}

/* Messages Container */
.messages-container {
    flex: 1;
    padding: 20px 30px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #0b141a;
    background-image: radial-gradient(circle at 10px 10px, #1a2a33 1px, transparent 1px);
    background-size: 30px 30px;
}

.messages-container::-webkit-scrollbar {
    width: 6px;
}

.messages-container::-webkit-scrollbar-track {
    background: #0b141a;
}

.messages-container::-webkit-scrollbar-thumb {
    background: #2a3942;
    border-radius: 10px;
}

.message {
    max-width: 65%;
    margin-bottom: 2px;
    display: flex;
    animation: fadeIn 0.3s ease;
}

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

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

.message-bubble {
    padding: 8px 12px;
    border-radius: 12px;
    position: relative;
    word-wrap: break-word;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.message.own .message-bubble {
    background: #005c4b;
    color: #e9edef;
    border-top-right-radius: 4px;
}

.message.other .message-bubble {
    background: #1f2c34;
    color: #e9edef;
    border-top-left-radius: 4px;
}

.message-image {
    max-width: 250px;
    max-height: 300px;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 4px;
    transition: transform 0.2s;
}

.message-image:hover {
    transform: scale(1.02);
}

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

.message-time {
    font-size: 11px;
    margin-top: 4px;
    opacity: 0.7;
    text-align: right;
}

/* Highlight untuk pencarian */
.highlight {
    background: #005c4b;
    color: #e9edef;
    padding: 2px 4px;
    border-radius: 4px;
    font-weight: 600;
}

/* Input Area Premium */
.message-input-container {
    padding: 15px 20px;
    background: #1f2c34;
    display: flex;
    gap: 10px;
    align-items: center;
    border-left: 1px solid #2a3942;
}

.message-input-container input[type="text"] {
    flex: 1;
    padding: 12px 20px;
    background: #2a3942;
    border: none;
    border-radius: 30px;
    outline: none;
    color: #e9edef;
    font-size: 15px;
}

.message-input-container input[type="text"]::placeholder {
    color: #5f6f7a;
}

.attach-btn, .send-btn {
    width: 45px;
    height: 45px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.attach-btn {
    background: #2a3942;
    color: #8696a0;
}

.attach-btn:hover {
    background: #3a4a54;
    color: #e9edef;
}

.send-btn {
    background: #00a884;
    color: white;
}

.send-btn:hover {
    background: #008f72;
    transform: scale(1.05);
}

.send-btn:disabled {
    background: #2a3942;
    color: #5f6f7a;
    cursor: not-allowed;
    transform: none;
}

/* No Chat Selected */
.no-chat-selected {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #8696a0;
    text-align: center;
    padding: 20px;
}

.no-chat-selected i {
    font-size: 64px;
    margin-bottom: 20px;
    color: #2a3942;
}

.no-chat-selected h2 {
    color: #e9edef;
    margin-bottom: 10px;
    font-weight: 400;
    font-size: 24px;
}

.no-chat-selected p {
    color: #8696a0;
    font-size: 15px;
    margin-bottom: 5px;
}

/* New Message Animation */
.new-message {
    animation: pulse 0.3s ease;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

/* ===== RESPONSIVE MOBILE ===== */
@media (max-width: 768px) {
    .auth-card {
        padding: 30px 25px;
    }
    
    .auth-header .logo {
        width: 70px;
        height: 70px;
    }
    
    .auth-header .logo i {
        font-size: 34px;
    }
    
    .auth-header h1 {
        font-size: 28px;
    }
    
    .sidebar {
        width: 100%;
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        z-index: 20;
    }
    
    .sidebar.collapsed {
        margin-left: -100%;
    }
    
    .toggle-sidebar {
        left: auto;
        right: 10px;
        top: 10px;
        transform: none;
        border-radius: 10px;
        border: 1px solid #2a3942;
        z-index: 30;
    }
    
    .toggle-sidebar.collapsed {
        left: auto;
        right: 10px;
    }
    
    .chat-area {
        width: 100%;
    }
    
    .message {
        max-width: 85%;
    }
    
    .profile-upload-container {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .auth-card {
        padding: 25px 20px;
    }
    
    .auth-header .logo {
        width: 60px;
        height: 60px;
    }
    
    .auth-header .logo i {
        font-size: 28px;
    }
    
    .auth-header h1 {
        font-size: 24px;
    }
    
    .auth-card h2 {
        font-size: 22px;
        margin-bottom: 25px;
    }
    
    .input-group input {
        padding: 14px 16px;
    }
    
    .user-profile {
        padding: 15px;
    }
    
    .messages-container {
        padding: 15px;
    }
    
    .message {
        max-width: 90%;
    }
}
/* Last message time di kontak */
.message-time-small {
    color: #8696a0;
    font-size: 11px;
    margin-left: 8px;
    white-space: nowrap;
}
/* Perbaikan warna timestamp di kontak */
.message-time-small {
    color: #00a884 !important; /* Warna hijau biar jelas */
    font-size: 11px;
    font-weight: 500;
    margin-left: 8px;
    white-space: nowrap;
    min-width: 45px;
    text-align: right;
}

/* Warna last message */
.last-message {
    color: #8696a0;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}