/* WhatsApp Chat PHP - Estilo Principal */

:root {
    /* Cores principais - tema escuro com verde */
    --primary-bg: #0d1117;
    --secondary-bg: #161b22;
    --tertiary-bg: #21262d;
    --accent-green: #00d26a;
    --accent-green-dark: #00b359;
    --accent-green-light: #25d366;
    --text-primary: #f0f6fc;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;
    --border-color: #30363d;
    --hover-bg: #262c36;
    --glass-bg: rgba(33, 38, 45, 0.8);
    --glass-border: rgba(255, 255, 255, 0.1);
    --shadow-color: rgba(0, 0, 0, 0.3);
    --online-color: #00d26a;
    --offline-color: #6e7681;
    --unread-bg: #00d26a;
    --message-sent: #005c4b;
    --message-received: #262d31;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0d1117 0%, #161b22 50%, #21262d 100%);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
}

/* Efeito de vidro (glassmorphism) */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    box-shadow: 0 8px 32px var(--shadow-color);
}

.glass-light {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
}

/* Container principal */
.main-container {
    display: flex;
    height: 100vh;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    gap: 20px;
}

/* Sidebar - Lista de conversas */
.sidebar {
    width: 350px;
    min-width: 300px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent-green);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    position: relative;
}

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

.online-indicator {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background: var(--online-color);
    border: 2px solid var(--primary-bg);
    border-radius: 50%;
}

.user-name {
    font-size: 16px;
    font-weight: 600;
}

.header-actions {
    display: flex;
    gap: 10px;
}

.btn-icon {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.btn-icon:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
}

/* Barra de pesquisa */
.search-container {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
}

.search-box {
    position: relative;
}

.search-input {
    width: 100%;
    padding: 12px 40px 12px 16px;
    background: var(--tertiary-bg);
    border: 1px solid var(--border-color);
    border-radius: 25px;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: all 0.3s ease;
}

.search-input:focus {
    border-color: var(--accent-green);
    box-shadow: 0 0 0 2px rgba(0, 210, 106, 0.2);
}

.search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

/* Lista de conversas */
.conversations-list {
    flex: 1;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

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

.conversations-list::-webkit-scrollbar-track {
    background: transparent;
}

.conversations-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.conversation-item {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
}

.conversation-item:hover {
    background: var(--hover-bg);
}

.conversation-item.active {
    background: var(--accent-green);
    color: white;
}

.conversation-info {
    flex: 1;
    min-width: 0;
}

.conversation-name {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-preview {
    font-size: 14px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.conversation-time {
    font-size: 12px;
    color: var(--text-muted);
}

.unread-badge {
    background: var(--unread-bg);
    color: white;
    font-size: 12px;
    font-weight: bold;
    padding: 2px 8px;
    border-radius: 12px;
    min-width: 20px;
    text-align: center;
}

/* Área principal do chat */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

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

.chat-contact-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.contact-details {
    display: flex;
    flex-direction: column;
}

.contact-name {
    font-size: 18px;
    font-weight: 600;
}

.contact-status {
    font-size: 14px;
    color: var(--text-secondary);
}

.contact-status.online {
    color: var(--online-color);
}

/* Área de mensagens */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

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

.messages-container::-webkit-scrollbar-track {
    background: transparent;
}

.messages-container::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.message {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 18px;
    position: relative;
    word-wrap: break-word;
    animation: messageSlide 0.3s ease-out;
}

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

.message.sent {
    align-self: flex-end;
    background: var(--message-sent);
    color: white;
    border-bottom-right-radius: 4px;
}

.message.received {
    align-self: flex-start;
    background: var(--message-received);
    border-bottom-left-radius: 4px;
}

.message-content {
    margin-bottom: 4px;
    line-height: 1.4;
}

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

.message.received .message-time {
    text-align: left;
}

/* Campo de entrada de mensagem */
.message-input-container {
    padding: 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 12px;
}

.message-input {
    flex: 1;
    padding: 12px 16px;
    background: var(--tertiary-bg);
    border: 1px solid var(--border-color);
    border-radius: 25px;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    resize: none;
    max-height: 120px;
    transition: all 0.3s ease;
}

.message-input:focus {
    border-color: var(--accent-green);
    box-shadow: 0 0 0 2px rgba(0, 210, 106, 0.2);
}

.send-button {
    width: 48px;
    height: 48px;
    background: var(--accent-green);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.send-button:hover {
    background: var(--accent-green-dark);
    transform: scale(1.05);
}

.send-button:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
    transform: none;
}

/* Tela de boas-vindas */
.welcome-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px;
}

.welcome-icon {
    width: 120px;
    height: 120px;
    background: var(--accent-green);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    font-size: 48px;
    color: white;
}

.welcome-title {
    font-size: 32px;
    font-weight: 600;
    margin-bottom: 12px;
}

.welcome-subtitle {
    font-size: 16px;
    color: var(--text-secondary);
    max-width: 400px;
    line-height: 1.5;
}

/* Modal de login */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal {
    width: 100%;
    max-width: 400px;
    margin: 20px;
    padding: 32px;
    border-radius: 16px;
}

.modal-title {
    font-size: 24px;
    font-weight: 600;
    text-align: center;
    margin-bottom: 24px;
}

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

.form-label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    background: var(--tertiary-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: all 0.3s ease;
}

.form-input:focus {
    border-color: var(--accent-green);
    box-shadow: 0 0 0 2px rgba(0, 210, 106, 0.2);
}

.btn-primary {
    width: 100%;
    padding: 12px;
    background: var(--accent-green);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: var(--accent-green-dark);
}

.btn-secondary {
    width: 100%;
    padding: 12px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 12px;
}

.btn-secondary:hover {
    background: var(--hover-bg);
}

/* Notificações */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 16px 20px;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    z-index: 1001;
    animation: slideIn 0.3s ease-out;
    max-width: 300px;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.notification.success {
    background: var(--accent-green);
}

.notification.error {
    background: #dc3545;
}

.notification.info {
    background: #17a2b8;
}

/* Responsividade */
@media (max-width: 768px) {
    .main-container {
        padding: 0;
        gap: 0;
    }
    
    .sidebar {
        width: 100%;
        position: absolute;
        left: 0;
        top: 0;
        z-index: 100;
        background: var(--primary-bg);
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .chat-area {
        width: 100%;
    }
    
    .message {
        max-width: 85%;
    }
}

/* Estados de carregamento */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-color);
    border-top: 2px solid var(--accent-green);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Indicador de digitação */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--message-received);
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    max-width: 70%;
    align-self: flex-start;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--text-secondary);
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingBounce {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

