/* Global Styles */
:root {
    --primary-color: #4285f4;
    --secondary-color: #34a853;
    --accent-color: #ea4335;
    --dark-color: #202124;
    --light-color: #f8f9fa;
    --gray-color: #5f6368;
    --light-gray: #e8eaed;
    --online-color: #34a853;
    --offline-color: #ea4335;
    --away-color: #fbbc05;
}

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

html, body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

body {
    background-color: var(--light-color);
    color: var(--dark-color);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 20px;
}

.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: #3367d6;
}

.btn-secondary {
    background-color: var(--light-gray);
    color: var(--dark-color);
}

.btn-secondary:hover {
    background-color: #d2d6db;
}

.btn-icon {
    padding: 10px;
    background: none;
    color: var(--gray-color);
    font-size: 1.2rem;
}

.btn-icon:hover {
    color: var(--primary-color);
    background: rgba(66, 133, 244, 0.1);
}

/* Navigation */
.main-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background-color: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
}

.nav-brand {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    white-space: nowrap;
}

.nav-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--gray-color);
}

.nav-links {
    display: flex;
    gap: 20px;
}

.nav-link {
    text-decoration: none;
    color: var(--gray-color);
    display: flex;
    align-items: center;
    gap: 5px;
    transition: color 0.3s;
    white-space: nowrap;
}

.nav-link:hover {
    color: var(--primary-color);
}

.nav-link.active {
    color: var(--primary-color);
    font-weight: 500;
}

/* Auth Pages */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 70px);
    width: 100%;
}

.auth-card {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    padding: 30px;
    width: 100%;
    max-width: 500px;
    margin: 0 15px;
}

.auth-card h1 {
    margin-bottom: 20px;
    text-align: center;
    color: var(--primary-color);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 500;
    color: var(--gray-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-group input,
.form-group textarea {
    padding: 12px;
    border: 1px solid var(--light-gray);
    border-radius: 4px;
    font-size: 1rem;
    transition: border 0.3s;
    width: 100%;
    max-width: 100%;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.auth-footer {
    margin-top: 20px;
    text-align: center;
    color: var(--gray-color);
}

.auth-footer a {
    color: var(--primary-color);
    text-decoration: none;
}

.error-message {
    margin-top: 20px;
    padding: 10px;
    background-color: #fde8e8;
    color: var(--accent-color);
    border-radius: 4px;
    text-align: center;
    width: 100%;
}

/* Account Page */
.account-container {
    max-width: 800px;
    width: 100%;
}

.profile-header {
    text-align: center;
    margin-bottom: 30px;
}

.profile-avatar-container {
    position: relative;
    width: 150px;
    height: 150px;
    margin: 0 auto 20px;
}

.profile-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid white;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.avatar-upload-btn {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.profile-id {
    color: var(--gray-color);
    margin-bottom: 10px;
}

.profile-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.profile-status .online {
    color: var(--online-color);
}

.profile-status .offline {
    color: var(--offline-color);
}

.profile-status .away {
    color: var(--away-color);
}

.profile-details {
    background-color: white;
    border-radius: 8px;
    padding: 30px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    width: 100%;
}

/* Search Page */
.search-container {
    max-width: 800px;
    width: 100%;
}

.search-box {
    display: flex;
    margin-bottom: 30px;
    width: 100%;
}

.search-box input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid var(--light-gray);
    border-radius: 4px 0 0 4px;
    font-size: 1rem;
    min-width: 0;
}

.search-box button {
    padding: 0 20px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 0 4px 4px 0;
    cursor: pointer;
    white-space: nowrap;
}

.search-results {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    padding: 20px;
    width: 100%;
}

.no-results {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray-color);
}

.no-results i {
    font-size: 3rem;
    margin-bottom: 20px;
    color: var(--light-gray);
}

.user-card {
    display: flex;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid var(--light-gray);
    transition: background-color 0.3s;
    width: 100%;
}

.user-card:last-child {
    border-bottom: none;
}

.user-card:hover {
    background-color: rgba(66, 133, 244, 0.05);
}

.user-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 15px;
    flex-shrink: 0;
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-weight: 500;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-id {
    font-size: 0.9rem;
    color: var(--gray-color);
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-status {
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 5px;
}

.user-status .online {
    color: var(--online-color);
}

.user-status .offline {
    color: var(--offline-color);
}

.user-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

/* Chat Page */
.chat-container {
    max-width: 800px;
    height: calc(100vh - 70px);
    display: flex;
    flex-direction: column;
    padding: 0;
    width: 100%;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background-color: white;
    border-bottom: 1px solid var(--light-gray);
    position: sticky;
    top: 70px;
    z-index: 10;
    width: 100%;
}

.chat-partner-info {
    display: flex;
    align-items: center;
    gap: 15px;
    min-width: 0;
}

.chat-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.chat-partner-status {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.9rem;
    color: var(--gray-color);
    white-space: nowrap;
}

.chat-partner-status .online {
    color: var(--online-color);
}

.chat-partner-status .offline {
    color: var(--offline-color);
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background-color: #f5f7fa;
    width: 100%;
}

.message-loading {
    text-align: center;
    padding: 40px 0;
    color: var(--gray-color);
}

.message {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    max-width: 70%;
    width: fit-content;
}

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

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

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

.message-sent .message-content {
    background-color: var(--primary-color);
    color: white;
    border-bottom-right-radius: 4px;
}

.message-received .message-content {
    background-color: white;
    color: var(--dark-color);
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.message-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.8rem;
    margin-top: 5px;
    color: var(--gray-color);
}

.message-status {
    display: flex;
    align-items: center;
    gap: 3px;
}

.message-image {
    max-width: 100%;
    max-height: 300px;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.3s;
}

.message-image:hover {
    transform: scale(1.02);
}

.chat-input-container {
    display: flex;
    padding: 15px;
    background-color: white;
    border-top: 1px solid var(--light-gray);
    position: sticky;
    bottom: 0;
    width: 100%;
}

.chat-input-container input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid var(--light-gray);
    border-radius: 20px;
    font-size: 1rem;
    margin: 0 10px;
    min-width: 0;
}

/* Messages Page */
.messages-container {
    max-width: 800px;
    width: 100%;
}

.conversations-list {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
    width: 100%;
}

.conversation-loading {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray-color);
}

.conversation-card {
    display: flex;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid var(--light-gray);
    transition: background-color 0.3s;
    cursor: pointer;
    width: 100%;
}

.conversation-card:last-child {
    border-bottom: none;
}

.conversation-card:hover {
    background-color: rgba(66, 133, 244, 0.05);
}

.conversation-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
    margin-right: 15px;
    flex-shrink: 0;
}

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

.conversation-name {
    font-weight: 500;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conversation-preview {
    font-size: 0.9rem;
    color: var(--gray-color);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    white-space: normal;
    max-width: 100%;
}

.conversation-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
    flex-shrink: 0;
    margin-left: 10px;
}

.conversation-time {
    font-size: 0.8rem;
    color: var(--gray-color);
    white-space: nowrap;
}

.conversation-badge {
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
}

/* Photo Viewer */
.photo-viewer-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 70px);
    width: 100%;
}

.photo-viewer {
    max-width: 1000px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    padding: 20px;
    text-align: center;
    width: 100%;
    margin: 0 15px;
}

.photo-viewer img {
    max-width: 100%;
    max-height: 100vh;
    border-radius: 4px;
}

.photo-meta {
    margin-top: 20px;
    display: flex;
    justify-content: space-between;
    color: var(--gray-color);
    font-size: 0.9rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-links {
        position: fixed;
        top: 70px;
        left: -100%;
        width: 80%;
        height: calc(100vh - 70px);
        background-color: white;
        flex-direction: column;
        align-items: flex-start;
        padding: 20px;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
        transition: left 0.3s;
    }

    .nav-links.active {
        left: 0;
    }

    .nav-toggle {
        display: block;
    }

    .message {
        max-width: 85%;
    }
    
    .conversation-preview {
        -webkit-line-clamp: 1;
    }
}

@media (max-width: 480px) {
    .auth-card {
        padding: 20px;
        margin: 0 10px;
    }

    .profile-details {
        padding: 20px;
    }

    .message {
        max-width: 90%;
    }
    
    .chat-header {
        padding: 10px 15px;
    }
    
    .chat-partner-info {
        gap: 10px;
    }
    
    .chat-avatar {
        width: 40px;
        height: 40px;
    }
    
    .conversation-card {
        padding: 10px;
    }
    
    .conversation-avatar {
        width: 40px;
        height: 40px;
        margin-right: 10px;
    }
}