/* ===============================================
   CIPHER — GLOBAL SYSTEM
   Variables, Reset, Base Styles
   =============================================== */

/* SYSTEM VARIABLES */
:root {
    /* Colors */
    --bg-dark: #030811;
    --bg-deep-space: #000000;
    --bg-bright-space: #0f0f1a;
    
    --primary-blue: #689be6;
    --primary-blue-glow: rgba(255, 255, 255, 0.5);
    
    --glass-bg: rgba(255, 255, 255, 0.08);
    --glass-border: rgba(255, 255, 255, 0.2);
    
    --text-primary: #ffffff;
    --text-muted: rgba(255, 255, 255, 0.5);
    --text-secondary: rgba(255, 255, 255, 0.7);
    
    --status-online: #51cf66;
    --status-away: #f59e0b;
    --text-error: #ff6b6b;
    
    /* Glass effects */
    --glass-blur: 30px;
    --glass-blur-intense: 45px;
    --glass-saturation: 200%;
    --glass-contrast: 110%;
    
    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    
    /* Border radius */
    --radius-lg: 28px;
    --radius-md: 12px;
    --radius-sm: 8px;
    --radius-pill: 9999px;
    
    /* Animations */
    --trans-fast: 0.15s ease;
    --trans-normal: 0.3s ease;
    --trans-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Typography — System Apple fonts */
    --font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, sans-serif;

    --font-size-xs: 11px;
    --font-size-sm: 12px;
    --font-size-md: 14px;
    --font-size-lg: 16px;
    --font-size-xl: 18px;
    --font-size-3xl: 24px;
    
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;
    
    --letter-spacing-tight: -0.02em;
    
    /* Z-index system */
    --z-auth-screen: 50;
    --z-background: 0;
    --z-base: 1;
    --z-sticky: 100;
    --z-dropdown: 200;
    --z-overlay: 350;
    --z-modal: 500;
    --z-floating-panel: 600;
    --z-toast: 700;
    --z-spotlight: 800;
    --z-notification: 900;
    
    /* Shadows */
    --shadow-glass: rgba(0, 0, 0, 0.3);
    --shadow-glow: rgba(255, 255, 255, 0.3);
    
    /* Component sizes */
    --avatar-size-sm: 40px;
    --avatar-size-md: 48px;
    --sidebar-width: 75px;
}

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

html, body {
    height: 100%;
    font-family: var(--font-family);
    background: #000;
    color: var(--text-primary);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* UTILITY */
.is-hidden {
    display: none !important;
}

/* SCROLLBARS */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-blue);
}

/* BODY STATES */
body {
    font-size: 14px;
    line-height: 1.5;
}

/* Auth state */
body.state-auth #auth-screen {
    display: flex;
}

/* App state */
body.state-app #app-interface {
    display: flex;
}

/* Base hidden */
#auth-screen,
#app-interface {
    display: none;
}

/* FOCUS ACCESSIBILITY */
:focus-visible {
    outline: 2px solid var(--primary-blue);
    outline-offset: 2px;
}

/* SPOTLIGHT RESULT ITEMS */
.spotlight-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.spotlight-result-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

/* MESSAGE DATE SEPARATOR */
.message-date-separator {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 20px 0;
    padding: 0 16px;
}

.message-date-separator::before,
.message-date-separator::after {
    content: '';
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
}

.message-date-separator span {
    padding: 0 16px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    font-family: var(--font-family);
}

/* NOTIFICATION TOASTS */
.notification {
    position: fixed;
    bottom: 30px;
    right: 30px;
    padding: 14px 24px;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 500;
    font-family: var(--font-family);
    z-index: var(--z-notification);
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
}

.notification.show {
    opacity: 1;
    transform: translateX(0);
}

.notification.info {
    background: rgba(59, 130, 246, 0.9);
}

.notification.success {
    background: rgba(16, 185, 129, 0.9);
}

.notification.error {
    background: rgba(239, 68, 68, 0.9);
}

/* MESSAGE POSITION CLASSES */
.message.msg-single {
    margin-bottom: 4px;
}

.message.msg-start {
    margin-bottom: 2px;
}

.message.msg-mid {
    margin-bottom: 2px;
}

.message.msg-end {
    margin-bottom: 8px;
}

/* CHAT ITEM UNREAD */
.chat-item.has-unread {
    background: rgba(104, 155, 230, 0.1);
}

/* ONLINE INDICATOR */
.online-indicator.is-online {
    background: var(--status-online);
    box-shadow: 0 0 8px rgba(81, 207, 102, 0.5);
}

/* TYPING INDICATOR */
.typing-indicator-text {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
    font-family: var(--font-family);
}

/* AUTH HINT */
.auth-hint {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.4);
    margin-top: 24px;
    font-family: var(--font-family);
}