/* ========================================================================
   Pfizer Portal — site styles
   Brand palette inspired by the main StreamCart site, with Pfizer blue accent.
   ======================================================================== */

:root {
    --brand-primary: #0093D0;     /* Pfizer blue */
    --brand-primary-dark: #0073A8;
    --brand-accent: #4a90d9;
    --brand-bg: #f4f7fb;
    --brand-surface: #ffffff;
    --brand-text: #1f2933;
    --brand-text-muted: #62707d;
    --brand-border: #e1e7ee;
    --brand-error-bg: #ffe0e0;
    --brand-error-fg: #c00;
    --brand-success-bg: #e0ffe0;
    --brand-success-fg: #0a7f3f;
    --brand-info-bg: #e0f0ff;
    --brand-info-fg: #0a4d8a;
    --brand-radius: 10px;
    --brand-shadow: 0 10px 30px rgba(0, 87, 130, 0.12);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: "Roboto", "PT Sans", Arial, sans-serif;
    background: var(--brand-bg);
    color: var(--brand-text);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

a { color: var(--brand-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; height: auto; }

/* ---------- Auth (login / OTP) layout ---------- */

.auth-wrapper {
    display: flex;
    min-height: 100vh;
    background: var(--brand-bg);
}

.auth-left {
    flex: 1 1 50%;
    background: linear-gradient(160deg, #1a1d24 0%, #0f1116 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px;
    position: relative;
    overflow: hidden;
}

.auth-left::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 20% 80%, rgba(0, 147, 208, 0.18), transparent 60%),
                radial-gradient(circle at 80% 20%, rgba(0, 147, 208, 0.10), transparent 55%);
    pointer-events: none;
}

.auth-left-inner {
    position: relative;
    z-index: 1;
    max-width: 460px;
}

.auth-logo img {
    height: 48px;
    width: auto;
    margin-bottom: 32px;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.45));
}

.auth-headline {
    font-size: 36px;
    line-height: 1.2;
    font-weight: 500;
    margin: 0 0 16px;
}
.auth-headline span { font-weight: 700; }

.auth-sub {
    font-size: 16px;
    line-height: 1.5;
    opacity: 0.92;
    margin: 0;
}

.auth-right {
    flex: 1 1 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
}

.auth-card {
    background: var(--brand-surface);
    width: 100%;
    max-width: 420px;
    padding: 40px 36px;
    border-radius: var(--brand-radius);
    box-shadow: var(--brand-shadow);
}

.auth-card-title {
    font-size: 24px;
    font-weight: 600;
    margin: 0 0 6px;
    color: var(--brand-text);
}

.auth-card-sub {
    font-size: 14px;
    color: var(--brand-text-muted);
    margin: 0 0 24px;
}

.auth-form .form-group { margin-bottom: 18px; }

.auth-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--brand-text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.auth-input {
    width: 100%;
    height: 46px;
    padding: 0 14px;
    border: 1.5px solid var(--brand-border);
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    color: var(--brand-text);
    background: #fff;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}

.auth-input:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(0, 147, 208, 0.15);
}

.auth-otp {
    text-align: center;
    letter-spacing: 10px;
    font-size: 22px;
    font-weight: 600;
    padding-left: 24px;
}

/* 6-digit OTP entry (mirrors StreamCart) */
.otp-input-group {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin: 6px 0 4px;
}

.otp-input {
    width: 46px;
    height: 56px;
    text-align: center;
    font-size: 24px;
    font-weight: 700;
    color: var(--brand-text);
    background: #fff;
    border: 2px solid var(--brand-border);
    border-radius: 10px;
    outline: none;
    padding: 0;
    box-sizing: border-box;
    flex-shrink: 0;
    transition: border-color 0.15s, box-shadow 0.15s;
    -moz-appearance: textfield;
}

.otp-input::-webkit-outer-spin-button,
.otp-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.otp-input:focus {
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px rgba(0, 147, 208, 0.18);
}

@media (max-width: 420px) {
    .otp-input { width: 40px; height: 50px; font-size: 20px; }
    .otp-input-group { gap: 6px; }
}

.auth-field-error {
    display: block;
    color: var(--brand-error-fg);
    font-size: 13px;
    margin-top: 6px;
}

.auth-message {
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 14px;
    margin-bottom: 18px;
}
.auth-message.error  { background: var(--brand-error-bg);   color: var(--brand-error-fg); }
.auth-message.success { background: var(--brand-success-bg); color: var(--brand-success-fg); }
.auth-message.info   { background: var(--brand-info-bg);    color: var(--brand-info-fg); }

.auth-message ul { margin: 0; padding-left: 18px; }

.auth-btn {
    display: inline-block;
    width: 100%;
    padding: 13px 16px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background-color .15s, color .15s, transform .05s;
}

.auth-btn:active { transform: translateY(1px); }
.auth-btn,
.auth-btn:hover,
.auth-btn:focus,
.auth-btn:visited { text-decoration: none; }

.auth-btn-primary {
    background: var(--brand-primary);
    color: #fff;
}
.auth-btn-primary:hover,
.auth-btn-primary:focus,
.auth-btn-primary:active {
    background: var(--brand-primary-dark);
    color: #fff;
}

.auth-btn-link {
    background: transparent;
    color: var(--brand-primary);
    font-weight: 500;
    padding: 8px 0;
    width: auto;
    text-decoration: underline;
}
.auth-btn-link:hover,
.auth-btn-link:focus { color: var(--brand-primary-dark); text-decoration: underline; }

.auth-btn-ghost {
    background: transparent;
    color: var(--brand-primary);
    border: 1.5px solid var(--brand-border);
    width: auto;
    padding: 8px 16px;
    font-size: 14px;
}
.auth-btn-ghost:hover,
.auth-btn-ghost:focus {
    border-color: var(--brand-primary);
    background: rgba(0,147,208,0.08);
    color: var(--brand-primary-dark);
}

.auth-form-inline {
    margin-top: 8px;
    text-align: center;
}

.auth-footnote {
    margin-top: 24px;
    text-align: center;
    font-size: 13px;
    color: var(--brand-text-muted);
}

/* ---------- App shell (dashboard) ---------- */

.app-topbar {
    position: relative;
    background: linear-gradient(160deg, #1a1d24 0%, #0f1116 100%);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    box-shadow: 0 1px 0 rgba(0,0,0,0.4);
    overflow: hidden;
}
.app-topbar::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 20% 80%, rgba(0, 147, 208, 0.18), transparent 60%),
                radial-gradient(circle at 80% 20%, rgba(0, 147, 208, 0.10), transparent 55%);
    pointer-events: none;
}

.app-topbar-inner {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.app-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 18px;
    font-weight: 600;
    color: #fff;
}
.app-brand img {
    width: 200px;
    height: auto;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.45));
}

.app-user {
    display: flex;
    align-items: center;
    gap: 16px;
}
.app-user-name { color: rgba(255,255,255,0.85); font-size: 14px; }
.app-logout-form { margin: 0; }

.app-topbar .auth-btn-ghost,
.app-topbar .app-logout-btn {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.25);
    color: #fff;
}
.app-topbar .auth-btn-ghost:hover,
.app-topbar .app-logout-btn:hover {
    background: rgba(255,255,255,0.08);
    border-color: rgba(255,255,255,0.4);
}

.app-role-badge {
    display: inline-block;
    padding: 3px 10px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
    color: rgba(255,255,255,0.9);
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 999px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.app-role-badge.app-role-admin {
    color: #fff;
    background: var(--brand-primary);
    border-color: transparent;
}
.app-role-badge.app-role-disabled {
    color: #fff;
    background: #c0392b;
    border-color: transparent;
}
.app-role-badge.app-role-pending {
    color: #fff;
    background: #d68910;
    border-color: transparent;
}

/* Loading overlay for slow form submits */
.app-loading-host { position: relative; }
.app-loading-overlay {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 12px;
    background: rgba(255, 255, 255, 0.75);
    z-index: 10;
    border-radius: inherit;
}
.app-loading-host.is-loading .app-loading-overlay { display: flex; }
.app-loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(0, 0, 0, 0.12);
    border-top-color: #2c3e50;
    border-radius: 50%;
    animation: app-spin 0.8s linear infinite;
}
.app-loading-text {
    font-size: 13px;
    color: #333;
}
@keyframes app-spin { to { transform: rotate(360deg); } }

.app-nav-link {
    color: #fff;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    opacity: 0.9;
}
.app-nav-link:hover { opacity: 1; text-decoration: underline; }

.app-topbar .app-nav a {
    color: #fff;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    opacity: 0.9;
    margin-right: 16px;
}
.app-topbar .app-nav a:hover { opacity: 1; text-decoration: underline; }

.app-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}
.app-nav-link {
    display: inline-block;
    padding: 8px 14px;
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    border-radius: 6px;
    transition: background-color .15s, color .15s;
}
.app-nav-link:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
    text-decoration: none;
}
.app-nav-link.active {
    background: var(--brand-primary);
    color: #fff;
}
.app-nav-link.active:hover { background: var(--brand-primary-dark); }

.app-main { padding: 32px 24px; }

.app-container { max-width: 1200px; margin: 0 auto; }
.app-container-narrow { max-width: 720px; }

.app-title { font-size: 28px; font-weight: 600; margin: 0 0 8px; }
.app-sub { color: var(--brand-text-muted); margin: 0 0 32px; }

.app-page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}
.app-page-head .app-sub { margin-bottom: 0; }
.app-page-head .app-title { margin-bottom: 4px; }

.app-page-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
}

.app-import-panel {
    display: none;
    margin: 0 0 20px;
}
.app-import-panel.open { display: block; }
.app-import-row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
.app-import-row .auth-input { max-width: 360px; }

.app-search {
    display: flex;
    gap: 8px;
    align-items: center;
    margin: 0 0 20px;
}
.app-search .auth-input { height: 40px; max-width: 360px; }

/* --- Data table --- */
.app-table-wrap {
    background: var(--brand-surface);
    border: 1px solid var(--brand-border);
    border-radius: var(--brand-radius);
    overflow-x: auto;
    box-shadow: 0 2px 6px rgba(0,0,0,0.03);
}
.app-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.app-table thead th {
    background: #f7f9fc;
    color: var(--brand-text-muted);
    font-weight: 600;
    text-align: left;
    padding: 12px 16px;
    border-bottom: 1px solid var(--brand-border);
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.4px;
    white-space: nowrap;
}
.app-table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--brand-border);
    color: var(--brand-text);
    vertical-align: middle;
}
.app-table tbody tr:last-child td { border-bottom: none; }
.app-table tbody tr:hover { background: #fafcfe; }
.app-table .text-right { text-align: right; white-space: nowrap; }

/* Keep the Actions column visible even when the table needs horizontal scroll. */
.app-table thead th:last-child,
.app-table tbody td:last-child {
    position: sticky;
    right: 0;
    background: var(--brand-surface);
    box-shadow: -6px 0 6px -4px rgba(0,0,0,0.08);
    z-index: 1;
}
.app-table thead th:last-child { background: #f7f9fc; }
.app-table tbody tr:hover td:last-child { background: #fafcfe; }
.app-table-empty {
    text-align: center;
    padding: 32px 16px !important;
    color: var(--brand-text-muted);
}

.app-link {
    color: var(--brand-primary);
    text-decoration: none;
    font-weight: 500;
}
.app-link:hover { text-decoration: underline; }
.app-link-danger { color: var(--brand-error-fg); }
.app-sep { color: var(--brand-border); margin: 0 4px; }

.app-status {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.app-status-on  { background: var(--brand-success-bg); color: var(--brand-success-fg); }
.app-status-off { background: #f1f3f6; color: #62707d; }

.app-role-badge.app-role-employee {
    background: #eef1f5;
    color: #4a5460;
    border: 1px solid #e1e7ee;
}

/* --- Forms --- */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
@media (max-width: 600px) {
    .form-row { grid-template-columns: 1fr; }
}
.form-group-check { display: flex; align-items: flex-end; }
.auth-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--brand-text);
    cursor: pointer;
    user-select: none;
    height: 46px;
}
.auth-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--brand-primary);
    margin: 0;
}

/* --- Pager --- */
.app-pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 16px;
    font-size: 14px;
    color: var(--brand-text-muted);
}
.app-pager-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.app-pager-page {
    padding: 0 10px;
    color: var(--brand-text);
    font-weight: 600;
}

.app-form-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.auth-btn-inline { width: auto; padding: 10px 20px; font-size: 14px; }

.auth-btn-danger {
    background: #c00;
    color: #fff;
}
.auth-btn-danger:hover,
.auth-btn-danger:focus,
.auth-btn-danger:active { background: #a00; color: #fff; }

.app-defs {
    margin: 0 0 24px;
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 10px 16px;
    font-size: 14px;
}
.app-defs dt { color: var(--brand-text-muted); font-weight: 500; }
.app-defs dd { margin: 0; color: var(--brand-text); }

.app-main { padding: 32px 24px; }

.app-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
}

.app-card {
    background: var(--brand-surface);
    border: 1px solid var(--brand-border);
    border-radius: var(--brand-radius);
    padding: 24px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.03);
}
.app-card h3 { margin: 0 0 8px; font-size: 17px; color: var(--brand-primary); }
.app-card p { margin: 0; color: var(--brand-text-muted); font-size: 14px; }
.app-card.placeholder { opacity: 0.85; }

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
    .auth-wrapper { flex-direction: column; }
    .auth-left { padding: 36px 24px; min-height: 220px; flex: 0 0 auto; }
    .auth-headline { font-size: 26px; }
    .auth-logo img { width: 140px; margin-bottom: 16px; }
    .auth-right { padding: 24px 16px; }
    .auth-card { padding: 28px 22px; }
}
