/**
 * ERPAT FLASH Demo Application Styles
 * Real-time Chat & Notifications Example
 */

:root {
    --primary: #1d97a6;
    --primary-light: #10b1af;
    --primary-dark: #1288a0;
    --secondary: #58585a;
    --background: #0f1419;
    --surface: #15202b;
    --surface-light: #1c2938;
    --surface-hover: #22303c;
    --border: #38444d;
    --text: #ffffff;
    --text-secondary: #8899a6;
    --text-muted: #657786;
    --success: #17bf63;
    --warning: #ffad1f;
    --error: #e0245e;
    --info: #1da1f2;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--background);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.header-brand .logo {
    font-size: 1.5rem;
}

.header-brand .title {
    font-size: 1.25rem;
    font-weight: 600;
}

.header-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-muted);
}

.status-indicator.connected {
    background: var(--success);
    box-shadow: 0 0 8px var(--success);
}

.status-indicator.connecting {
    background: var(--warning);
    animation: pulse 1.5s infinite;
}

.status-indicator.disconnected {
    background: var(--error);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.status-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* Main Layout */
.main-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem;
    border-bottom: 1px solid var(--border);
}

.avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.25rem;
    color: white;
    flex-shrink: 0;
}

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

.user-name-input {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 1rem;
    font-weight: 500;
    padding: 0.25rem 0;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}

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

.user-status {
    font-size: 0.75rem;
    color: var(--success);
}

.section-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 1rem 1.25rem 0.5rem;
}

.user-count {
    color: var(--text-secondary);
    font-weight: 400;
}

/* Rooms List */
.rooms-section {
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.rooms-list {
    list-style: none;
}

.room-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    cursor: pointer;
    transition: background 0.2s;
}

.room-item:hover {
    background: var(--surface-hover);
}

.room-item.active {
    background: var(--primary);
}

.room-icon {
    font-size: 1.25rem;
}

.room-name {
    flex: 1;
    font-weight: 500;
}

.room-badge {
    background: var(--error);
    color: white;
    font-size: 0.75rem;
    padding: 0.125rem 0.5rem;
    border-radius: 10px;
    font-weight: 600;
}

/* Users List */
.users-section {
    flex: 1;
    overflow-y: auto;
}

.users-list {
    list-style: none;
}

.user-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1.25rem;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.875rem;
    color: white;
}

.users-list .user-name {
    flex: 1;
    font-size: 0.875rem;
}

.you-badge {
    font-size: 0.625rem;
    text-transform: uppercase;
    background: var(--primary);
    color: white;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-weight: 600;
}

/* Chat Area */
.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: var(--background);
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
}

.chat-room-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.chat-room-icon {
    font-size: 1.5rem;
}

.chat-room-name {
    font-size: 1.125rem;
    font-weight: 600;
}

.chat-room-topic {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

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

.btn-icon {
    position: relative;
    background: transparent;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    transition: background 0.2s;
}

.btn-icon:hover {
    background: var(--surface-hover);
}

.notification-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--error);
    color: white;
    font-size: 0.625rem;
    padding: 0.125rem 0.375rem;
    border-radius: 8px;
    font-weight: 600;
}

/* Welcome Screen */
.welcome-screen {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.welcome-content {
    text-align: center;
    padding: 2rem;
}

.welcome-icon {
    font-size: 4rem;
    display: block;
    margin-bottom: 1rem;
}

.welcome-content h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.welcome-content p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.feature-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    text-align: left;
    max-width: 300px;
    margin: 0 auto;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--surface);
    border-radius: var(--radius-sm);
}

.feature-icon {
    font-size: 1.25rem;
}

/* Messages */
.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.message {
    display: flex;
    gap: 0.75rem;
    max-width: 70%;
}

.message.own {
    flex-direction: row-reverse;
    margin-left: auto;
}

.message.system {
    max-width: 100%;
    justify-content: center;
}

.system-message {
    font-size: 0.875rem;
    color: var(--text-muted);
    background: var(--surface);
    padding: 0.5rem 1rem;
    border-radius: 20px;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
}

.message-content {
    background: var(--surface);
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    border-top-left-radius: 4px;
}

.message.own .message-content {
    background: var(--primary);
    border-top-left-radius: var(--radius);
    border-top-right-radius: 4px;
}

.message-header {
    display: flex;
    gap: 0.75rem;
    align-items: baseline;
    margin-bottom: 0.25rem;
}

.message-author {
    font-weight: 600;
    font-size: 0.875rem;
}

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

.message.own .message-time {
    color: rgba(255, 255, 255, 0.7);
}

.message-text {
    font-size: 0.9375rem;
    word-break: break-word;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    background: var(--text-muted);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 100% { opacity: 0.3; transform: translateY(0); }
    50% { opacity: 1; transform: translateY(-3px); }
}

.typing-text {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Message Input */
.message-input-container {
    display: flex;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    background: var(--surface);
    border-top: 1px solid var(--border);
}

.message-input {
    flex: 1;
    background: var(--surface-light);
    border: 1px solid var(--border);
    border-radius: 24px;
    padding: 0.75rem 1.25rem;
    color: var(--text);
    font-size: 0.9375rem;
    transition: border-color 0.2s;
}

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

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

.send-button {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 24px;
    padding: 0.75rem 1.5rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s;
}

.send-button:hover {
    background: var(--primary-light);
}

.send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Notification Panel */
.notification-panel {
    width: 0;
    background: var(--surface);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width 0.3s;
}

.notification-panel.open {
    width: 320px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}

.panel-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.btn-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

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

.notifications-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem;
}

.notification-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.2s;
}

.notification-item:hover {
    background: var(--surface-hover);
}

.notification-item.unread {
    background: var(--surface-light);
}

.notification-item.unread::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--primary);
    border-radius: 2px;
}

.notification-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.notification-content {
    flex: 1;
    min-width: 0;
}

.notification-title {
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.notification-message {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.notification-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.notification-item.success .notification-icon { color: var(--success); }
.notification-item.warning .notification-icon { color: var(--warning); }
.notification-item.error .notification-icon { color: var(--error); }
.notification-item.info .notification-icon { color: var(--info); }

.no-notifications {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

.empty-icon {
    font-size: 2rem;
    display: block;
    margin-bottom: 0.5rem;
}

.panel-footer {
    padding: 1rem;
    border-top: 1px solid var(--border);
}

.btn-test {
    width: 100%;
    background: var(--surface-light);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-test:hover {
    background: var(--surface-hover);
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    display: flex;
    flex-direction: column-reverse;
    gap: 0.75rem;
    z-index: 1000;
}

.toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1rem 1.25rem;
    box-shadow: var(--shadow);
    min-width: 280px;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.warning { border-left: 3px solid var(--warning); }
.toast.error { border-left: 3px solid var(--error); }
.toast.info { border-left: 3px solid var(--info); }

.toast-icon {
    font-size: 1.25rem;
}

.toast-message {
    flex: 1;
    font-size: 0.875rem;
}

/* Toast Animation */
.toast-enter-active,
.toast-leave-active {
    transition: all 0.3s ease;
}

.toast-enter-from {
    opacity: 0;
    transform: translateX(100%);
}

.toast-leave-to {
    opacity: 0;
    transform: translateX(100%);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 240px;
    }
    
    .notification-panel.open {
        width: 280px;
    }
    
    .message {
        max-width: 85%;
    }
}

@media (max-width: 600px) {
    .main-layout {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        height: auto;
        max-height: 200px;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    
    .users-section {
        display: none;
    }
    
    .notification-panel {
        position: fixed;
        right: 0;
        top: 0;
        bottom: 0;
        z-index: 100;
    }
}
