/*
 * File: /Users/zaido/Desktop/mr-companion/static/css/style.css
 * Shared mobile-app theme for login, register, user, and admin templates.
 */
:root {
    /* Theme tokens */
    --bg: #f2f0eb;
    --bg-accent: #e3e6ea;
    --shell: #efefef;
    --screen: #c9c9cb;
    --card: #ffffff;
    --card-soft: #f4f5f7;
    --accent: #fbfdba;
    --accent-strong: #eef6a8;
    --ink: #202124;
    --muted: #6f737b;
    --border: rgba(32, 33, 36, 0.08);
    --shadow: 0 24px 50px rgba(32, 33, 36, 0.12);
    --radius-shell: 36px;
    --radius-card: 22px;
    --radius-pill: 999px;
    --font-ui: "Avenir Next", "Nunito Sans", "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    /* Global page background and base typography */
    font-family: var(--font-ui);
    color: var(--ink);
    font-size: 15px;
    background:
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.95), transparent 32%),
        linear-gradient(180deg, #f8f6f1 0%, #eceae4 100%);
}

a {
    color: inherit;
}

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

/* Outer page framing for phone-sized screens and the wider admin canvas */
.app-bg {
    min-height: 100vh;
    padding: 28px 16px 48px;
}

.phone-page {
    width: min(100%, 430px);
    margin: 0 auto;
}

.admin-page {
    width: min(100%, 1120px);
    margin: 0 auto;
}

.page-crumb {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #303236;
    font-size: 1.05rem;
    margin: 4px 12px 14px;
}

/* Simulated device chrome used by login, register, and user pages */
.device-shell {
    position: relative;
    border-radius: calc(var(--radius-shell) + 10px);
    padding: 12px;
    background: linear-gradient(180deg, #f8f8f8 0%, #ececec 100%);
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.9);
}

.device-shell::before {
    content: "";
    position: absolute;
    top: 10px;
    left: 50%;
    width: 112px;
    height: 18px;
    transform: translateX(-50%);
    border-radius: 0 0 18px 18px;
    background: rgba(0, 0, 0, 0.08);
}

.device-screen {
    min-height: calc(100vh - 120px);
    border-radius: var(--radius-shell);
    background: linear-gradient(180deg, #cfcfd1 0%, #c4c4c6 100%);
    padding: 18px 14px 20px;
    overflow: hidden;
}

/* Admin-specific shell styles widen the dashboard for tablet and laptop use */
.admin-app-bg {
    padding: 32px 24px 48px;
}

.admin-shell {
    border-radius: 32px;
    padding: 18px;
    background:
        radial-gradient(circle at top right, rgba(251, 253, 186, 0.55), transparent 28%),
        linear-gradient(180deg, #f9f9f8 0%, #ececeb 100%);
    box-shadow: 0 28px 64px rgba(32, 33, 36, 0.14);
    border: 1px solid rgba(255, 255, 255, 0.85);
}

.admin-screen {
    min-height: calc(100vh - 140px);
    border-radius: 24px;
    background: linear-gradient(180deg, #d4d7dc 0%, #c7cbd2 100%);
    padding: 24px;
}

/* Shared header and brand area, including the reusable image-based logo */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: rgba(255, 255, 255, 0.92);
    border-radius: 18px;
    padding: 14px 16px;
    margin-bottom: 16px;
    border: 1px solid rgba(255, 255, 255, 0.85);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    flex: 1;
}

.brand-copy {
    min-width: 0;
    flex: 1;
}

.brand h1,
.brand-title {
    margin: 0;
    font-size: 1.16rem;
    line-height: 1.1;
    white-space: nowrap;
}

.brand-subtitle {
    display: block;
    color: var(--muted);
    font-size: 0.72rem;
    margin-top: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.brand-mark {
    width: 42px;
    height: 42px;
    border-radius: 14px;
    background: linear-gradient(180deg, #fffef8 0%, #f4f5f7 100%);
    display: grid;
    place-items: center;
    box-shadow: inset 0 0 0 1px rgba(32, 33, 36, 0.08);
    flex-shrink: 0;
}

.brand-mark svg {
    width: 26px;
    height: 26px;
    fill: #121316;
}

.brand-logo {
    width: 26px;
    height: 26px;
    object-fit: contain;
    display: block;
}

/* Header actions and navigation buttons */
.header-actions,
.header-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.icon-btn,
.nav-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    min-height: 38px;
    padding: 0 12px;
    border-radius: 14px;
    background: var(--card-soft);
    text-decoration: none;
    color: #26282d;
    border: 1px solid transparent;
    font-size: 0.82rem;
}

.nav-link {
    white-space: nowrap;
}

.nav-link.active,
.icon-btn:hover,
.nav-link:hover {
    border-color: rgba(32, 33, 36, 0.08);
}

/* Tab navigation */
.top-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 16px;
}

.admin-screen .top-tabs {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.tab-btn {
    border: 0;
    border-radius: 14px;
    padding: 11px 12px;
    background: rgba(255, 255, 255, 0.54);
    color: #44474d;
    cursor: pointer;
    font-size: 0.8rem;
}

.tab-btn.active {
    background: var(--accent);
    color: #191b1f;
    font-weight: 700;
}

/* Main content wrappers and tab visibility */
.app-main {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Card system used for hero sections, forms, and content blocks */
.hero-card,
.card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: var(--radius-card);
    border: 1px solid var(--border);
    padding: 18px;
    margin-bottom: 14px;
    box-shadow: 0 12px 24px rgba(32, 33, 36, 0.05);
}

.hero-card {
    background: linear-gradient(135deg, #fdffd2 0%, #f4f8c0 100%);
}

.hero-card.split {
    display: grid;
    grid-template-columns: 1.45fr 0.95fr;
    gap: 12px;
    align-items: center;
}

.hero-card.centered {
    text-align: center;
}

.hero-card h2,
.card h2,
.card h3 {
    margin: 0 0 10px;
    font-size: 1rem;
}

.hero-card h2 {
    font-size: 1.18rem;
    line-height: 1.2;
}

.hero-card p,
.card p,
.muted {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
    font-size: 0.9rem;
}

.muted.strong {
    color: #36393f;
}

.hero-figure {
    display: flex;
    align-items: center;
    justify-content: center;
}

.illustration-panel {
    width: 100%;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.64);
    padding: 16px;
    display: grid;
    place-items: center;
}

.illustration-panel svg {
    width: 100%;
    max-width: 160px;
    height: auto;
}

.hero-image {
    width: 100%;
    max-width: 180px;
    height: auto;
    display: block;
}

.setup-illustration-panel {
    max-width: 150px;
    margin: 0 auto 14px;
}

.setup-hero-image {
    max-width: 130px;
    margin: 0 auto;
}

/* Grid helpers for stats, plan cards, and compact content blocks */
.card-grid,
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.admin-screen .stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.admin-screen .card,
.admin-screen .hero-card {
    padding: 22px;
}

.admin-screen .app-main {
    gap: 18px;
}

.admin-screen .data-table {
    font-size: 0.88rem;
}

.admin-screen .data-table th,
.admin-screen .data-table td {
    padding: 12px 10px;
}

.plan-grid {
    grid-template-columns: 1fr;
}

.stat-card,
.mini-card {
    min-height: 120px;
}

.stat-number {
    display: block;
    font-size: 1.5rem;
    font-weight: 800;
    margin-bottom: 6px;
}

.stat-label,
.eyebrow {
    font-size: 0.8rem;
    color: var(--muted);
}

.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.section-title h2,
.section-title h3 {
    margin: 0;
}

.inline-note {
    font-size: 0.82rem;
    color: var(--muted);
}

.status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    color: #1e2126;
}

.status::before {
    content: "";
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: #adb0b7;
}

.status.active::before,
.status.online::before {
    background: #2fa164;
}

.status.offline::before {
    background: #d96b5c;
}

.status.pairing::before {
    background: #f2b34c;
}

.tip-list,
.feature-list {
    padding-left: 18px;
    margin: 10px 0 0;
    color: var(--muted);
}

.feature-list li,
.tip-list li {
    margin-bottom: 8px;
}

/* Forms and inputs */
.form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 0.86rem;
    font-weight: 700;
    color: #2e3136;
}

.input-icon {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #23252b;
    margin-bottom: -2px;
}

.input-icon svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    border: 1px solid rgba(32, 33, 36, 0.08);
    background: #fff;
    padding: 12px 14px;
    border-radius: 14px;
    color: var(--ink);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
    font-size: 0.92rem;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: #a1a7b4;
}

.password-hint,
.register-error,
.register-success,
.login-error {
    font-size: 0.86rem;
}

.register-error,
.login-error {
    color: #c54435;
    display: none;
}

.register-success {
    color: #257950;
    display: none;
}

.role-toggle {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.role-toggle button {
    border: 0;
    border-radius: 16px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.65);
    cursor: pointer;
    color: #464951;
}

.role-toggle button.active {
    background: var(--accent);
    color: #1a1c20;
    font-weight: 800;
}

/* Buttons */
.actions,
.stack-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 40px;
}

.auth-actions {
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
}

.auth-actions .btn {
    width: 100%;
    max-width: 240px;
    padding: 0 20px;
}

.block-form .form-group {
    width: 100%;
}

.auth-helper {
    display: block;
    max-width: 280px;
    text-align: center;
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.45;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 14px;
    min-height: 48px;
    padding: 0 18px;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
    text-decoration: none;
    font-size: 0.88rem;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-primary {
    background: var(--accent);
    color: #1a1c20;
    box-shadow: 0 10px 20px rgba(238, 246, 168, 0.45);
}

.btn-secondary {
    background: #edf0f4;
    color: #25282e;
}

.btn-danger {
    background: #d85f51;
    color: #fff;
}

.btn-ghost {
    background: transparent;
    color: #36393f;
    border: 1px solid rgba(32, 33, 36, 0.1);
}

/* Pricing and badges */
.plan-card.featured {
    background: linear-gradient(180deg, #fffff5 0%, #fbfdcb 100%);
}

.plan-price {
    font-size: 1.5rem;
    font-weight: 800;
    margin: 10px 0 14px;
    color: #191b1f;
}

.plan-price span {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--muted);
}

.badge,
.admin-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-pill);
    padding: 4px 10px;
    background: var(--accent);
    font-size: 0.74rem;
    font-weight: 800;
    color: #23252a;
}

.admin-badge {
    margin-left: 8px;
}

/* Tables and data display */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.84rem;
}

.data-table th,
.data-table td {
    text-align: left;
    padding: 10px 8px;
    border-bottom: 1px solid rgba(32, 33, 36, 0.08);
}

.data-table th {
    color: #565b63;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.table-scroll {
    overflow-x: auto;
}

.center {
    text-align: center;
}

/* Emergency alert UI */
.alert-card {
    background: linear-gradient(180deg, #fff8f6 0%, #ffffff 100%);
}

.countdown {
    text-align: center;
    padding: 16px 0 18px;
}

.countdown-number {
    display: block;
    font-size: 2.7rem;
    font-weight: 800;
    color: #d85f51;
}

.countdown-label {
    color: var(--muted);
}

/* Footer and small helper sections */
.footer-pager {
    margin-top: 18px;
    display: flex;
    justify-content: center;
}

.pager-pill {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 10px 18px;
    background: rgba(255, 255, 255, 0.74);
    border-radius: var(--radius-pill);
    color: #36393f;
    font-weight: 700;
}

.pager-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #17191d;
}

.auth-links {
    margin-top: 12px;
    text-align: center;
    color: #555a62;
}

.auth-links a {
    font-weight: 700;
    text-decoration: none;
}

.screen-section {
    margin-bottom: 14px;
}

/* Mobile-specific tightening for small screens */
@media (max-width: 520px) {
    .app-bg {
        padding: 12px 10px 28px;
    }

    .device-shell {
        padding: 10px;
    }

    .device-screen {
        min-height: calc(100vh - 56px);
        padding: 16px 12px 18px;
    }

    .hero-card.split,
    .form-row,
    .card-grid,
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .top-tabs {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .header-nav {
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .brand h1,
    .brand-title {
        font-size: 1.05rem;
    }
}

@media (max-width: 900px) {
    .admin-app-bg {
        padding: 18px 12px 32px;
    }

    .admin-screen {
        padding: 18px 16px;
    }

    .admin-screen .top-tabs {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .admin-screen .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}
