/* ============================================
   BRANDEMEN - PREMIUM ZERO-COST SUPPORT APP
   Design System & Styles
   ============================================ */

/* CSS Variables - Color Palette */
:root {
    --primary: #1e3a8a;
    --secondary: #065f46;
    --accent: #d97706;
    --background: #0f172a;
    --surface: rgba(255, 255, 255, 0.1);
    --text: #f8fafc;
    --text-muted: #94a3b8;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    
    --font-serif: 'Playfair Display', serif;
    --font-sans: 'Inter', sans-serif;
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.3);
    
    --border-radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    background: linear-gradient(135deg, var(--background) 0%, #1e293b 100%);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Loading Screen */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--background);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeOut 0.5s ease-out 2s forwards;
}

.loading-content {
    text-align: center;
}

.brand-logo {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.brand-title {
    font-family: var(--font-serif);
    font-size: 3rem;
    font-weight: 700;
    margin: 1.5rem 0 0.5rem;
    background: linear-gradient(135deg, var(--accent), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.loading-subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
    font-weight: 300;
}

@keyframes fadeOut {
    to { opacity: 0; visibility: hidden; }
}

/* App Container */
.app-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 1rem;
    gap: 1rem;
}

/* Header */
.app-header {
    background: var(--surface);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
    padding: 1.25rem 1.5rem;
    box-shadow: var(--shadow-md);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.app-title {
    font-family: var(--font-serif);
    font-size: 1.75rem;
    font-weight: 700;
}

.brand-accent {
    background: linear-gradient(135deg, var(--accent), #fbbf24);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-info {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--warning);
    animation: pulse-glow 2s ease-in-out infinite;
}

.status-dot.connected {
    background: var(--success);
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 4px currentColor; }
    50% { box-shadow: 0 0 12px currentColor; }
}

.online-count {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
}

/* Room Navigation */
.room-nav {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding: 0.5rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.room-nav::-webkit-scrollbar {
    display: none;
}

.room-btn {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: var(--surface);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
    color: var(--text);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.room-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.room-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-color: var(--accent);
    box-shadow: 0 0 20px rgba(217, 119, 6, 0.3);
}

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

/* Messages Container */
.messages-container {
    flex: 1;
    overflow: hidden;
    background: var(--surface);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    position: relative;
}

.messages-wrapper {
    height: 100%;
    overflow-y: auto;
    padding: 1.5rem;
    scroll-behavior: smooth;
}

.messages-wrapper::-webkit-scrollbar {
    width: 8px;
}

.messages-wrapper::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.messages-wrapper::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

.messages-wrapper::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 2rem;
}

.empty-state.hidden {
    display: none;
}

.empty-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.empty-state h2 {
    font-family: var(--font-serif);
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.empty-subtitle {
    font-size: 0.9rem;
}

/* Message Bubbles */
.message {
    display: flex;
    margin-bottom: 1.5rem;
    animation: fadeInUp 0.3s ease-out;
}

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

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

.message-content {
    max-width: 70%;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
    padding: 0.875rem 1rem;
    box-shadow: var(--shadow-sm);
}

.message.own-message .message-content {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-color: var(--accent);
}

.message.system-message .message-content {
    opacity: 0.5;
}

.message-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.375rem;
}

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

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

.message-text {
    line-height: 1.6;
    word-wrap: break-word;
}

.message-reactions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.reaction-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
}

.reaction-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* Message Input */
.message-input-container {
    background: var(--surface);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
    padding: 1rem;
    box-shadow: var(--shadow-md);
}

.input-wrapper {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
}

.message-input {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
    padding: 0.875rem 1rem;
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 0.9375rem;
    resize: none;
    transition: var(--transition);
    max-height: 120px;
}

.message-input:focus {
    outline: none;
    border-color: var(--accent);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.1);
}

.input-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

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

.send-btn {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
    border-radius: var(--border-radius);
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 12px rgba(30, 58, 138, 0.3);
}

.send-btn:hover:not(:disabled) {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 20px rgba(30, 58, 138, 0.4);
}

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

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

.typing-indicator:empty {
    display: none;
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease-out;
}

.modal-overlay.hidden {
    display: none;
}

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

.modal-content {
    background: var(--background);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease-out;
}

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

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: var(--text);
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    transition: var(--transition);
}

.modal-close:hover {
    transform: rotate(90deg);
}

.modal-content h2 {
    font-family: var(--font-serif);
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.tutorial-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.tutorial-step {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1rem;
    background: var(--surface);
    border-radius: var(--border-radius);
}

.step-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.tutorial-step h3 {
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.tutorial-step p {
    color: var(--text-muted);
    font-size: 0.875rem;
    line-height: 1.5;
}

.guidelines-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.guideline-item {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: var(--surface);
    border-radius: var(--border-radius);
}

.guideline-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.guideline-item strong {
    display: block;
    margin-bottom: 0.25rem;
}

.guideline-item p {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.btn-primary {
    width: 100%;
    padding: 0.875rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
    border-radius: var(--border-radius);
    color: var(--text);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 12px rgba(30, 58, 138, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(30, 58, 138, 0.4);
}

/* Responsive Design */
@media (max-width: 768px) {
    .app-container {
        padding: 0.5rem;
    }

    .header-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .app-title {
        font-size: 1.5rem;
    }

    .room-btn {
        padding: 0.625rem 1rem;
    }

    .room-name {
        display: none;
    }

    .message-content {
        max-width: 85%;
    }

    .message-input-container {
        padding: 0.75rem;
    }

    .modal-content {
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .brand-title {
        font-size: 2rem;
    }

    .empty-state h2 {
        font-size: 1.5rem;
    }

    .room-btn {
        padding: 0.625rem;
        font-size: 1.25rem;
    }

    .message-input {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus States */
button:focus,
textarea:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Selection */
::selection {
    background: var(--accent);
    color: var(--text);
}
