/* ─── Brand tokens ──────────────────────────────────────── */
:root {
    --brand-coral: #ED7C5C;
    --brand-coral-dark: #D4634A;
    --brand-coral-light: #F5A58E;
    --brand-pink: #F3AEE6;
    --brand-pink-dark: #C86DBF;
    --brand-charcoal: #2D2D2D;
    --brand-surface: #FAF5F3;
    --brand-surface-alt: #FFF5F2;
    --brand-card: #FFFFFF;
    --brand-success: #2D9F5D;
    --brand-success-light: #E8F5E9;
    --brand-danger: #DC3545;
    --brand-danger-light: #F8D7DA;
    --brand-warning: #E6A817;
    --brand-warning-light: #FFF8E1;
    --brand-text: #333333;
    --brand-text-muted: #777777;
    --brand-border: #E8E0DD;
    --brand-sidebar-gradient: linear-gradient(180deg, #ED7C5C 0%, #C86DBF 100%);
    --brand-radius: 16px;
    --brand-radius-sm: 10px;
    --brand-shadow: 0 2px 12px rgba(0,0,0,0.06);
    --brand-shadow-lg: 0 8px 32px rgba(0,0,0,0.10);
}

/* ─── Global ────────────────────────────────────────────── */
html, body {
    font-family: 'Inter', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background-color: var(--brand-surface);
    color: var(--brand-text);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--brand-charcoal);
    font-weight: 700;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.35rem; }

h1:focus { outline: none; }

a, .btn-link {
    color: var(--brand-coral);
}

a:hover {
    color: var(--brand-coral-dark);
}

/* ─── Buttons ───────────────────────────────────────────── */
.btn-primary {
    color: #fff;
    background-color: var(--brand-coral);
    border-color: var(--brand-coral);
    border-radius: var(--brand-radius-sm);
    font-weight: 600;
    padding: 0.5rem 1.25rem;
    transition: all 0.2s ease;
}

.btn-primary:hover, .btn-primary:focus {
    background-color: var(--brand-coral-dark);
    border-color: var(--brand-coral-dark);
    box-shadow: 0 4px 12px rgba(237, 124, 92, 0.35);
}

.btn-primary:active {
    background-color: #c0503a;
}

.btn-outline-primary {
    color: var(--brand-coral);
    border-color: var(--brand-coral);
    border-radius: var(--brand-radius-sm);
    font-weight: 600;
}

.btn-outline-primary:hover {
    background-color: var(--brand-coral);
    border-color: var(--brand-coral);
    color: #fff;
}

.btn-danger {
    border-radius: var(--brand-radius-sm);
    font-weight: 600;
}

.btn-outline-danger {
    border-radius: var(--brand-radius-sm);
    font-weight: 600;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.15rem rgba(237, 124, 92, 0.3);
}

.form-control:focus {
    border-color: var(--brand-coral-light);
}

/* ─── Cards ─────────────────────────────────────────────── */
.card {
    background: var(--brand-card);
    border: 1px solid var(--brand-border);
    border-radius: var(--brand-radius);
    box-shadow: var(--brand-shadow);
    overflow: hidden;
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--brand-border);
    font-weight: 600;
    padding: 1rem 1.25rem;
}

/* ─── Stat cards ────────────────────────────────────────── */
.stat-card {
    background: var(--brand-card);
    border: 1px solid var(--brand-border);
    border-radius: var(--brand-radius);
    box-shadow: var(--brand-shadow);
    padding: 1.25rem 1.5rem;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--brand-shadow-lg);
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--brand-charcoal);
    line-height: 1.1;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--brand-text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-top: 0.25rem;
}

/* ─── Progress ring (CSS pie chart) ─────────────────────── */
.progress-ring {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    color: var(--brand-charcoal);
    position: relative;
}

.progress-ring::before {
    content: '';
    position: absolute;
    inset: 6px;
    border-radius: 50%;
    background: white;
    z-index: 1;
}

.progress-ring span {
    position: relative;
    z-index: 2;
}

/* ─── Status dots ───────────────────────────────────────── */
.status-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 0.5rem;
    flex-shrink: 0;
}

.status-dot.online { background-color: var(--brand-success); }
.status-dot.offline { background-color: var(--brand-danger); }
.status-dot.pending { background-color: var(--brand-warning); }

/* ─── Event cards ───────────────────────────────────────── */
.event-card {
    background: var(--brand-card);
    border: 1px solid var(--brand-border);
    border-radius: var(--brand-radius);
    box-shadow: var(--brand-shadow);
    overflow: hidden;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.event-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--brand-shadow-lg);
}

.event-card-image {
    width: 100%;
    height: auto;
    display: block;
}

.event-card-image-placeholder {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: var(--brand-sidebar-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 3rem;
    opacity: 0.6;
}

.event-card-banner {
    width: 100%;
    max-height: 280px;
    object-fit: cover;
    object-position: center;
    background-color: var(--brand-surface);
}

.event-card-banner-placeholder {
    width: 100%;
    height: 120px;
    background: var(--brand-sidebar-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2.5rem;
    opacity: 0.5;
}

.event-card-body {
    padding: 1.25rem;
}

.event-card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--brand-charcoal);
    margin-bottom: 0.5rem;
}

.event-card-meta {
    font-size: 0.85rem;
    color: var(--brand-text-muted);
}

/* ─── Ticket type badges ────────────────────────────────── */
.ticket-badge {
    display: inline-block;
    padding: 0.25rem 0.65rem;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    background: var(--brand-surface-alt);
    color: var(--brand-coral-dark);
    border: 1px solid var(--brand-coral-light);
    margin: 0.15rem;
}

/* ─── Device card ───────────────────────────────────────── */
.device-card {
    background: var(--brand-card);
    border: 1px solid var(--brand-border);
    border-radius: var(--brand-radius);
    box-shadow: var(--brand-shadow);
    padding: 1.25rem;
}

/* ─── Progress bar ──────────────────────────────────────── */
.check-in-progress {
    height: 10px;
    border-radius: 5px;
    background-color: var(--brand-border);
    overflow: hidden;
}

.check-in-progress-fill {
    height: 100%;
    border-radius: 5px;
    background: linear-gradient(90deg, var(--brand-coral) 0%, var(--brand-pink) 100%);
    transition: width 0.6s ease;
}

/* ─── Login page ────────────────────────────────────────── */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--brand-sidebar-gradient);
}

.login-card {
    background: white;
    border-radius: var(--brand-radius);
    box-shadow: var(--brand-shadow-lg);
    padding: 3rem;
    max-width: 420px;
    width: 100%;
    text-align: center;
}

.login-card h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.login-card p {
    color: var(--brand-text-muted);
    margin-bottom: 2rem;
}

.btn-microsoft {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    background: #2F2F2F;
    color: white;
    border: none;
    border-radius: var(--brand-radius-sm);
    padding: 0.75rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
}

.btn-microsoft:hover {
    background: #444;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.btn-microsoft svg {
    width: 20px;
    height: 20px;
}

/* ─── Content area ──────────────────────────────────────── */
.content {
    padding-top: 1.1rem;
}

/* ─── Misc ──────────────────────────────────────────────── */
.valid.modified:not([type=checkbox]) {
    outline: 1px solid var(--brand-success);
}

.invalid {
    outline: 1px solid var(--brand-danger);
}

.validation-message {
    color: var(--brand-danger);
}

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.blazor-error-boundary {
    background: var(--brand-danger);
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
    border-radius: var(--brand-radius-sm);
}

.blazor-error-boundary::after {
    content: "An error has occurred."
}

/* ─── Loading screen ────────────────────────────────────── */
.loading-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--brand-surface);
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--brand-border);
    border-top-color: var(--brand-coral);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-text {
    margin-top: 1rem;
    color: var(--brand-text-muted);
    font-weight: 500;
}

code {
    color: var(--brand-coral-dark);
}

/* ─── Section header ────────────────────────────────────── */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.section-header h1,
.section-header h2 {
    margin-bottom: 0;
}

/* ─── Empty state ───────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--brand-text-muted);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.4;
}

/* ─── Sync status badge ─────────────────────────────────── */
.sync-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.sync-badge.completed {
    background: var(--brand-success-light);
    color: var(--brand-success);
}

.sync-badge.error {
    background: var(--brand-danger-light);
    color: var(--brand-danger);
}

.sync-badge.pending {
    background: var(--brand-warning-light);
    color: var(--brand-warning);
}

/* ─── Modal backdrop ────────────────────────────────────── */
.modal-backdrop-custom {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1040;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-card {
    background: white;
    border-radius: var(--brand-radius);
    box-shadow: var(--brand-shadow-lg);
    max-width: 500px;
    width: 90%;
    padding: 2rem;
    animation: slideUp 0.25s ease;
}

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* ─── User avatar ───────────────────────────────────────── */
.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.user-avatar-placeholder {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--brand-coral);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
}

/* ─── Form styling overrides ────────────────────────────── */
.form-control {
    border-radius: var(--brand-radius-sm);
    border-color: var(--brand-border);
}

.form-floating > .form-control-plaintext::placeholder,
.form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder,
.form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* ─── Template Lab / Sticker Designer ───────────────────── */
.template-preview-container {
    background: #f9f9f9;
    border: 1px solid var(--brand-border);
    border-radius: var(--brand-radius-sm);
    padding: 1rem;
    text-align: center;
    overflow: auto;
}

/* Designer layout: 3-column grid filling the content area */
.designer-layout {
    display: grid;
    grid-template-columns: 220px 1fr 280px;
    height: calc(100vh - 3.5rem);
    margin: -1.1rem -1.5rem 0;
    overflow: hidden;
    background: var(--brand-surface);
}

@media (min-width: 641px) {
    .designer-layout {
        margin: -1.1rem -1.5rem 0 -2rem;
    }
}

/* Sidebar */
.designer-sidebar {
    background: var(--brand-card);
    border-right: 1px solid var(--brand-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.designer-sidebar-header {
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--brand-border);
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.designer-template-list {
    overflow-y: auto;
    flex: 1;
}

.designer-template-item {
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--brand-border);
    cursor: pointer;
    position: relative;
    transition: background 0.1s;
}

.designer-template-item:hover { background: var(--brand-surface); }

.designer-template-item.active {
    background: rgba(237,124,92,0.08);
    border-left: 3px solid var(--brand-coral);
    padding-left: calc(1rem - 3px);
}

.dirty-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--brand-coral);
    display: inline-block;
    flex-shrink: 0;
}

/* Main column */
.designer-main {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #ECEAE7;
}

.designer-header {
    background: var(--brand-card);
    border-bottom: 1px solid var(--brand-border);
    padding: 0.45rem 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.designer-tabs {
    display: flex;
    gap: 2px;
    background: var(--brand-border);
    border-radius: 8px;
    padding: 2px;
}

.designer-tab {
    padding: 0.28rem 0.8rem;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 0.83rem;
    font-weight: 500;
    color: var(--brand-text-muted);
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.designer-tab.active {
    background: var(--brand-card);
    color: var(--brand-charcoal);
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

/* Toolbar */
.designer-toolbar {
    background: var(--brand-card);
    border-bottom: 1px solid var(--brand-border);
    padding: 0.35rem 0.85rem;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.toolbar-label {
    font-size: 0.76rem;
    color: var(--brand-text-muted);
    margin-right: 2px;
}

.toolbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 0.25rem 0.55rem;
    border: 1px solid var(--brand-border);
    border-radius: 6px;
    background: white;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--brand-charcoal);
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    line-height: 1.4;
}

.toolbar-btn:hover {
    background: var(--brand-surface);
    border-color: var(--brand-coral-light);
    color: var(--brand-coral-dark);
}

.toolbar-btn-danger { color: var(--brand-danger); border-color: transparent; }
.toolbar-btn-danger:hover { background: rgba(220,38,38,0.06); border-color: var(--brand-danger); }

.toolbar-sep {
    width: 1px; height: 20px;
    background: var(--brand-border);
    margin: 0 2px;
}

/* Canvas area */
.designer-canvas-wrap {
    flex: 1;
    overflow: auto;
    padding: 2rem;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.designer-canvas {
    position: relative;
    background: white;
    box-shadow: 0 4px 28px rgba(0,0,0,0.2);
    border-radius: 2px;
    flex-shrink: 0;
    cursor: default;
}

.designer-canvas.no-select,
.designer-canvas.no-select * {
    user-select: none;
}

/* Elements on canvas */
.designer-el {
    position: absolute;
    cursor: move;
    box-sizing: border-box;
}

.designer-el.sel {
    outline: 2px solid #3B82F6;
    outline-offset: 1px;
    z-index: 5;
}

/* Resize handles */
.rh {
    position: absolute;
    width: 10px; height: 10px;
    background: white;
    border: 2px solid #3B82F6;
    border-radius: 2px;
    z-index: 10;
    pointer-events: all;
    cursor: inherit;
}

.rh-tl { top: -5px;    left: -5px;   cursor: nwse-resize; }
.rh-tr { top: -5px;    right: -5px;  cursor: nesw-resize; }
.rh-bl { bottom: -5px; left: -5px;   cursor: nesw-resize; }
.rh-br { bottom: -5px; right: -5px;  cursor: nwse-resize; }

/* Properties panel */
.designer-props {
    background: var(--brand-card);
    border-left: 1px solid var(--brand-border);
    overflow-y: auto;
    font-size: 0.84rem;
}

.prop-section {
    padding: 0.7rem 0.9rem;
    border-bottom: 1px solid var(--brand-border);
}

.prop-section-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--brand-text-muted);
    margin-bottom: 0.3rem;
}

.prop-label {
    display: block;
    font-size: 0.76rem;
    color: var(--brand-text-muted);
    margin-bottom: 2px;
}
