/* ═══════════════════════════════════════════════════════════════════════════
   HelpDeck PWA 3.0 — Design System (Card / Cloud Style)
   ═══════════════════════════════════════════════════════════════════════════ */

:root {
    /* ── Color Palette — Deep Space + Soft Neon ── */
    --bg-base: #0b1120;
    --bg-surface: rgba(17, 25, 45, 0.85);
    --bg-surface-solid: #111930;
    --bg-surface-hover: rgba(30, 45, 75, 0.6);
    --bg-card: rgba(20, 30, 55, 0.65);
    --bg-card-hover: rgba(30, 42, 72, 0.8);
    --bg-card-active: rgba(45, 60, 100, 0.55);
    --bg-input: rgba(8, 14, 30, 0.7);

    --accent-primary: #6366f1;
    --accent-secondary: #818cf8;
    --accent-hover: #4f46e5;
    --accent-glow: rgba(99, 102, 241, 0.35);
    --accent-surface: rgba(99, 102, 241, 0.12);

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-inverse: #0f172a;

    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-card: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.12);
    --border-focus: rgba(99, 102, 241, 0.5);

    --danger: #f43f5e;
    --success: #10b981;
    --warning: #f59e0b;
    --info: #38bdf8;

    --status-new: #f59e0b;
    --status-progress: #6366f1;
    --status-closed: #64748b;

    --radius-xs: 6px;
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --radius-full: 9999px;

    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.25), 0 0 1px rgba(255, 255, 255, 0.05);
    --shadow-card-hover: 0 8px 24px rgba(0, 0, 0, 0.4), 0 0 1px rgba(255, 255, 255, 0.08);
    --shadow-float: 0 12px 40px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 24px var(--accent-glow);
    --shadow-inset: inset 0 1px 0 rgba(255, 255, 255, 0.04);

    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);

    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
}

/* ── Reset ── */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
    overscroll-behavior: none;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#app-root {
    height: 100%;
    width: 100%;
    display: flex;
    flex-direction: column;
}

/* ── Animated Background ── */
.mesh-bg {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    background: var(--bg-base);
}

.blob {
    position: absolute;
    filter: blur(100px);
    border-radius: 50%;
    opacity: 0.3;
    animation: float 25s infinite ease-in-out alternate;
    will-change: transform;
}

.blob-1 {
    width: 500px; height: 500px;
    background: linear-gradient(135deg, #3b82f6, #6366f1);
    top: -150px; left: -150px;
}

.blob-2 {
    width: 600px; height: 600px;
    background: linear-gradient(135deg, #8b5cf6, #a78bfa);
    bottom: -200px; right: -150px;
    animation-delay: -7s;
}

.blob-3 {
    width: 350px; height: 350px;
    background: linear-gradient(135deg, #06b6d4, #0ea5e9);
    top: 45%; left: 25%;
    animation-delay: -14s;
}

@keyframes float {
    0%   { transform: translate(0, 0) scale(1); }
    33%  { transform: translate(60px, -40px) scale(1.08); }
    66%  { transform: translate(-40px, 50px) scale(0.92); }
    100% { transform: translate(0, 0) scale(1); }
}

/* ── App Root & View Transitions ── */
#app-root {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
}

.view-enter {
    animation: viewEnter 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.view-exit {
    animation: viewExit 0.25s cubic-bezier(0.4, 0, 1, 1) forwards;
}

@keyframes viewEnter {
    from { opacity: 0; transform: translateY(16px) scale(0.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes viewExit {
    from { opacity: 1; transform: translateY(0) scale(1); }
    to   { opacity: 0; transform: translateY(-12px) scale(0.98); }
}

/* ── Glass Panel ── */
.glass-panel {
    background: var(--bg-surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-float), var(--shadow-inset);
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 14px;
    border: none;
    cursor: pointer;
    transition: all var(--transition-smooth);
    outline: none;
    user-select: none;
    position: relative;
    overflow: hidden;
}

.btn:active { transform: scale(0.96); }

.btn-primary {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-hover));
    color: white;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover {
    box-shadow: 0 6px 24px rgba(99, 102, 241, 0.45);
    transform: translateY(-1px);
}

.btn-ghost {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-strong);
}

.btn-ghost:hover { background: var(--bg-surface-hover); }

.btn-danger {
    background: linear-gradient(135deg, var(--danger), #e11d48);
    color: white;
    box-shadow: 0 4px 16px rgba(244, 63, 94, 0.3);
}

.btn-success {
    background: linear-gradient(135deg, var(--success), #059669);
    color: white;
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.3);
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
    border-radius: var(--radius-sm);
}

/* ── Inputs ── */
.input-field {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-strong);
    color: var(--text-primary);
    border-radius: var(--radius-md);
    padding: 13px 16px;
    font-size: 15px;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    outline: none;
    font-family: inherit;
}

.input-field:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.input-field::placeholder { color: var(--text-muted); }

/* ── Role Selection Screen ── */
.role-selection {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 24px;
    gap: 32px;
}

.app-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.logo-icon-wrapper {
    width: 80px; height: 80px;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-glow);
    animation: logoFloat 4s ease-in-out infinite;
}

@keyframes logoFloat {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-6px); }
}

.logo-icon-wrapper svg { width: 40px; height: 40px; color: white; }

.app-logo h1 {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #f1f5f9, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.app-logo p { color: var(--text-secondary); font-size: 16px; }

.role-cards {
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 100%;
    max-width: 400px;
}

.role-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-bounce);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-card);
}

.role-card::before {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.06), transparent);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.role-card:hover {
    transform: translateY(-3px) scale(1.01);
    box-shadow: var(--shadow-card-hover);
    border-color: var(--border-strong);
}

.role-card:hover::before { opacity: 1; }

.role-icon {
    width: 48px; height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.role-card.admin .role-icon {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
}

.role-card.employee .role-icon {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
}

.role-info h3 { font-size: 17px; font-weight: 600; margin-bottom: 2px; }
.role-info p  { font-size: 13px; color: var(--text-secondary); }

/* ── Login Screen ── */
.login-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 24px;
}

.login-form {
    width: 100%;
    max-width: 400px;
    padding: 32px 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.back-link {
    align-self: flex-start;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    margin-bottom: 8px;
    transition: color var(--transition-fast);
}

.back-link:hover { color: var(--text-primary); }

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.custom-select-wrapper { position: relative; }

.custom-select {
    width: 100%;
    padding: 13px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 15px;
    appearance: none;
    cursor: pointer;
    outline: none;
    font-family: inherit;
}

.custom-select:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.select-arrow {
    position: absolute;
    right: 16px; top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--text-secondary);
}

.error-msg {
    color: var(--danger);
    font-size: 13px;
    background: rgba(244, 63, 94, 0.1);
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    display: none;
    animation: viewEnter 0.2s ease-out;
    border: 1px solid rgba(244, 63, 94, 0.2);
}

.error-msg.show { display: block; }

/* ── Toasts ── */
#toast-container {
    position: fixed;
    top: calc(24px + var(--safe-top));
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    pointer-events: none;
}

.toast {
    background: var(--bg-surface-solid);
    color: var(--text-primary);
    padding: 12px 20px;
    border-radius: var(--radius-full);
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-float);
    border: 1px solid var(--border-strong);
    animation: viewEnter 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    pointer-events: auto;
    backdrop-filter: blur(12px);
}

.toast.error {
    background: linear-gradient(135deg, var(--danger), #e11d48);
    color: white;
    border: none;
}

.toast.success {
    background: linear-gradient(135deg, var(--success), #059669);
    color: white;
    border: none;
}

/* ── Spinner ── */
.spinner {
    width: 20px; height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Install Banner ── */
.install-banner {
    position: fixed;
    bottom: calc(16px + var(--safe-bottom));
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    animation: viewEnter 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.install-banner-content {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: var(--bg-surface-solid);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-float);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    backdrop-filter: blur(12px);
    white-space: nowrap;
}

.install-icon {
    color: var(--accent-secondary);
    display: flex;
    align-items: center;
}</

.update-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: white;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 2px 12px rgba(99,102,241,0.4);
}
.update-bar .btn {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    padding: 6px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
}
.update-bar .btn:hover {
    background: rgba(255,255,255,0.3);
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}


@media (display-mode: standalone) {
  .install-banner { display: none !important; }
}
