/* WhatsApp Bridge PWA - Styles */

:root {
    --primary-color: #128C7E;
    --secondary-color: #25D366;
    --accent-color: #34B7F1;
    --text-color: #202020;
    --light-text: #fafafa;
    --light-grey: #f0f0f0;
    --medium-grey: #cccccc;
    --dark-grey: #666666;
    --background-color: #f0f0f0;
    --sent-message-bg: #DCF8C6;
    --received-message-bg: #FFFFFF;
    --card-bg: #FFFFFF;
    --error-color: #FF5252;
    --shadow-color: rgba(0, 0, 0, 0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

.app-container {
    max-width: 800px;
    margin: 0 auto;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: var(--card-bg);
    box-shadow: 0 0 10px var(--shadow-color);
}

/* Header */
header {
    background-color: var(--primary-color);
    color: var(--light-text);
    padding: 16px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-dot.online {
    background-color: var(--secondary-color);
}

.status-dot.offline {
    background-color: var(--error-color);
}

.status-dot.connecting {
    background-color: var(--accent-color);
    animation: blink 1.5s infinite;
}

@keyframes blink {
    0% { opacity: 0.4; }
    50% { opacity: 1; }
    100% { opacity: 0.4; }
}

/* Sections */
.section {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.hidden {
    display: none !important;
}

/* Login Section */
#loginSection {
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.card {
    background-color: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 2px 8px var(--shadow-color);
    padding: 24px;
    width: 100%;
    max-width: 400px;
}

.card h2 {
    margin-bottom: 16px;
    color: var(--primary-color);
}

.card p {
    margin-bottom: 20px;
}

.input-group {
    margin-bottom: 16px;
}

input[type="text"],
input[type="tel"] {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--medium-grey);
    border-radius: 4px;
    font-size: 16px;
}

input[type="text"]:focus,
input[type="tel"]:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 2px rgba(18, 140, 126, 0.2);
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: background-color 0.2s;
}

.primary-btn {
    background-color: var(--primary-color);
    color: white;
    width: 100%;
}

.primary-btn:hover {
    background-color: #0e7a6c;
}

.secondary-btn {
    background-color: var(--light-grey);
    color: var(--text-color);
}

.secondary-btn:hover {
    background-color: var(--medium-grey);
}

.icon-btn {
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    color: var(--primary-color);
    font-size: 20px;
}

.card-footer {
    margin-top: 16px;
    text-align: center;
    font-size: 14px;
    color: var(--dark-grey);
}

.error-message {
    margin-top: 16px;
    padding: 12px;
    background-color: rgba(255, 82, 82, 0.1);
    color: var(--error-color);
    border-radius: 4px;
    text-align: center;
}

/* Chat List Section */
.search-bar {
    padding: 12px;
    display: flex;
    gap: 8px;
    background-color: #f6f6f6;
    border-bottom: 1px solid var(--medium-grey);
}

.search-bar input {
    flex-grow: 1;
}

.chat-list {
    flex: 1;
    overflow-y: auto;
}

.chat-item {
    display: flex;
    padding: 12px 16px;
    border-bottom: 1px solid var(--light-grey);
    cursor: pointer;
    transition: background-color 0.2s;
}

.chat-item:hover {
    background-color: #f6f6f6;
}

.chat-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    font-size: 18px;
}

.chat-content {
    flex-grow: 1;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}

.chat-name {
    font-weight: 500;
}

.chat-time {
    font-size: 12px;
    color: var(--dark-grey);
}

.chat-preview {
    color: var(--dark-grey);
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 250px;
}

.chat-status {
    display: flex;
    align-items: center;
}

.unread-badge {
    background-color: var(--secondary-color);
    color: white;
    font-size: 12px;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: var(--dark-grey);
    text-align: center;
    height: 100%;
}

.empty-state p {
    margin-bottom: 16px;
}

/* Chat Section */
.chat-header {
    padding: 12px;
    background-color: #f6f6f6;
    border-bottom: 1px solid var(--medium-grey);
    display: flex;
    align-items: center;
}

.chat-contact {
    margin-left: 12px;
    font-weight: 500;
}

.messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background-color: #ECE5DD;
}

.message {
    max-width: 75%;
    padding: 8px 12px;
    border-radius: 8px;
    position: relative;
    word-wrap: break-word;
}

.message-sent {
    background-color: var(--sent-message-bg);
    margin-left: auto;
    border-top-right-radius: 0;
}

.message-received {
    background-color: var(--received-message-bg);
    margin-right: auto;
    border-top-left-radius: 0;
}

.message-time {
    font-size: 11px;
    color: var(--dark-grey);
    text-align: right;
    margin-top: 4px;
}

.message-status {
    display: inline-block;
    font-size: 14px;
    margin-left: 4px;
}

.message-input {
    padding: 12px;
    background-color: #f6f6f6;
    border-top: 1px solid var(--medium-grey);
}

#messageForm {
    display: flex;
    gap: 8px;
}

#messageInput {
    flex-grow: 1;
}

.send-btn {
    background-color: var(--primary-color);
    color: white;
    padding: 12px;
}

/* Modal */
.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 100;
    width: 90%;
    max-width: 500px;
    background-color: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 99;
}

.modal-header {
    padding: 16px;
    border-bottom: 1px solid var(--light-grey);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-body {
    padding: 20px 16px;
}

.modal-footer {
    padding: 16px;
    display: flex;
    justify-content: flex-end;
}

.close-btn {
    background: none;
    font-size: 24px;
    color: var(--dark-grey);
    padding: 0;
}

/* Responsive Design */
@media (max-width: 600px) {
    .app-container {
        height: 100vh;
        width: 100%;
    }
    
    .card {
        width: 100%;
        box-shadow: none;
    }
}

/* Version */
.version {
    position: fixed;
    bottom: 8px;
    right: 8px;
    font-size: 11px;
    color: var(--dark-grey);
    opacity: 0.7;
}

/* Label styles */
label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

small {
    color: var(--dark-grey);
    font-size: 12px;
    display: block;
    margin-top: 4px;
}
