/* ============================================
   🎨 BBM CLONE - FULL CSS
   ============================================ */

/* === RESET & BASE === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, 
                 "Helvetica Neue", Arial, sans-serif;
    background: #f0f2f5;
    color: #1c1e21;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

#app {
    max-width: 600px;
    margin: 0 auto;
    background: #fff;
    min-height: 100vh;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    position: relative;
    display: flex;
    flex-direction: column;
}

/* === AUTH SCREEN (Login/Register) === */
#auth-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #3b5998 0%, #1e3c72 50%, #0a1f4d 100%);
    padding: 20px;
}

.auth-box {
    background: white;
    padding: 30px;
    border-radius: 15px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 420px;
    animation: slideUp 0.4s ease-out;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.auth-box h2 {
    text-align: center;
    color: #3b5998;
    margin-bottom: 25px;
    font-size: 28px;
    font-weight: 700;
}

/* Auth Tabs (Login / Daftar) */
.auth-tabs {
    display: flex;
    margin-bottom: 25px;
    border-bottom: 2px solid #e4e6eb;
}

.auth-tabs button {
    flex: 1;
    padding: 14px;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 16px;
    color: #65676b;
    font-weight: 500;
    transition: all 0.2s;
    position: relative;
}

.auth-tabs button:hover {
    color: #3b5998;
}

.auth-tabs button.active {
    color: #3b5998;
    font-weight: 700;
}

.auth-tabs button.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 3px;
    background: #3b5998;
    border-radius: 3px 3px 0 0;
}

/* Auth Form Inputs */
.auth-form input,
.auth-form textarea {
    width: 100%;
    padding: 12px 15px;
    margin-bottom: 12px;
    border: 1px solid #dddfe2;
    border-radius: 8px;
    font-size: 15px;
    background: #f5f6f7;
    transition: all 0.2s;
    font-family: inherit;
}

.auth-form input:focus,
.auth-form textarea:focus {
    outline: none;
    border-color: #3b5998;
    background: #fff;
    box-shadow: 0 0 0 2px rgba(59, 89, 152, 0.1);
}

.auth-form button {
    width: 100%;
    padding: 13px;
    background: #3b5998;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    margin-top: 8px;
    transition: all 0.2s;
}

.auth-form button:hover {
    background: #2d4373;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 89, 152, 0.3);
}

.auth-form button:active {
    transform: translateY(0);
}

.auth-form button.btn-secondary {
    background: #e4e6eb;
    color: #050505;
    margin-top: 8px;
    font-weight: 500;
}

.auth-form button.btn-secondary:hover {
    background: #d8dadf;
    box-shadow: none;
}

.auth-form p {
    text-align: center;
    margin-bottom: 15px;
    padding: 10px;
    background: #f5f6f7;
    border-radius: 8px;
    font-size: 13px;
}

/* Error & Success Messages */
.error-msg {
    color: #d32f2f;
    margin-top: 10px;
    font-size: 13px;
    min-height: 20px;
    padding: 8px;
    border-radius: 6px;
    background: #ffebee;
    display: none;
}

.error-msg:not(:empty) {
    display: block;
}

.success-msg {
    color: #2e7d32;
    margin-top: 10px;
    font-size: 13px;
    min-height: 20px;
    white-space: pre-line;
    padding: 10px;
    border-radius: 6px;
    background: #e8f5e9;
    display: none;
}

.success-msg:not(:empty) {
    display: block;
}

/* === MAIN APP NAVIGATION TABS === */
.tabs {
    display: flex;
    background: linear-gradient(135deg, #3b5998 0%, #2d4373 100%);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.tabs button {
    flex: 1;
    padding: 14px 8px;
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.75);
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    position: relative;
}

.tabs button:hover {
    color: white;
    background: rgba(255, 255, 255, 0.08);
}

.tabs button.active {
    color: white;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.12);
}

.tabs button.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20%;
    right: 20%;
    height: 3px;
    background: #fff;
    border-radius: 3px 3px 0 0;
}

/* === USER INFO BAR === */
.user-info {
    padding: 12px 16px;
    background: linear-gradient(90deg, #f5f6f7 0%, #e4e6eb 100%);
    font-size: 13px;
    color: #65676b;
    border-bottom: 1px solid #dddfe2;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.user-info b {
    color: #3b5998;
    font-family: 'Courier New', monospace;
    letter-spacing: 1px;
}

.user-info button {
    margin-left: auto;
    padding: 6px 14px;
    background: #d32f2f;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s;
}

.user-info button:hover {
    background: #b71c1c;
}

/* === TAB CONTENT AREA === */
#tab-content {
    padding: 20px 16px;
    flex: 1;
}

#tab-content h3 {
    color: #3b5998;
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e4e6eb;
    font-size: 18px;
}

#tab-content input[type="text"],
#tab-content input[type="email"],
#tab-content textarea {
    width: 100%;
    padding: 11px 14px;
    margin-bottom: 10px;
    border: 1px solid #dddfe2;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s;
    background: #fff;
}

#tab-content input:focus,
#tab-content textarea:focus {
    outline: none;
    border-color: #3b5998;
    box-shadow: 0 0 0 2px rgba(59, 89, 152, 0.15);
}

#tab-content button {
    padding: 10px 18px;
    background: #3b5998;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    margin: 4px 4px 12px 0;
    transition: all 0.2s;
}

#tab-content button:hover {
    background: #2d4373;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(59, 89, 152, 0.25);
}

#tab-content button:active {
    transform: translateY(0);
}

/* === CHAT BOX === */
#chat-box {
    margin-top: 15px;
    margin-bottom: 15px;
    max-height: 450px;
    overflow-y: auto;
    padding: 10px;
    background: #ece5dd;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'%3E%3Ccircle cx='2' cy='2' r='1' fill='%23d4cab3' opacity='0.3'/%3E%3C/svg%3E");
    border-radius: 10px;
    border: 1px solid #dddfe2;
}

.msg {
    padding: 8px 12px;
    margin: 6px 0;
    border-radius: 12px;
    max-width: 75%;
    position: relative;
    word-wrap: break-word;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.msg:not(.mine) {
    background: white;
    margin-right: auto;
    border-top-left-radius: 4px;
}

.msg.mine {
    background: #dcf8c6;
    margin-left: auto;
    border-top-right-radius: 4px;
}

.msg div {
    font-size: 14px;
    color: #1c1e21;
}

.msg small {
    display: block;
    font-size: 11px;
    color: #65676b;
    margin-top: 4px;
    text-align: right;
    user-select: none;
}

.msg.mine small {
    color: #4a7c59;
}

.msg b {
    margin-right: 6px;
    font-weight: 700;
}

/* Status Indicators D / R */
.msg b {
    color: #3b5998;
    font-family: 'Courier New', monospace;
    padding: 2px 6px;
    background: rgba(59, 89, 152, 0.1);
    border-radius: 4px;
    font-size: 10px;
}

/* Action buttons (Retract / Recall) */
.msg small button {
    padding: 3px 8px;
    font-size: 11px;
    margin: 2px 2px 0 4px;
    background: rgba(59, 89, 152, 0.15);
    color: #3b5998;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.msg small button:hover {
    background: #3b5998;
    color: white;
    transform: none;
    box-shadow: none;
}

/* Chat Input Area */
#chat-input-area {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px;
    background: #f5f6f7;
    border-radius: 10px;
    margin-top: 10px;
}

#chat-input-area textarea {
    flex: 1;
    min-width: 100%;
    min-height: 60px;
    resize: vertical;
    margin-bottom: 0;
}

#chat-input-area button {
    padding: 10px 16px;
    font-size: 13px;
    margin: 0;
}

/* === GROUPS / CHANNELS / LOG - Item Cards === */
.item {
    padding: 14px 16px;
    background: white;
    margin: 8px 0;
    border-radius: 10px;
    border: 1px solid #e4e6eb;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    transition: all 0.2s;
}

.item:hover {
    border-color: #3b5998;
    box-shadow: 0 2px 8px rgba(59, 89, 152, 0.1);
    transform: translateY(-1px);
}

.item b {
    color: #1c1e21;
    font-size: 15px;
}

.item button {
    margin-left: auto;
    padding: 6px 12px;
    font-size: 12px;
}

/* === STATUS PAGE === */
#status-input {
    min-height: 100px;
    resize: vertical;
    background: #fff;
    border: 1px solid #dddfe2;
    border-radius: 10px;
    padding: 12px 15px;
    font-size: 14px;
    font-family: inherit;
    width: 100%;
    margin-bottom: 10px;
}

#status-input:focus {
    outline: none;
    border-color: #3b5998;
    box-shadow: 0 0 0 2px rgba(59, 89, 152, 0.15);
}

/* === RESPONSIVE DESIGN === */
@media (max-width: 600px) {
    #app {
        max-width: 100%;
        box-shadow: none;
    }
    
    .auth-box {
        padding: 24px 20px;
        border-radius: 0;
        min-height: 100vh;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }
    
    .tabs button {
        padding: 12px 4px;
        font-size: 11px;
    }
    
    .user-info {
        font-size: 12px;
        padding: 10px 12px;
    }
    
    .msg {
        max-width: 85%;
    }
    
    #chat-input-area {
        padding: 10px;
    }
    
    #chat-input-area button {
        flex: 1;
        padding: 10px 8px;
        font-size: 12px;
    }
}

/* === SCROLLBAR CUSTOM === */
#chat-box::-webkit-scrollbar,
body::-webkit-scrollbar {
    width: 6px;
}

#chat-box::-webkit-scrollbar-track,
body::-webkit-scrollbar-track {
    background: transparent;
}

#chat-box::-webkit-scrollbar-thumb,
body::-webkit-scrollbar-thumb {
    background: rgba(59, 89, 152, 0.3);
    border-radius: 3px;
}

#chat-box::-webkit-scrollbar-thumb:hover,
body::-webkit-scrollbar-thumb:hover {
    background: rgba(59, 89, 152, 0.5);
}

/* === LOADING STATE === */
button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* === UTILITY CLASSES === */
.text-center { text-align: center; }
.text-muted { color: #65676b; }
.text-danger { color: #d32f2f; }
.text-success { color: #2e7d32; }
.mt-10 { margin-top: 10px; }
.mb-10 { margin-bottom: 10px; }
.hidden { display: none !important; }

/* === SELECTION === */
::selection {
    background: #3b5998;
    color: white;
}

/* === FOCUS VISIBLE === */
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
    outline: 2px solid #3b5998;
    outline-offset: 2px;
}

/* === PLACEHOLDER === */
::placeholder {
    color: #8d949e;
    opacity: 1;
}