/* Messenger Chat Interface Styles */

/* Override main padding for full-height messenger */
main {
    padding-top: 80px !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    padding-bottom: 0 !important;
}

.messenger-container {
    height: calc(100vh - 80px); /* Account for navbar height */
    display: flex;
    background: var(--wa-background);
    overflow: hidden;
}

/* Sidebar Styles */
.messenger-sidebar {
    width: 350px;
    background: var(--wa-surface);
    border-right: 1px solid var(--wa-border);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.phone-header {
    background: var(--wa-primary);
    color: white;
    padding: 20px 16px;
    position: relative;
}

.wa-phone-select {
    position: relative;
}

.selected-phone {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: var(--wa-radius);
    transition: background-color 0.2s;
}

.selected-phone:hover {
    background: rgba(255, 255, 255, 0.1);
}

.phone-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--wa-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
    margin-right: 12px;
    color: white;
    text-transform: uppercase;
}

.phone-info {
    flex: 1;
}

.phone-name {
    font-weight: 500;
    font-size: 16px;
}

.phone-number {
    font-size: 13px;
    opacity: 0.8;
}

.dropdown-icon {
    margin-left: 8px;
    transition: transform 0.2s;
}

.phone-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--wa-surface);
    border-radius: var(--wa-radius);
    box-shadow: var(--wa-shadow);
    z-index: 1000;
    display: none;
    max-height: 300px;
    overflow-y: auto;
    margin-top: 8px;
}

.phone-dropdown.show {
    display: block;
}

.phone-option {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    transition: background-color 0.2s;
    color: var(--wa-text);
}

.phone-option:hover {
    background: var(--wa-hover);
}

.phone-option.selected {
    background: #e7f3ff;
}

.phone-option .phone-avatar {
    background: var(--wa-secondary);
    color: white;
}

.header-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.action-button {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s;
}

.action-button:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Search Styles */
.search-wrapper {
    padding: 12px 16px;
    background: var(--wa-background);
    border-bottom: 1px solid var(--wa-border);
}

.search-container {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--wa-surface);
    border-radius: var(--wa-radius);
    padding: 8px 12px;
}

.search-icon {
    color: var(--wa-text-light);
    margin-right: 8px;
    font-size: 14px;
}

.search-input {
    border: none;
    outline: none;
    flex: 1;
    font-size: 14px;
    background: transparent;
    color: var(--wa-text);
}

.search-input::placeholder {
    color: var(--wa-text-light);
}

/* Filter Styles */
.conversation-filters {
    display: flex;
    background: var(--wa-surface);
    border-bottom: 1px solid var(--wa-border);
    padding: 0 16px;
}

.filter-tab {
    background: none;
    border: none;
    padding: 12px 16px;
    cursor: pointer;
    font-size: 14px;
    color: var(--wa-text-light);
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-tab:hover {
    color: var(--wa-text);
    background: var(--wa-hover);
}

.filter-tab.active {
    color: var(--wa-primary);
    border-bottom-color: var(--wa-primary);
}

.badge {
    background: var(--wa-secondary);
    color: white;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

/* Conversation List */
.conversation-list {
    flex: 1;
    overflow-y: auto;
    background: var(--wa-surface);
}

.conversation-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--wa-border);
    transition: background-color 0.2s;
    position: relative;
}

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

.conversation-item.active {
    background: #e7f3ff;
    border-right: 3px solid var(--wa-primary);
}

.contact-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--wa-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
    font-size: 16px;
    margin-right: 12px;
    text-transform: uppercase;
}

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

.conversation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.contact-name {
    font-weight: 500;
    color: var(--wa-text);
    font-size: 16px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-time {
    font-size: 12px;
    color: var(--wa-text-light);
    white-space: nowrap;
}

.conversation-preview {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    color: var(--wa-text-light);
}

.message-status {
    color: var(--wa-primary);
}

.unread-count {
    background: var(--wa-secondary);
    color: white;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    margin-left: auto;
}

.conversation-item.unread .contact-name {
    font-weight: 600;
}

.conversation-item.unread .conversation-preview {
    color: var(--wa-text);
    font-weight: 500;
}

/* Main Chat Area */
.messenger-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--wa-background);
    position: relative;
}

.welcome-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: var(--wa-surface);
}

.welcome-content {
    text-align: center;
    max-width: 600px;
    padding: 40px;
}

.welcome-image {
    width: 200px;
    height: auto;
    margin-bottom: 24px;
    opacity: 0.8;
}

.welcome-content h3 {
    color: var(--wa-text);
    font-size: 28px;
    font-weight: 300;
    margin-bottom: 8px;
}

.welcome-content > p {
    color: var(--wa-text-light);
    font-size: 16px;
    margin-bottom: 40px;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    margin-top: 40px;
}

.feature-item {
    padding: 20px;
    border-radius: var(--wa-radius);
    background: var(--wa-hover);
    text-align: center;
}

.feature-item i {
    font-size: 32px;
    color: var(--wa-primary);
    margin-bottom: 12px;
}

.feature-item h4 {
    color: var(--wa-text);
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.feature-item p {
    font-size: 14px;
    color: var(--wa-text-light);
    margin: 0;
    line-height: 1.4;
}

.empty-state {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: var(--wa-text-light);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.wa-animate-fade {
    animation: fadeIn 0.5s ease-out;
}

/* Responsive */
@media (max-width: 768px) {
    .messenger-sidebar {
        width: 100%;
        position: absolute;
        z-index: 1000;
        transform: translateX(-100%);
        transition: transform 0.3s;
    }

    .messenger-sidebar.show {
        transform: translateX(0);
    }

    .features-grid {
        grid-template-columns: 1fr;
    }
}
