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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    background: white;
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo i {
    font-size: 2.5rem;
    color: #25D366;
}

.logo h1 {
    color: #333;
    font-size: 1.8rem;
    font-weight: 600;
}

.status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    border-radius: 25px;
    background: #f8f9fa;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #dc3545;
    animation: pulse 2s infinite;
}

.status-dot.connected {
    background: #28a745;
    animation: none;
}

.status-text {
    font-weight: 500;
    color: #666;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* QR Section */
.qr-section {
    background: white;
    border-radius: 15px;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    text-align: center;
    margin-bottom: 20px;
}

.qr-container h3 {
    color: #333;
    font-size: 1.5rem;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.qr-container h3 i {
    color: #25D366;
}

.qr-container > p {
    color: #666;
    margin-bottom: 30px;
}

.qr-code {
    max-width: 300px;
    margin: 0 auto 30px;
    padding: 20px;
    border: 2px dashed #ddd;
    border-radius: 15px;
    background: #f8f9fa;
}

.qr-code img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
}

.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    color: #666;
}

.loading i {
    font-size: 2rem;
    color: #25D366;
}

.qr-instructions {
    text-align: left;
    max-width: 400px;
    margin: 0 auto;
}

.qr-instructions p {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
    color: #666;
    font-size: 0.9rem;
}

.qr-instructions i {
    color: #25D366;
    width: 20px;
}

/* Chat Section */
.chat-section {
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    overflow: hidden;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.send-form {
    padding: 20px;
    border-bottom: 1px solid #eee;
    background: #f8f9fa;
}

.input-group {
    display: flex;
    gap: 15px;
    align-items: flex-end;
}

.phone-input {
    flex: 0 0 200px;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 10px;
    font-size: 0.9rem;
    transition: border-color 0.3s;
}

.phone-input:focus {
    outline: none;
    border-color: #25D366;
}

.message-input {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 10px;
    resize: none;
    min-height: 50px;
    max-height: 100px;
    font-family: inherit;
    transition: border-color 0.3s;
}

.message-input:focus {
    outline: none;
    border-color: #25D366;
}

.send-button {
    background: #25D366;
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background 0.3s;
}

.send-button:hover {
    background: #128C7E;
}

.send-button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Messages */
.messages-container {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.messages-header {
    padding: 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.messages-header h3 {
    color: #333;
    display: flex;
    align-items: center;
    gap: 10px;
}

.messages-header h3 i {
    color: #25D366;
}

.message-count {
    background: #25D366;
    color: white;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 600;
}

.messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    max-height: 500px;
}

.welcome-message {
    text-align: center;
    color: #666;
    padding: 40px 20px;
}

.welcome-message i {
    font-size: 3rem;
    color: #25D366;
    margin-bottom: 20px;
}

.welcome-message p {
    margin-bottom: 10px;
}

/* Message Bubbles */
.message {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
}

.message.received {
    align-items: flex-start;
}

.message.sent {
    align-items: flex-end;
}

.message-content {
    max-width: 70%;
    padding: 12px 16px;
    border-radius: 18px;
    position: relative;
    word-wrap: break-word;
}

.message.received .message-content {
    background: #f0f0f0;
    color: #333;
}

.message.sent .message-content {
    background: #25D366;
    color: white;
}

.message-info {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
    font-size: 0.8rem;
}

.message.received .message-info {
    color: #666;
}

.message.sent .message-info {
    color: #25D366;
    justify-content: flex-end;
}

.message-time {
    font-size: 0.7rem;
    opacity: 0.7;
}

/* Footer */
.footer {
    text-align: center;
    padding: 20px;
    color: white;
    margin-top: 20px;
}

/* Toast */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 25px;
    border-radius: 10px;
    color: white;
    font-weight: 600;
    transform: translateX(400px);
    transition: transform 0.3s;
    z-index: 1000;
}

.toast.show {
    transform: translateX(0);
}

.toast.success {
    background: #28a745;
}

.toast.error {
    background: #dc3545;
}

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

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .logo h1 {
        font-size: 1.5rem;
    }
    
    .qr-section {
        padding: 20px;
    }
    
    .input-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .phone-input {
        flex: none;
    }
    
    .message-content {
        max-width: 85%;
    }
    
    .messages {
        max-height: 400px;
    }
}

@media (max-width: 480px) {
    .qr-code {
        max-width: 250px;
    }
    
    .message-content {
        max-width: 90%;
    }
}
