/* URR Chat - Apple Design System & Base Styles */
:root {
    --primary: #7C3AED;
    --primary-600: #6D28D9;
    --primary-light: rgba(124, 58, 237, 0.15);
    --bg: #0b0f19;
    --bg-2: #151d2a;
    --bg-3: #1e293b;
    --text: #f8fafc;
    --muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.12);
    --danger: #ef4444;
    --success: #10b981;
    --radius: 12px;
    --radius-lg: 18px;
    --shadow: 0 12px 32px -4px rgba(0, 0, 0, 0.45);
    --shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.25);
    
    /* Apple Spring Easing & Motion Tokens */
    --ease-spring: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-bounce: cubic-bezier(0.34, 1.45, 0.64, 1);
    --ease-fast: cubic-bezier(0.2, 0, 0, 1);
    --transition: 0.25s var(--ease-spring);
    --transition-fast: 0.1s var(--ease-fast);
    
    /* Apple Translucency & Glass Tokens */
    --glass-bg: rgba(15, 23, 42, 0.75);
    --glass-bg-hover: rgba(30, 41, 59, 0.85);
    --glass-border: rgba(255, 255, 255, 0.12);
    --glass-highlight: rgba(255, 255, 255, 0.08);
    --glass-blur: blur(20px) saturate(180%);
}

html[data-theme="light"] {
    --bg: #f1f5f9;
    --bg-2: #ffffff;
    --bg-3: #e2e8f0;
    --text: #0f172a;
    --muted: #64748b;
    --border: rgba(0, 0, 0, 0.08);
    --shadow: 0 12px 32px -4px rgba(15, 23, 42, 0.1);
    --shadow-sm: 0 4px 16px rgba(15, 23, 42, 0.06);
    
    --glass-bg: rgba(255, 255, 255, 0.78);
    --glass-bg-hover: rgba(255, 255, 255, 0.9);
    --glass-border: rgba(0, 0, 0, 0.08);
    --glass-highlight: rgba(255, 255, 255, 0.6);
}

* {
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

html, body {
    margin: 0;
    padding: 0;
    font-size: 15px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
    letter-spacing: -0.01em;
}

/* Typography Hierarchy - Apple Optical Sizing & Tracking */
h1, h2, h3, h4, h5, h6 {
    letter-spacing: -0.022em;
    font-weight: 700;
    line-height: 1.2;
    margin-top: 0;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: opacity var(--transition-fast);
}
a:hover {
    opacity: 0.85;
    text-decoration: none;
}

/* Apple Buttons & Touch Controls */
button, .btn-primary, .btn-ghost, .btn-danger {
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    border-radius: var(--radius);
    padding: 0.6rem 1rem;
    border: 1px solid transparent;
    transition: transform var(--transition-fast), background-color var(--transition), border-color var(--transition), box-shadow var(--transition);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* Response: Kill Latency on pointer-down / :active */
button:active, .btn-primary:active, .btn-ghost:active, .btn-danger:active {
    transform: scale(0.96);
}

.btn-primary {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 2px 10px rgba(124, 58, 237, 0.35);
}
.btn-primary:hover {
    background: var(--primary-600);
    box-shadow: 0 4px 14px rgba(124, 58, 237, 0.45);
}

.btn-ghost {
    background: transparent;
    color: var(--text);
    border-color: var(--border);
}
.btn-ghost:hover {
    background: var(--glass-highlight);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-danger {
    background: transparent;
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.3);
}
.btn-danger:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: var(--danger);
}

/* Form Inputs & Focus Rings */
input[type=text], input[type=email], input[type=password], input[type=number], select, textarea {
    font: inherit;
    padding: 0.65rem 0.85rem;
    border-radius: var(--radius);
    background: var(--bg-2);
    border: 1px solid var(--border);
    color: var(--text);
    outline: none;
    width: 100%;
    transition: border-color var(--transition), box-shadow var(--transition), background-color var(--transition);
}
input:focus, select:focus, textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
    background: var(--bg-3);
}

/* Alerts */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    margin: 0.75rem 0;
    font-size: 0.9rem;
    font-weight: 500;
    backdrop-filter: blur(10px);
}
.alert.error {
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}
.alert.success {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #6ee7b7;
}

/* Auth Cards */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1.5rem;
    background: radial-gradient(circle at 50% 20%, rgba(124, 58, 237, 0.15) 0%, transparent 60%), var(--bg);
}
.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    padding: 2.2rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
    box-shadow: var(--shadow);
}
.auth-card h1 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}
.auth-card label {
    display: block;
    margin-top: 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--muted);
    letter-spacing: 0.01em;
}
.auth-card button {
    margin-top: 1.4rem;
    width: 100%;
    padding: 0.75rem;
}

.dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 0.5rem;
    vertical-align: middle;
    box-shadow: 0 0 8px currentColor;
}

.hidden, [hidden] { display: none !important; }

/* Accessibility Modes (Apple Design Principle 14) */
@media (prefers-reduced-motion: reduce) {
    *, ::before, ::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    button:active, .btn-primary:active, .btn-ghost:active, .btn-danger:active {
        transform: none !important;
    }
}

@media (prefers-reduced-transparency: reduce) {
    :root {
        --glass-bg: var(--bg-2);
        --glass-blur: none;
    }
    .auth-card, .chat-header {
        backdrop-filter: none !important;
    }
}

