/* ==========================================================================
   Base Styles, Typography, Buttons & Primitives (Linear/Slack Theme)
   ========================================================================== */

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

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
    background-color: var(--bg-app);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    touch-action: manipulation;
}

/* Typography Hierarchy */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    font-weight: 600;
    line-height: 1.25;
}

.page-title {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    margin-bottom: var(--space-24);
    display: flex;
    align-items: center;
    gap: var(--space-12);
}

.section-heading {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: var(--space-12);
}
.section-heading.appearance { color: var(--accent); }
.section-heading.privacy { color: var(--success); }

/* Form Controls & Focus Ring */
input, button, textarea, select {
    font-family: inherit;
    font-size: 14px;
    color: inherit;
    border: none;
    outline: none;
}

:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

/* Thin 8px Scrollbars */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.25);
    border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.4);
}

/* --------------------------------------------------------------------------
   Button Specifications
   -------------------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-8);
    padding: 9px 18px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    transition: all var(--ease-normal);
    user-select: none;
    text-decoration: none;
    min-height: 40px;
}

/* Primary Button: --grad-brand with white text & glow shadow */
.btn-primary {
    background: var(--grad-brand);
    color: #ffffff;
    box-shadow: var(--shadow-glow);
    border: 1px solid rgba(255, 255, 255, 0.15);
}
.btn-primary:hover:not(:disabled) {
    filter: brightness(1.08);
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.45);
}
.btn-primary:active:not(:disabled) {
    transform: scale(0.98);
}

/* Secondary Button: bg-surface-2, border, text-primary */
.btn-secondary {
    background: var(--bg-surface-2);
    color: var(--text-primary);
    border: 1px solid var(--border);
}
.btn-secondary:hover:not(:disabled) {
    border-color: var(--border-strong);
    color: #ffffff;
}

/* Ghost Button: transparent, text-secondary */
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}
.btn-ghost:hover:not(:disabled) {
    background: var(--bg-surface-2);
    color: var(--text-primary);
}

.btn-danger {
    background: var(--danger);
    color: #ffffff;
}
.btn-danger:hover:not(:disabled) {
    filter: brightness(1.1);
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    box-shadow: none;
    transform: none !important;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    background: transparent;
    cursor: pointer;
    transition: all var(--ease-normal);
}
.btn-icon:hover {
    background: var(--bg-surface-2);
    color: var(--text-primary);
}

/* Form Inputs */
.input-field {
    width: 100%;
    padding: 11px 16px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 14px;
    transition: all var(--ease-normal);
}
.input-field:focus {
    border-color: var(--accent);
    box-shadow: var(--focus-ring);
}
.input-field::placeholder {
    color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   Badges & Pills
   -------------------------------------------------------------------------- */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 700;
}
.badge-pill-gradient {
    background: var(--grad-brand);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
}

/* --------------------------------------------------------------------------
   Avatars Specification
   -------------------------------------------------------------------------- */
.avatar-wrap {
    position: relative;
    display: inline-flex;
    flex-shrink: 0;
}

.avatar {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    background: var(--grad-avatar);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
    box-shadow: 0 0 0 2px var(--bg-sidebar);
    user-select: none;
    object-fit: cover;
}

.avatar-lg {
    width: 72px;
    height: 72px;
    font-size: 24px;
    font-weight: 700;
}
.avatar-xl {
    width: 112px;
    height: 112px;
    font-size: 38px;
    font-weight: 700;
    box-shadow: 0 0 0 4px var(--bg-surface);
}
.avatar-sm {
    width: 32px;
    height: 32px;
    font-size: 12px;
    font-weight: 600;
}

.online-dot {
    position: absolute;
    bottom: 0px;
    right: 0px;
    width: 10px;
    height: 10px;
    background: var(--success);
    border: 2px solid var(--bg-sidebar);
    border-radius: var(--radius-full);
}

/* Empty State Primitive */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--space-48) var(--space-24);
    gap: var(--space-12);
}
.empty-state-icon {
    width: 72px;
    height: 72px;
    border-radius: var(--radius-full);
    background: var(--grad-surface);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    margin-bottom: var(--space-8);
}
.empty-state-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}
.empty-state-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    max-width: 320px;
    line-height: 1.5;
}

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