/* WhatsApp-inspired styling */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background-color: #f0f2f5;
}

.app-container {
    display: flex;
    flex: 1;
    height: calc(100vh - 60px);
    overflow: hidden;
}

/* Header styling */
.app-header {
    background-color: #128C7E;
    color: white;
    padding: 10px 20px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.app-header h1 {
    font-size: 20px;
    font-weight: 500;
}

.user-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.user-info input {
    padding: 8px;
    margin-right: 10px;
    border: none;
    border-radius: 4px;
}

.user-profile {
    display: flex;
    align-items: center;
    margin-left: auto;
}

#nickNameLabel {
    margin: 0 10px;
    font-weight: 500;
    color: white;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #25D366;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    font-size: 18px;
    overflow: hidden;
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.user-info button {
    background-color: #25D366;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
}

.user-info button:hover {
    background-color: #128C7E;
}

.logout-button {
    background-color: #e74c3c !important;
}

.logout-button:hover {
    background-color: #c0392b !important;
}

/* Sidebar styling */
.sidebar {
    width: 30%;
    background-color: white;
    border-right: 1px solid #ddd;
    display: flex;
    flex-direction: column;
}

.search-container {
    padding: 10px;
    background-color: #f6f6f6;
    border-bottom: 1px solid #ddd;
    position: relative;
}

.search-container input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 20px;
    background-color: white;
}

.search-container button {
    background-color: #25D366;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 4px;
    margin-top: 8px;
    cursor: pointer;
    width: 100%;
}

.contacts-list {
    flex: 1;
    overflow-y: auto;
}

.contact-item {
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.contact-item:hover {
    background-color: #f5f5f5;
}

.contact-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: #25D366;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    font-size: 20px;
}

.contact-info {
    flex: 1;
}

.contact-name {
    font-weight: 500;
    margin-bottom: 5px;
}

.contact-item {
    position: relative;
}

.unread-counter {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background-color: #25D366;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

/* Chat area styling */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: #e5ddd5;
    background-image: url('https://web.whatsapp.com/img/bg-chat-tile-light_a4be8c74ff255af3.png');
    background-repeat: repeat;
}

.chat-header {
    padding: 10px 15px;
    background-color: #f0f0f0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #ddd;
}

.chat-header-info {
    display: flex;
    align-items: center;
}

.chat-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #25D366;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 15px;
    font-size: 18px;
}

.chat-header-name {
    font-weight: 500;
}

.chat-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #555;
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.message {
    max-width: 65%;
    padding: 8px 12px;
    margin-bottom: 10px;
    border-radius: 7.5px;
    position: relative;
    word-wrap: break-word;
}

.message-received {
    background-color: white;
    align-self: flex-start;
    border-top-left-radius: 0;
}

.message-sent {
    background-color: #dcf8c6;
    margin-left: auto;
    border-top-right-radius: 0;
}

.chat-input {
    padding: 10px;
    background-color: #f0f0f0;
    display: flex;
    align-items: center;
}

.chat-input input {
    flex: 1;
    padding: 10px 15px;
    border: none;
    border-radius: 20px;
    margin-right: 10px;
}

.chat-input button {
    background-color: #25D366;
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hidden {
    display: none !important;
}

.chat-placeholder {
    flex: 1;
    display: flex;
    background-color: #f0f2f5;
    position: relative;
    overflow: hidden;
}

.whatsapp-background {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #e5ddd5;
    background-image: url('https://web.whatsapp.com/img/bg-chat-tile-light_a4be8c74ff255af3.png');
    background-repeat: repeat;
    opacity: 0.5;
}

/* Authentication Styles */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: calc(100vh - 60px);
    background-color: #f0f2f5;
}

.auth-form {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 30px;
    width: 100%;
    max-width: 400px;
}

.auth-form h2 {
    color: #128C7E;
    margin-bottom: 20px;
    text-align: center;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #41525d;
}

.form-group input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
}

.form-hint {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: #666;
}

.auth-button {
    background-color: #25D366;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 12px;
    width: 100%;
    font-size: 16px;
    cursor: pointer;
    margin-top: 10px;
}

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

.auth-footer {
    margin-top: 20px;
    text-align: center;
    color: #41525d;
}

.auth-footer a {
    color: #128C7E;
    text-decoration: none;
}

.auth-footer a:hover {
    text-decoration: underline;
}

.error-message {
    color: #e74c3c;
    margin-bottom: 15px;
    text-align: center;
}

.success-message {
    color: #27ae60;
    margin-bottom: 15px;
    text-align: center;
}

/* Error input styling */
.error-input {
    border-color: #e74c3c !important;
    background-color: rgba(231, 76, 60, 0.05) !important;
    box-shadow: 0 0 0 1px #e74c3c !important;
}

/* Add focus style to remove error highlight when user starts typing again */
.error-input:focus {
    border-color: #3498db !important;
    box-shadow: 0 0 0 1px #3498db !important;
    background-color: #fff !important;
}

/* Error link styling */
.error-link {
    color: #3498db;
    text-decoration: underline;
    font-weight: 500;
}

.error-link:hover {
    color: #2980b9;
}

/* Alert styling */
.alert {
    padding: 10px 15px;
    border-radius: 4px;
    margin-top: 10px;
    font-size: 14px;
    font-weight: 500;
    animation: fadeIn 0.3s ease-in-out;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

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

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

/* Avatar selection styles */
.avatar-selection {
    margin-top: 10px;
}

.avatar-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 15px;
}

.avatar-option {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.2s ease;
}

.avatar-option img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-option.selected {
    border-color: #25D366;
    transform: scale(1.05);
}

.avatar-upload {
    margin-top: 15px;
}

.custom-avatar-label {
    display: inline-block;
    padding: 8px 15px;
    background-color: #f0f0f0;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.custom-avatar-label:hover {
    background-color: #e0e0e0;
}

.avatar-preview {
    margin-top: 10px;
    position: relative;
    width: 100px;
    height: 100px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid #25D366;
}

.avatar-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.remove-preview {
    position: absolute;
    top: 0;
    right: 0;
    width: 24px;
    height: 24px;
    background-color: rgba(231, 76, 60, 0.8);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

/* Profile picture styles for chat */
.contact-avatar img, .chat-header-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
