/* Modern Chat Application - Custom Styles */

:root {
    --primary-color: #17a2b8;      /* Türkis */
    --primary-dark: #138496;
    --primary-light: #5bc0de;
    --primary-lighter: #e7f8fb;

    --secondary-color: #6c757d;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;

    --light-bg: #f8f9fa;
    --white: #ffffff;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --text-muted: #adb5bd;

    --border-color: #dee2e6;
    --shadow-sm: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --shadow-lg: 0 1rem 3rem rgba(0, 0, 0, 0.175);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    /* Türkis-Verlauf (kein Blau) */
    background: linear-gradient(135deg, var(--primary-lighter) 0%, #fdfefe 100%);
    color: var(--text-primary);
}

/* --- Seitenumschaltung (Bootstrap .d-flex überschreibt → daher !important) --- */
.page { display: none !important; }
.page.active { display: flex !important; }

/* Override Bootstrap Primary Color – nur Türkis */
.btn-primary { background-color: var(--primary-color); border-color: var(--primary-color); transition: all 0.3s ease; }
.btn-primary:hover { background-color: var(--primary-dark); border-color: var(--primary-dark); transform: translateY(-2px); box-shadow: 0 5px 15px rgba(23, 162, 184, 0.3); }
.btn-outline-primary { color: var(--primary-color); border-color: var(--primary-color); }
.btn-outline-primary:hover { background-color: var(--primary-color); border-color: var(--primary-color); }

.bg-primary { background-color: var(--primary-color) !important; }
.text-primary { color: var(--primary-color) !important; }

/* Landing Page Styles */
#landingPage { background: linear-gradient(135deg, var(--primary-lighter) 0%, var(--white) 100%); min-height: 100vh; }

.icon-wrapper { width: 120px; height: 120px; background: linear-gradient(135deg, var(--primary-color), var(--primary-light)); border-radius: 50%; display: flex; align-items: center; justify-content: center; animation: pulse 2s infinite; }
.icon-wrapper i { color: white !important; }

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(23, 162, 184, 0.7); }
    70% { box-shadow: 0 0 0 20px rgba(23, 162, 184, 0); }
    100% { box-shadow: 0 0 0 0 rgba(23, 162, 184, 0); }
}

/* Form Styling */
.form-control { border: 2px solid var(--border-color); transition: all 0.3s ease; padding: 0.75rem 1rem; }
.form-control:focus { border-color: var(--primary-color); box-shadow: 0 0 0 0.2rem rgba(23, 162, 184, 0.25); }
.form-control-lg { padding: 1rem 1.25rem; font-size: 1.1rem; }

/* Chat Page Styles */
#chatPage { background-color: var(--white); }

/* Navbar in Türkis-Gradient */
.navbar { background: linear-gradient(135deg, var(--primary-color), var(--primary-dark)) !important; padding: 1rem 0; }
.room-info { padding-left: 1rem; border-left: 3px solid rgba(255, 255, 255, 0.3); }
.user-info { text-align: right; }

/* Chat Container */
#chatContainer { background: var(--light-bg); position: relative; }

/* Eine Nachricht pro Zeile & klare Ausrichtung */
.message-row { width: 100%; margin-bottom: 1rem; }
.message-row .message-header { margin-bottom: .4rem; display: flex; align-items: center; gap: .5rem; }
.message-wrapper { width: 100%; }

.message-bubble {
    display: inline-block;
    max-width: 70%;
    padding: .75rem 1.25rem;
    border-radius: 1.25rem;
    background: var(--white);
    box-shadow: var(--shadow-sm);
    position: relative;
    word-wrap: break-word;
    transition: transform .2s ease;
}
.message-bubble:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); }
.message-bubble.own { background: linear-gradient(135deg, var(--primary-color), var(--primary-light)); color: #fff; }

/* Header/Text */
.message-username { font-weight: 600; color: var(--text-primary); font-size: .9rem; }
.message-timestamp { color: var(--text-muted); font-size: .75rem; }

/* Der Text in Nachrichten soll Zeilenumbrüche & Leerzeilen beibehalten */
.message-text { white-space: pre-wrap; }

/* Attachments & Images */
/* ▼▼▼ HIER: Bilder max. 50% Browserbreite, aber nie größer als die Bubble ▼▼▼ */
.message-image {
    display: block;
    width: auto;
    height: auto;
    max-width: min(50vw, 100%);  /* 50% Viewportbreite, aber nie größer als die Bubble */
    border-radius: .75rem;
    margin-top: .5rem;
    cursor: pointer;
    transition: transform .3s ease;
}
.message-image:hover { transform: scale(1.02); }
/* ▲▲▲ */

.file-attachment {
    display: inline-flex; align-items: center; gap: .5rem;
    padding: .5rem 1rem; background: rgba(23,162,184, .08);
    border-radius: .75rem; margin-top: .5rem; text-decoration: none; color: inherit; transition: all .3s ease;
}
.file-attachment:hover { background: rgba(23,162,184, .16); transform: translateX(5px); }

/* Empty State */
#emptyState { color: var(--text-muted); padding: 3rem; }

/* Typing Indicator */
.typing-dots { display: inline-flex; gap: 3px; }
.typing-dots span { width: 8px; height: 8px; background: var(--text-muted); border-radius: 50%; animation: typingAnimation 1.4s infinite; }
.typing-dots span:nth-child(2) { animation-delay: .2s; }
.typing-dots span:nth-child(3) { animation-delay: .4s; }

@keyframes typingAnimation { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-10px); } }

/* Message Input Area */
#messageForm { position: relative; }
#charCounter { font-size: .75rem; pointer-events: none; }

/* Textarea Styling: 2 Zeilen Minimum, sanftes Auto-Resize */
#messageInput {
    min-height: 2.6em;      /* ~2 Zeilen */
    max-height: 14.3em;     /* ~11–12 Zeilen, danach Scrollbar */
    overflow-y: hidden;
    resize: none;           /* Auto-Resize steuert die Höhe */
    line-height: 1.3;
}

/* Upload Button Animation */
#uploadBtn { transition: all .3s ease; }
#uploadBtn:hover { transform: rotate(45deg); }

/* Modal */
.modal-content { border: none; box-shadow: var(--shadow-lg); }
.modal-header { background: linear-gradient(135deg, var(--primary-color), var(--primary-light)); color: var(--white); }
.modal-header .btn-close { filter: brightness(0) invert(1); }

/* File Preview */
#filePreview { transition: all .3s ease; }
#filePreview.has-file { background: var(--primary-lighter) !important; }

/* Progress Bar in Türkis */
.progress-bar { background: linear-gradient(135deg, var(--primary-color), var(--primary-light)); }

/* Scrollbar */
#chatContainer::-webkit-scrollbar { width: 8px; }
#chatContainer::-webkit-scrollbar-track { background: var(--light-bg); }
#chatContainer::-webkit-scrollbar-thumb { background: var(--primary-color); border-radius: 4px; }
#chatContainer::-webkit-scrollbar-thumb:hover { background: var(--primary-dark); }

/* Responsive */
@media (max-width: 768px) {
    .message-bubble { max-width: 85%; }
    .navbar-brand { font-size: .9rem; }
    .user-info { display: none; }
    #sendBtn span { display: none; }
    #sendBtn i { margin: 0 !important; }
}

/* Tooltips */
.tooltip { font-size: .875rem; }

/* Badges */
.badge { padding: .35em .65em; font-weight: 500; }

/* User Status */
.user-status { width: 8px; height: 8px; background: #28a745; border-radius: 50%; display: inline-block; margin-right: 5px; animation: pulse 2s infinite; }
.user-status.offline { background: #6c757d; animation: none; }

@keyframes spin { to { transform: rotate(360deg); } }
.loading-spinner { display: inline-block; width: 20px; height: 20px; border: 3px solid var(--primary-lighter); border-top-color: var(--primary-color); border-radius: 50%; animation: spin .8s linear infinite; }

.card { transition: all 0.3s ease; }
.card:hover { transform: translateY(-5px); box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1); }

.notification-badge { position: absolute; top: -5px; right: -5px; background: var(--danger-color); color: white; border-radius: 10px; padding: 2px 6px; font-size: 0.7rem; font-weight: bold; animation: bounce 1s infinite; }
@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }

/* File Delete Button */
.file-delete-btn {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 28px;
  height: 28px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(220, 53, 69, 0.9);
  border: 2px solid white;
  opacity: 0.7;
  transition: all 0.3s ease;
  z-index: 10;
  cursor: pointer;
}

.file-delete-btn:hover {
  opacity: 1;
  transform: scale(1.1);
  background: rgba(220, 53, 69, 1);
}

.file-delete-btn i {
  font-size: 12px;
  color: white;
}

/* Für Nicht-Bild-Attachments */
.file-attachment {
  position: relative;
  padding-right: 45px !important; /* Platz für Delete-Button */
}


