* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    overflow: hidden;
}

/* ==================== AUTH EKRANI ==================== */

#auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-box {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    width: 100%;
    max-width: 400px;
    animation: slideUp 0.5s ease;
}

@keyframes slideUp {
    from { 
        opacity: 0; 
        transform: translateY(30px); 
    }
    to { 
        opacity: 1; 
        transform: translateY(0); 
    }
}

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

.logo h1 {
    color: #667eea;
    font-size: 2.5em;
    margin-bottom: 5px;
}

.logo p {
    color: #888;
    font-size: 0.95em;
}

/* Tab Buttons */
.auth-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    background: #f0f0f0;
    padding: 5px;
    border-radius: 10px;
}

.tab-btn {
    flex: 1;
    padding: 12px;
    border: none;
    background: transparent;
    color: #666;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s;
}

.tab-btn.active {
    background: white;
    color: #667eea;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Auth Forms */
.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

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

.input-group label {
    display: block;
    margin-bottom: 8px;
    color: #444;
    font-weight: 500;
    font-size: 14px;
}

.input-group input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.3s;
}

.input-group input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
}

.input-group small {
    display: block;
    margin-top: 5px;
    color: #888;
    font-size: 12px;
}

.auth-submit {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 10px;
}

.auth-submit:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

.auth-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.error-message {
    color: #e74c3c;
    font-size: 14px;
    margin-top: 15px;
    text-align: center;
    min-height: 20px;
}

.success-message {
    color: #27ae60;
    font-size: 14px;
    margin-top: 15px;
    text-align: center;
    min-height: 20px;
}

/* ==================== CHAT EKRANI ==================== */

#chat-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 1000px;
    margin: 0 auto;
    background: white;
    box-shadow: 0 0 40px rgba(0,0,0,0.2);
}

.chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 18px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-left h1 {
    font-size: 1.4em;
}

#current-user {
    background: rgba(255,255,255,0.2);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85em;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

#user-count {
    font-size: 0.9em;
    opacity: 0.9;
}

.logout-btn, .account-btn {
    background: rgba(255,255,255,0.2);
    color: white;
    border: none;
    padding: 8px 14px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.3s;
}

.logout-btn:hover, .account-btn:hover {
    background: rgba(255,255,255,0.3);
}

#messages {
    flex: 1;
    overflow-y: auto;
    padding: 0;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
}

#load-more-container {
    padding: 15px;
    text-align: center;
    background: #f0f0f0;
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0;
}

#load-more-btn {
    background: white;
    border: 2px solid #667eea;
    color: #667eea;
    padding: 10px 25px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
}

#load-more-btn:hover:not(:disabled) {
    background: #667eea;
    color: white;
}

#load-more-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

#messages-content {
    padding: 20px;
}

.message {
    margin-bottom: 15px;
    max-width: 80%;
}

.message.animate {
    animation: fadeIn 0.3s ease;
}

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

.message.own-message {
    margin-left: auto;
    text-align: right;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
}

.message-username {
    font-weight: 600;
    font-size: 0.95em;
}

.message-time {
    font-size: 0.75em;
    color: #999;
}

.message-content {
    background: white;
    padding: 12px 16px;
    border-radius: 18px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    display: inline-block;
    word-wrap: break-word;
    text-align: left;
    line-height: 1.5;
}

.own-message .message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.system-message {
    text-align: center;
    color: #888;
    font-style: italic;
    margin: 15px 0;
    font-size: 0.9em;
    padding: 8px 16px;
    background: rgba(0,0,0,0.03);
    border-radius: 20px;
    display: inline-block;
    width: 100%;
}

/* Dosya mesajları */
.file-message {
    background: white;
    padding: 12px 16px;
    border-radius: 18px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-width: 200px;
}

.own-message .file-message {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.file-icon {
    font-size: 2em;
}

.file-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.file-name {
    font-weight: 500;
    font-size: 0.95em;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-size {
    font-size: 0.8em;
    opacity: 0.7;
}

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

.file-btn {
    padding: 6px 14px;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.3s;
}

.file-btn.view {
    background: #667eea;
    color: white;
}

.file-btn.view:hover {
    background: #5a6fd6;
}

.file-btn.download {
    background: #f0f0f0;
    color: #333;
}

.file-btn.download:hover {
    background: #e0e0e0;
}

.own-message .file-btn.download {
    background: rgba(255,255,255,0.2);
    color: white;
}

.own-message .file-btn.download:hover {
    background: rgba(255,255,255,0.3);
}

/* Görsel mesajları */
.image-message {
    max-width: 300px;
    cursor: pointer;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.3s;
}

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

.image-message img {
    width: 100%;
    height: auto;
    display: block;
}

.image-caption {
    padding: 8px 12px;
    background: white;
    font-size: 0.85em;
    color: #666;
    border-top: 1px solid #eee;
}

/* Video mesajları */
.video-message {
    max-width: 300px;
    cursor: pointer;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: transform 0.3s;
    position: relative;
    background: #000;
}

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

.video-message video {
    width: 100%;
    height: auto;
    display: block;
    max-height: 200px;
    object-fit: cover;
}

.video-play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.video-play-icon {
    font-size: 3em;
    color: white;
    opacity: 0.9;
}

.video-caption {
    padding: 8px 12px;
    background: white;
    font-size: 0.85em;
    color: #666;
    border-top: 1px solid #eee;
}

/* Input Area */
.input-area {
    display: flex;
    padding: 15px 25px;
    background: white;
    border-top: 1px solid #e0e0e0;
    gap: 10px;
    align-items: center;
}

#file-input {
    display: none;
}

.file-btn-icon {
    background: #f0f0f0;
    border: none;
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.3em;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    flex-shrink: 0;
}

.file-btn-icon:hover {
    background: #667eea;
    color: white;
}

.file-btn-icon:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

#message-input {
    flex: 1;
    padding: 14px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    font-size: 15px;
    transition: border-color 0.3s;
}

#message-input:focus {
    outline: none;
    border-color: #667eea;
}

#send-btn {
    padding: 14px 28px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
    flex-shrink: 0;
}

#send-btn:hover {
    transform: scale(1.05);
}

/* Dosya upload progress */
.upload-progress {
    position: fixed;
    bottom: 100px;
    right: 20px;
    background: white;
    padding: 15px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    display: none;
    min-width: 250px;
    z-index: 100;
}

.upload-progress.active {
    display: block;
}

.upload-progress-title {
    font-weight: 600;
    margin-bottom: 10px;
    color: #333;
}

.upload-progress-bar {
    height: 6px;
    background: #e0e0e0;
    border-radius: 3px;
    overflow: hidden;
}

.upload-progress-fill {
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    width: 0%;
    transition: width 0.3s;
}

.upload-progress-text {
    font-size: 0.85em;
    color: #666;
    margin-top: 8px;
}

/* Image Popup */
.image-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    cursor: pointer;
}

.image-popup.active {
    display: flex;
}

.image-popup img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    border-radius: 8px;
}

.image-popup-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 40px;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.3s;
}

.image-popup-close:hover {
    opacity: 1;
}

/* Video Popup */
.video-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.95);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.video-popup.active {
    display: flex;
}

.video-popup video {
    max-width: 90%;
    max-height: 85%;
    border-radius: 8px;
}

.video-popup-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 40px;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.3s;
    z-index: 1001;
}

.video-popup-close:hover {
    opacity: 1;
}

/* ==================== ACCOUNT POPUP ==================== */
.account-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
}

.account-popup.active {
    display: flex;
}

.account-popup-content {
    background: white;
    border-radius: 20px;
    width: 100%;
    max-width: 450px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 30px;
    position: relative;
    animation: slideUp 0.3s ease;
}

.account-popup-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    cursor: pointer;
    color: #999;
    transition: color 0.3s;
}

.account-popup-close:hover {
    color: #333;
}

.account-popup h2 {
    text-align: center;
    color: #667eea;
    margin-bottom: 25px;
    font-size: 1.5em;
}

/* Profil Avatar */
.profile-avatar-section {
    display: flex;
    justify-content: center;
    margin-bottom: 25px;
}

.profile-avatar-container {
    position: relative;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
}

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

.profile-avatar-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3em;
    color: white;
}

.profile-avatar-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    opacity: 0;
    transition: opacity 0.3s;
}

.profile-avatar-container:hover .profile-avatar-overlay {
    opacity: 1;
}

.avatar-btn {
    background: white;
    border: none;
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s;
}

.avatar-btn:hover {
    background: #667eea;
    color: white;
}

.avatar-btn.delete:hover {
    background: #e74c3c;
}

/* Renk Seçimi */
.color-picker-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.color-picker-section label {
    display: block;
    margin-bottom: 12px;
    font-weight: 500;
    color: #444;
    text-align: center;
}

.color-options {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.color-btn {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: all 0.3s;
}

.color-btn:hover {
    transform: scale(1.15);
}

.color-btn.active {
    border-color: #333;
    box-shadow: 0 0 0 3px white, 0 0 0 5px #333;
}

/* Account Sections */
.account-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.account-section:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
}

.account-section h3 {
    font-size: 1em;
    color: #555;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.account-section .input-group {
    margin-bottom: 12px;
}

.account-section .input-group label {
    font-size: 13px;
    color: #666;
    margin-bottom: 5px;
    display: block;
}

.account-section .input-group input {
    padding: 10px 14px;
    font-size: 14px;
    width: 100%;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
}

.account-section .input-group input:focus {
    outline: none;
    border-color: #667eea;
}

.account-submit {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    margin-top: 5px;
}

.account-submit:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.account-submit:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Mesajlarda Avatar */
.message-with-avatar {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.own-message .message-with-avatar {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid #e0e0e0;
}

.message-avatar-placeholder {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: white;
    flex-shrink: 0;
}

/* ==================== RESPONSIVE ==================== */

@media (max-width: 600px) {
    .auth-box {
        padding: 30px 20px;
    }
    
    .logo h1 {
        font-size: 2em;
    }
    
    #chat-container {
        max-width: 100%;
    }
    
    .chat-header {
        padding: 15px;
    }
    
    .header-left h1 {
        font-size: 1.1em;
    }
    
    #current-user {
        display: none;
    }
    
    .message {
        max-width: 90%;
    }
    
    .input-area {
        padding: 10px 15px;
    }
    
    .file-btn-icon {
        width: 40px;
        height: 40px;
        font-size: 1.1em;
    }
    
    #message-input {
        padding: 12px 15px;
    }
    
    #send-btn {
        padding: 12px 20px;
    }
    
    .account-btn {
        display: none;
    }
    
    .message-avatar, .message-avatar-placeholder {
        width: 30px;
        height: 30px;
        font-size: 14px;
    }
}
