/* ==========================================================================
   JAMRI DESIGN SYSTEM: TOKENS & FOUNDATIONS
   Natural Human Programming Aesthetic - Clean, Precise, Functional.
   Strict Guardrail: Zero AI Emojis in UI elements.
   ========================================================================== */

:root {
    /* Day / Light Theme Default Tokens */
    --bg-base: #f8fafc;
    --bg-surface: #ffffff;
    --bg-surface-elevated: #f1f5f9;
    --bg-surface-hover: #e2e8f0;
    --border-color: #cbd5e1;
    --border-subtle: #e2e8f0;

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;

    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --primary-border: #bfdbfe;

    --success: #16a34a;
    --success-light: #f0fdf4;
    --danger: #dc2626;
    --danger-light: #fef2f2;
    --warning: #d97706;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-full: 9999px;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

    --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

    --player-dock-height: 84px;
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    /* True Neutral Human Developer Dark Theme (No AI blue tint) */
    --bg-base: #0d1117;
    --bg-surface: #161b22;
    --bg-surface-elevated: #21262d;
    --bg-surface-hover: #30363d;
    --border-color: #30363d;
    --border-subtle: #21262d;

    --text-primary: #e6edf3;
    --text-secondary: #8b949e;
    --text-muted: #6e7681;

    --primary: #2f81f7;
    --primary-hover: #388bfd;
    --primary-light: rgba(56, 139, 253, 0.12);
    --primary-border: #388bfd;

    --success: #238636;
    --success-light: rgba(35, 134, 54, 0.15);
    --danger: #da3633;
    --danger-light: rgba(218, 54, 51, 0.15);
    --warning: #d29922;

    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.6);
    --shadow-md: 0 4px 8px -2px rgb(0 0 0 / 0.7);
    --shadow-lg: 0 12px 24px -4px rgb(0 0 0 / 0.85);
}

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

body {
    background-color: var(--bg-base);
    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;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

button, input, select, textarea {
    font: inherit;
    color: inherit;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* ==========================================================================
   BUTTONS & INPUTS
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 13px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
    line-height: 1.2;
    white-space: nowrap;
}

.btn-primary {
    background-color: var(--primary);
    color: #ffffff;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-outline {
    background-color: transparent;
    border-color: var(--border-color);
    color: var(--text-primary);
}

.btn-outline:hover {
    background-color: var(--bg-surface-hover);
    border-color: var(--text-secondary);
}

.btn-ghost {
    background-color: transparent;
    border-color: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background-color: var(--bg-surface-hover);
    color: var(--text-primary);
}

.btn-sm {
    padding: 5px 9px;
    font-size: 12px;
}

.btn-icon {
    padding: 8px;
    border-radius: var(--radius-sm);
}

.btn-success {
    background-color: var(--success) !important;
    color: #ffffff !important;
    border-color: var(--success) !important;
}

.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    padding: 9px 12px;
    background-color: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    transition: border-color var(--transition-fast);
    outline: none;
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.input-hint {
    font-size: 12px;
    margin-top: 5px;
    color: var(--text-muted);
}

.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }

/* ==========================================================================
   BADGES & PILLS
   ========================================================================== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 7px;
    font-size: 11px;
    font-weight: 600;
    border-radius: var(--radius-full);
    background-color: var(--bg-surface-elevated);
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
}

.badge-primary {
    background-color: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary-border);
}

.badge-private {
    background-color: rgba(220, 38, 38, 0.1);
    color: var(--danger);
    border-color: rgba(220, 38, 38, 0.2);
}

/* ==========================================================================
   MODAL DIALOGS
   ========================================================================== */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 9999;
}

.modal-backdrop.active {
    display: flex !important;
}

.modal-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 440px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: modalPopIn 200ms ease-out;
}

.modal-card.modal-lg {
    max-width: 680px;
    max-height: 85vh;
}

@keyframes modalPopIn {
    from {
        opacity: 0;
        transform: scale(0.96) translateY(8px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-subtle);
}

.modal-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
}

.modal-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border-subtle);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background-color: var(--bg-surface-elevated);
}

.btn-close-modal {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 4px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-close-modal:hover {
    color: var(--text-primary);
    background-color: var(--bg-surface-hover);
}

/* ==========================================================================
   USER ONBOARDING EMOJI GRID
   Guardrail: Emoji HANYA untuk Avatar Pengguna
   ========================================================================== */
.emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 8px;
    margin-top: 8px;
}

.emoji-btn {
    font-size: 20px;
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    background-color: var(--bg-surface-elevated);
    cursor: pointer;
    transition: transform var(--transition-fast), border-color var(--transition-fast);
}

.emoji-btn:hover {
    transform: scale(1.1);
    border-color: var(--border-color);
}

.emoji-btn.selected {
    border-color: var(--primary);
    background-color: var(--primary-light);
    box-shadow: 0 0 0 2px var(--primary);
}

/* ==========================================================================
   LOADING SPINNER
   ========================================================================== */
.loading-spinner-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px;
    color: var(--text-muted);
}

.spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--border-subtle);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
}

.empty-icon {
    stroke: var(--text-muted);
}

/* ==========================================================================
   SLIM CUSTOM SCROLLBAR (Natural developer aesthetic)
   ========================================================================== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

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

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: var(--radius-full);
}

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