/* 
  WhatsApp Standalone Integration Dashboard CSS
  Aesthetic: Premium Slate Dark Mode with Emerald Accents and Glassmorphism
*/

:root {
    --bg-main: #0c1317;
    --bg-chat: #0b141a;
    --sidebar-bg: #111b21;
    --sidebar-section-bg: #182229;
    --accent-color: #00a884;
    --accent-hover: #008f72;
    --text-primary: #e9edef;
    --text-secondary: #8696a0;
    --text-muted: #667781;
    --border-color: #222e35;
    --msg-sent: #005c4b;
    --msg-received: #202c33;
    --shadow-main: 0 4px 24px rgba(0, 0, 0, 0.4);
    --border-radius-lg: 16px;
    --border-radius-md: 10px;
    --border-radius-sm: 6px;
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Plus Jakarta Sans', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-body);
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.app-container {
    display: flex;
    width: 96vw;
    height: 94vh;
    background: rgba(17, 27, 33, 0.7);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-main);
    backdrop-filter: blur(16px);
}

/* Sidebar Styling */
.sidebar {
    width: 320px;
    background-color: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border-color);
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 28px;
    color: var(--accent-color);
    background: rgba(0, 168, 132, 0.15);
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.logo-text h1 {
    font-family: var(--font-heading);
    font-size: 18px;
    font-weight: 600;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    color: var(--accent-color);
    margin-top: 2px;
}

.status-badge.online .pulse {
    display: inline-block;
    width: 6px;
    height: 6px;
    background-color: var(--accent-color);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--accent-color);
    animation: blink 2s infinite ease-in-out;
}

@keyframes blink {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

.sidebar-section {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.section-title {
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-desc {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 12px;
}

.config-card {
    background-color: var(--sidebar-section-bg);
    border-radius: var(--border-radius-md);
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.config-item label {
    display: block;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.config-value code {
    font-family: 'Courier New', Courier, monospace;
    font-size: 12px;
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.2);
    padding: 3px 6px;
    border-radius: var(--border-radius-sm);
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Recipient Selector Input */
.recipient-form .input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.recipient-form .input-icon {
    position: absolute;
    left: 12px;
    color: var(--text-muted);
    font-size: 14px;
}

.recipient-form input {
    width: 100%;
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-md);
    padding: 12px 12px 12px 36px;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: all 0.3s ease;
}

.recipient-form input:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(0, 168, 132, 0.2);
}

/* Instructions */
.instructions .info-bubble {
    background-color: rgba(255, 255, 255, 0.02);
    border-radius: var(--border-radius-md);
    padding: 12px;
    font-size: 11px;
    color: var(--text-secondary);
}

.instructions ol {
    margin-left: 16px;
    margin-top: 6px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.instructions pre {
    background: #000;
    padding: 6px;
    border-radius: var(--border-radius-sm);
    margin-top: 4px;
    overflow-x: auto;
}

.instructions code {
    color: #e2e8f0;
}

.sidebar-footer {
    margin-top: auto;
    padding: 16px;
    text-align: center;
    border-top: 1px solid var(--border-color);
}

.sidebar-footer p {
    font-size: 10px;
    color: var(--text-muted);
}

/* Chat View Panel */
.chat-area {
    flex: 1;
    background-color: var(--bg-chat);
    display: flex;
    flex-direction: column;
    height: 100%;
    position: relative;
}

/* Chat Header */
.chat-header {
    background-color: var(--sidebar-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-user-info {
    display: flex;
    align-items: center;
    gap: 14px;
}

.avatar-placeholder {
    font-size: 40px;
    color: var(--text-muted);
    line-height: 1;
}

.chat-user-info h2 {
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 600;
}

.active-status {
    font-size: 11px;
    color: var(--text-secondary);
}

.header-actions {
    display: flex;
    gap: 16px;
}

.header-actions button {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 18px;
    cursor: pointer;
    transition: color 0.2s ease;
}

.header-actions button:hover {
    color: var(--text-primary);
}

/* Chat feed container */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* Welcome Screen overlay when chat inactive */
.welcome-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    margin: auto;
    max-width: 420px;
    padding: 20px;
}

.welcome-illustration {
    font-size: 72px;
    color: var(--text-muted);
    margin-bottom: 16px;
    opacity: 0.6;
    animation: float 4s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.welcome-screen h2 {
    font-family: var(--font-heading);
    font-size: 22px;
    margin-bottom: 10px;
}

.welcome-screen p {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Chat bubble aesthetics */
.message-bubble {
    max-width: 65%;
    padding: 10px 14px;
    border-radius: var(--border-radius-md);
    position: relative;
    word-break: break-word;
    font-size: 14px;
    line-height: 1.5;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
}

.message-bubble.sent {
    background-color: var(--msg-sent);
    color: var(--text-primary);
    align-self: flex-end;
    border-top-right-radius: 2px;
}

.message-bubble.received {
    background-color: var(--msg-received);
    color: var(--text-primary);
    align-self: flex-start;
    border-top-left-radius: 2px;
}

/* Meta Data inside Bubble */
.bubble-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    margin-top: 4px;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.5);
    text-align: right;
}

.status-icon {
    font-size: 11px;
}

.status-icon.sent { color: rgba(255, 255, 255, 0.4); }
.status-icon.delivered { color: rgba(255, 255, 255, 0.6); }
.status-icon.read { color: #53bdeb; }

/* Image handling */
.chat-image {
    max-width: 100%;
    border-radius: var(--border-radius-sm);
    margin-bottom: 4px;
    display: block;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Input area */
.chat-input-area {
    background-color: var(--sidebar-bg);
    padding: 12px 24px;
    border-top: 1px solid var(--border-color);
}

.input-form {
    display: flex;
    align-items: center;
    gap: 12px;
}

.attachment-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    transition: color 0.2s ease;
}

.attachment-btn:hover {
    color: var(--text-primary);
}

.input-form input {
    flex: 1;
    background-color: var(--sidebar-section-bg);
    border: 1px solid transparent;
    border-radius: var(--border-radius-md);
    padding: 12px 16px;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: all 0.2s ease;
}

.input-form input:focus {
    border-color: var(--border-color);
}

.input-form input:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.send-btn {
    background-color: var(--accent-color);
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
}

.send-btn:hover:not(:disabled) {
    background-color: var(--accent-hover);
    transform: scale(1.05);
}

.send-btn:disabled {
    background-color: var(--sidebar-section-bg);
    color: var(--text-muted);
    cursor: not-allowed;
}

/* Scrollbar customizations */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}
