:root {
    --bg-dark: #1a1a1a;
    --bg-dark-lighter: #2a2a2a;
    --card-bg: #2a2a2a;
    --text-primary: #faf8f6;
    --text-secondary: #a8a8a8;
    --text-muted: #6b7280;
    --primary-color: #d4745f;
    --secondary-color: #a8384a;
    --success-color: #8bc34a;
    --warning-color: #ff9800;
    --danger-color: #dc2626;
    --border-radius: 12px;
    --shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

body {
    background: var(--bg-dark);
    color: var(--text-primary);
}

/* Chat Layout */
.chat-container {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 0.75rem;
    max-width: 100%;
    margin: 0;
    padding: 0.5rem;
    height: calc(100vh - 1rem);
}

.chat-main {
    display: flex;
    flex-direction: column;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.chat-header {
    background: var(--card-bg);
    color: var(--text-primary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding: 0.6rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h1 {
    font-size: 1.1rem;
    margin: 0;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
    background: var(--bg-dark);
}

/* Tmavý scrollbar */
.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: var(--bg-dark);
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #4a4a4a;
    border-radius: 4px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #5a5a5a;
}

.message {
    margin-bottom: 0.35rem;
    padding: 0.4rem 0.75rem;
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.message-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.message-author {
    font-weight: 600;
    color: var(--primary-color);
}

.message-author.premium {
    color: var(--warning-color);
}

.message-time {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.message-content {
    color: var(--text-color);
    word-wrap: break-word;
}

/* Odkazy v chatu */
.chat-link {
    color: #60a5fa;  /* Světle modrá pro tmavé téma */
    text-decoration: none;
    border-bottom: 1px dotted rgba(96, 165, 250, 0.5);
    transition: all 0.2s ease;
}

.chat-link:hover {
    color: #93c5fd;
    border-bottom-color: #93c5fd;
    border-bottom-style: solid;
}

/* Trackované odkazy (interní reklamy) */
.chat-link.tracked-link {
    color: #a78bfa;  /* Světle fialová pro odlišení */
    border-bottom-color: rgba(167, 139, 250, 0.5);
}

.chat-link.tracked-link:hover {
    color: #c4b5fd;
    border-bottom-color: #c4b5fd;
}

/* Externí ikona pro odkazy */
.chat-link::after {
    content: '';
    display: inline-block;
    width: 10px;
    height: 10px;
    margin-left: 3px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2360a5fa' stroke-width='2'%3E%3Cpath d='M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6'/%3E%3Cpolyline points='15 3 21 3 21 9'/%3E%3Cline x1='10' y1='14' x2='21' y2='3'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    vertical-align: middle;
    opacity: 0.7;
}

/* Velikost písma v chatu */
.chat-messages.font-small {
    font-size: 0.85rem;
}

.chat-messages.font-medium {
    font-size: 1rem;
}

.chat-messages.font-large {
    font-size: 1.15rem;
}

/* System messages */
.message.system-message {
    background: rgba(168, 168, 168, 0.1);
    border-left: 2px solid var(--text-secondary);
    padding: 0.5rem 0.75rem;
    font-style: italic;
    font-size: 0.85rem;
    color: var(--text-secondary);
    box-shadow: none;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.message.system-message.join {
    border-left-color: #8bc34a;
    color: #8bc34a;
    background: rgba(139, 195, 74, 0.1);
}

.message.system-message.leave {
    border-left-color: #ff9800;
    color: #ff9800;
    background: rgba(255, 152, 0, 0.1);
}

.message.system-message.timeout {
    border-left-color: var(--text-secondary);
    color: var(--text-secondary);
    background: rgba(168, 168, 168, 0.05);
}

.system-message-text {
    flex: 1;
}

.system-message-time {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-left: 1rem;
}

/* Private messages */
.message.private-message {
    background: rgba(168, 56, 74, 0.1);
    border-left: 3px solid var(--secondary-color);
}

.private-indicator {
    font-size: 0.85rem;
    margin-left: 0.5rem;
    opacity: 0.7;
}

.private-info {
    color: var(--secondary-color);
    font-weight: 600;
    font-size: 0.9rem;
}

/* Autocomplete dropdown */
.autocomplete-dropdown {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background: var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
    box-shadow: 0 -4px 6px rgba(0, 0, 0, 0.3);
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    margin-bottom: 0.5rem;
}

.autocomplete-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.selected {
    background: rgba(212, 116, 95, 0.2);
}

.autocomplete-item.selected {
    font-weight: 600;
    color: var(--primary-color);
}

.chat-input-container {
    position: relative;
    padding: 0.75rem;
    background: var(--card-bg);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.chat-input-form {
    display: flex;
    gap: 0.5rem;
}

.chat-input {
    flex: 1;
    padding: 0.6rem 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: inherit;
    background: var(--bg-dark-lighter);
    color: var(--text-primary);
}

.chat-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Sidebar */
.chat-sidebar {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    overflow-y: auto;
}

.sidebar-section {
    margin-bottom: 2rem;
}

.sidebar-section h3 {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.online-count {
    background: var(--success-color);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.8rem;
}

.online-users-list {
    list-style: none;
    padding: 0;
}

.online-user {
    padding: 0.5rem;
    margin-bottom: 0.25rem;
    background: var(--bg-dark-lighter);
    border-radius: 8px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-premium {
    color: var(--warning-color);
    font-weight: 600;
}

/* Premium badge a online-indicator - styly v avatar.css */

/* Loading */
.loading-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

/* Responsive */
@media (max-width: 1024px) {
    .chat-container {
        grid-template-columns: 1fr;
        height: auto;
    }

    .chat-sidebar {
        order: -1;
    }

    .chat-main {
        height: 60vh;
    }
}

/* Nav links */
.nav-links {
    display: flex;
    gap: 1rem;
}

.nav-links a {
    color: var(--text-primary);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    transition: background 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.nav-links a:hover {
    background: rgba(255, 255, 255, 0.1);
}


/* Settings Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
}

.modal.active {
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
}

.modal-content {
    position: relative;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    width: 90%;
    max-width: 450px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.75rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    line-height: 1;
    transition: color 0.2s;
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
}

.modal-body .form-group {
    margin-bottom: 1.25rem;
}

.modal-body label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.modal-body select,
.modal-body input[type="color"] {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    background: var(--bg-dark);
    color: var(--text-primary);
    font-size: 1rem;
}

.modal-body input[type="color"] {
    height: 50px;
    cursor: pointer;
}

.modal-body select:focus,
.modal-body input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.modal-body .checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    color: var(--text-primary);
}

.modal-body .checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.modal-buttons {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.modal .alert {
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-top: 1rem;
}

.modal .alert.alert-success {
    background: rgba(139, 195, 74, 0.2);
    color: var(--success-color);
}

.modal .alert.alert-error {
    background: rgba(220, 38, 38, 0.2);
    color: var(--danger-color);
}

/* Textarea a number/text input v modálu */
.modal-body textarea,
.modal-body input[type="text"],
.modal-body input[type="number"],
.modal-body input[type="password"] {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    background: var(--bg-dark);
    color: var(--text-primary);
    font-size: 1rem;
    box-sizing: border-box;
}

.modal-body textarea:focus,
.modal-body input[type="text"]:focus,
.modal-body input[type="number"]:focus,
.modal-body input[type="password"]:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Select option dark theme */
.modal-body select option {
    background: #2a2624;
    color: var(--text-primary);
}

/* Owner-only pole - skryté/disabled pro ne-ownery */
.owner-only-field[disabled],
.owner-only-field.disabled {
    opacity: 0.5;
    pointer-events: none;
}

/* Inactivity Warning - pouze border a box-shadow, žádný overlay */
.chat-container.inactivity-warning .chat-main {
    border: 2px solid var(--danger-color);
    box-shadow: 0 0 20px rgba(220, 38, 38, 0.4);
    animation: pulse-border 1s ease-in-out infinite;
}

@keyframes pulse-border {
    0%, 100% {
        box-shadow: 0 0 10px rgba(220, 38, 38, 0.3);
    }
    50% {
        box-shadow: 0 0 25px rgba(220, 38, 38, 0.6);
    }
}


/* Countdown banner - NESMÍ překrývat tlačítka v headeru */
.inactivity-countdown {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(90deg, #dc2626, #b91c1c);
    color: white;
    text-align: center;
    padding: 0.5rem 1.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 9999;
    box-shadow: 0 2px 10px rgba(220, 38, 38, 0.5);
    border-radius: 0 0 8px 8px;
    max-width: 500px;
    pointer-events: none;  /* Banner sám o sobě neblokuje kliknutí */
}

/* === CITACE ZPRÁV === */

/* Tlačítko odpovědět na zprávě */
.message-row {
    display: flex;
    align-items: baseline;
}

.message-reply-btn {
    opacity: 0;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-right: 6px;
    transition: opacity 0.2s, color 0.2s;
}

.message:hover .message-reply-btn {
    opacity: 1;
}

.message-reply-btn:hover {
    color: var(--primary-color);
}

/* Preview citace nad inputem */
.reply-preview {
    display: none;
    align-items: center;
    justify-content: space-between;
    background: rgba(212, 116, 95, 0.15);
    border-left: 3px solid var(--primary-color);
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: 4px;
    font-size: 0.9rem;
}

.reply-preview-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    overflow: hidden;
}

.reply-preview-icon {
    color: var(--primary-color);
    font-size: 1rem;
}

.reply-preview-author {
    color: var(--primary-color);
    font-weight: 600;
    white-space: nowrap;
}

.reply-preview-text {
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.reply-preview-close {
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1.1rem;
    padding: 0.25rem;
    margin-left: 0.5rem;
}

.reply-preview-close:hover {
    color: var(--danger-color);
}

/* Citace ve zprávě */
.message-quote {
    background: rgba(255, 255, 255, 0.05);
    border-left: 2px solid var(--text-muted);
    padding: 0.35rem 0.6rem;
    margin-bottom: 0.35rem;
    border-radius: 2px;
    font-size: 0.85rem;
}

.message-quote .quote-author {
    color: var(--text-secondary);
    font-weight: 600;
    margin-right: 0.5rem;
}

.message-quote .quote-text {
    color: var(--text-muted);
}


/* =============================================================================
   ŠEPTACÍ OKNO (Whisper Window)
   ============================================================================= */

.whisper-window {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 500px;
    height: 600px;
    background: var(--card-bg);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    z-index: 999;
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.whisper-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(0, 0, 0, 0.2);
    cursor: move;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.whisper-partner {
    display: flex;
    align-items: center;
    gap: 10px;
}

.whisper-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
}

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

.whisper-avatar .avatar-fallback {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 16px;
}

.whisper-name {
    font-weight: 600;
    color: var(--text-primary);
}

.whisper-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    padding: 0 8px;
    line-height: 1;
    transition: color 0.2s;
}

.whisper-close:hover {
    color: var(--text-primary);
}

/* Toolbar s tlačítkem kamery */
.whisper-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.15);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.whisper-camera-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.whisper-camera-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
}

.whisper-camera-btn.active {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    border-color: transparent;
    color: white;
}

.whisper-status {
    font-size: 12px;
    color: var(--text-muted);
}

/* Body - obsahuje chat a video panel vedle sebe */
.whisper-body {
    flex: 1;
    display: flex;
    overflow: hidden;
}

.whisper-chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Video panel - pravá strana */
.whisper-video-panel {
    width: 200px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.3);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.whisper-video-container {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    background: #000;
}

.whisper-video {
    width: 100%;
    height: auto;
    aspect-ratio: 4/3;
    object-fit: cover;
    display: block;
}

.whisper-video-label {
    position: absolute;
    bottom: 4px;
    left: 4px;
    padding: 2px 6px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 10px;
    border-radius: 4px;
}

/* Rozšířené okno když je video aktivní */
.whisper-window.whisper-with-video {
    width: 720px;
}

.whisper-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.whisper-loading,
.whisper-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 20px;
    font-style: italic;
}

.whisper-message {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 4px 0;
    line-height: 1.4;
}

.whisper-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.whisper-author {
    font-weight: 600;
    flex-shrink: 0;
}

.whisper-me .whisper-author {
    color: #8b5cf6;
}

.whisper-them .whisper-author {
    color: #10b981;
}

.whisper-text {
    word-break: break-word;
    color: var(--text-primary);
}

.whisper-input-area {
    display: flex;
    gap: 8px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.whisper-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.whisper-input:focus {
    border-color: var(--primary-color);
}

.whisper-input::placeholder {
    color: var(--text-muted);
}

.whisper-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    transition: transform 0.2s, box-shadow 0.2s;
}

.whisper-send:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.whisper-send svg {
    width: 18px;
    height: 18px;
}

/* Responzivní úpravy */
@media (max-width: 800px) {
    .whisper-window {
        width: calc(100% - 20px);
        right: 10px;
        bottom: 10px;
        height: 80vh;
    }

    .whisper-window.whisper-with-video {
        width: calc(100% - 20px);
    }

    .whisper-video-panel {
        width: 150px;
    }
}

@media (max-width: 500px) {
    .whisper-body {
        flex-direction: column-reverse;
    }

    .whisper-video-panel {
        width: 100%;
        flex-direction: row;
        border-left: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .whisper-video-container {
        flex: 1;
    }
}
