/* Reset e stili base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f0f2f5;
    height: 100vh;
    overflow: hidden;
}

/* Container principale */
.container {
    display: flex;
    height: 100vh;
    max-width: 1400px;
    margin: 0 auto;
    background-color: #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Stili per la sidebar */
.sidebar {
    width: 300px;
    background-color: #ffffff;
    border-right: 1px solid #e9edef;
    overflow-y: auto;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 15px;
    display: flex;
    align-items: center;
    background-color: #f0f2f5;
    position: sticky;
    top: 0;
    z-index: 10;
}

.sidebar-header h2 {
    color: #41525d;
    font-size: 18px;
}

.sidebar-options {
    padding: 15px 0;
}

.sidebar-option {
    padding: 15px;
    display: flex;
    align-items: center;
    color: #41525d;
    cursor: pointer;
    transition: background-color 0.2s;
}

.sidebar-option:hover {
    background-color: #f0f2f5;
}

.sidebar-option i {
    margin-right: 15px;
    font-size: 18px;
    color: #919191;
}

/* Stili per la lista delle chat */
.chat-list-container {
    width: 400px;
    background-color: #ffffff;
    border-right: 1px solid #e9edef;
    overflow-y: auto;
    flex-shrink: 0;
}

.chat-list-header {
    padding: 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: #f0f2f5;
    position: sticky;
    top: 0;
    z-index: 10;
}

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

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

.header-icons {
    display: flex;
}

.header-icons i {
    margin-left: 15px;
    color: #919191;
    font-size: 20px;
    cursor: pointer;
}

.search-box {
    padding: 10px 15px;
    background-color: #f0f2f5;
}

.search-box input {
    width: 100%;
    padding: 8px 10px;
    border-radius: 20px;
    border: none;
    background-color: #ffffff;
    outline: none;
    font-size: 14px;
}

.chat-list {
    padding: 0;
}

.chat-card {
    display: flex;
    padding: 15px;
    border-bottom: 1px solid #f0f2f5;
    cursor: pointer;
    transition: background-color 0.2s;
}

.chat-card:hover {
    background-color: #f0f2f5;
}

.chat-details {
    flex: 1;
    margin-left: 15px;
    overflow: hidden;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}

.chat-name {
    font-weight: 500;
    color: #41525d;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.chat-time {
    color: #919191;
    font-size: 13px;
}

.chat-message {
    display: flex;
    align-items: center;
    color: #919191;
    font-size: 14px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.message-preview {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

.message-status {
    margin-left: 5px;
    display: flex;
    align-items: center;
}

.message-status i.read {
    color: #4fc3f7;
}

.unread-count {
    background-color: #25d366;
    color: white;
    font-size: 12px;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 5px;
}

/* Stili per la chat principale */
.main-chat {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: #efeae2;
    background-image: url('https://web.whatsapp.com/img/bg-chat-tile-light_a4be512e7195b6b733d9110b408f075d.png');
    background-repeat: repeat;
}

.chat-header {
    padding: 15px;
    display: flex;
    align-items: center;
    background-color: #f0f2f5;
    position: sticky;
    top: 0;
    z-index: 10;
}

.back-button {
    display: none;
    margin-right: 15px;
    color: #919191;
    cursor: pointer;
    font-size: 20px;
}

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

.chat-header-text {
    margin-left: 15px;
}

.chat-header-text h3 {
    color: #41525d;
    font-weight: 500;
}

.chat-header-text p {
    color: #919191;
    font-size: 13px;
}

.chat-header-icons {
    display: flex;
}

.chat-header-icons i {
    margin-left: 15px;
    color: #919191;
    font-size: 20px;
    cursor: pointer;
}

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

.chat-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #41525d;
    text-align: center;
    padding: 20px;
}

.chat-placeholder i {
    font-size: 50px;
    color: #919191;
    margin-bottom: 20px;
}

.chat-placeholder h3 {
    font-size: 26px;
    margin-bottom: 10px;
}

.chat-placeholder p {
    color: #919191;
    max-width: 500px;
    margin-bottom: 20px;
}

.message {
    display: flex;
    margin-bottom: 10px;
    max-width: 70%;
}

.message.sent {
    margin-left: auto;
    justify-content: flex-end;
}

.message.received {
    margin-right: auto;
    justify-content: flex-start;
}

.message-content {
    padding: 10px 15px;
    border-radius: 8px;
    position: relative;
}

.message.sent .message-content {
    background-color: #dcf8c6;
}

.message.received .message-content {
    background-color: white;
}

.message-text {
    margin-bottom: 5px;
    color: #303030;
}

.message-time {
    font-size: 11px;
    color: #919191;
    text-align: right;
}

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

.chat-input i {
    color: #919191;
    font-size: 20px;
    margin: 0 10px;
    cursor: pointer;
}

.chat-input input {
    flex: 1;
    padding: 10px 15px;
    border-radius: 20px;
    border: none;
    outline: none;
    font-size: 14px;
}

/* Navigazione mobile */
.mobile-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: #f0f2f5;
    padding: 10px;
    z-index: 100;
    border-top: 1px solid #e9edef;
}

.mobile-nav-buttons {
    display: flex;
    justify-content: space-around;
}

.mobile-nav-button {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #919191;
    cursor: pointer;
    padding: 5px 0;
}

.mobile-nav-button.active {
    color: #128c7e;
}

.mobile-nav-button i {
    font-size: 24px;
    margin-bottom: 5px;
}

.mobile-nav-button span {
    font-size: 12px;
}

/* Responsive design */
@media (max-width: 1200px) {
    .sidebar {
        width: 250px;
    }
    
    .chat-list-container {
        width: 350px;
    }
}

@media (max-width: 992px) {
    .container {
        max-width: 100%;
    }
    
    .sidebar {
        width: 100%;
        display: none;
    }
    
    .chat-list-container {
        width: 100%;
        display: none;
    }
    
    .main-chat {
        width: 100%;
        display: none;
    }
    
    .mobile-nav {
        display: block;
    }
    
    .back-button {
        display: block;
    }
    
    /* Aggiustamenti per la visualizzazione corretta su mobile */
    .chat-messages {
        padding-bottom: 70px; /* Spazio per la navigazione mobile */
    }
}

/* Animazioni */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.message {
    animation: fadeIn 0.3s ease-in-out;
}

/* Dark mode (opzionale) */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #111b21;
    }
    
    .container {
        background-color: #111b21;
    }
    
    .sidebar, .chat-list-container {
        background-color: #111b21;
        border-right-color: #222d34;
    }
    
    .sidebar-header, .chat-list-header, .chat-header {
        background-color: #202c33;
    }
    
    .sidebar-option {
        color: #e9edef;
    }
    
    .sidebar-option:hover {
        background-color: #2a3942;
    }
    
    .chat-card:hover {
        background-color: #2a3942;
    }
    
    .chat-name {
        color: #e9edef;
    }
    
    .search-box {
        background-color: #202c33;
    }
    
    .search-box input {
        background-color: #111b21;
        color: #e9edef;
    }
    
    .main-chat {
        background-color: #0b141a;
        background-image: url('https://web.whatsapp.com/img/bg-chat-tile-dark_a4be512e7195b6b733d9110b408f075d.png');
    }
    
    .message.received .message-content {
        background-color: #202c33;
    }
    
    .message.sent .message-content {
        background-color: #005c4b;
    }
    
    .message-text {
        color: #e9edef;
    }
    
    .chat-placeholder {
        color: #e9edef;
    }
    
    .chat-input {
        background-color: #202c33;
    }
    
    .chat-input input {
        background-color: #2a3942;
        color: #e9edef;
    }
    
    .mobile-nav {
        background-color: #202c33;
        border-top-color: #222d34;
    }
} 