/*
 * assets/style.css
 * ============================================================
 * Executive Conference Center Override Management Portal
 * Design System
 *
 * Aesthetic: Clean corporate light theme.
 * White backgrounds, black text, Travelers red accents.
 * Fonts: DM Serif Display (headings) + DM Sans (body)
 * ============================================================
 */

/* ── Reset & base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    /* Palette */
    --bg-base:       #ffffff;
    --bg-surface:    #ffffff;
    --bg-elevated:   #f5f5f5;
    --bg-hover:      #ebebeb;
    --border:        #e0e0e0;
    --border-light:  #d0d0d0;

    /* Text */
    --text-primary:  #000000;
    --text-secondary:#444444;
    --text-muted:    #888888;

    /* Accent – Travelers red */
    --accent:        #E61616;
    --accent-dark:   #b50f0f;
    --accent-glow:   rgba(230, 22, 22, 0.08);

    /* Semantic */
    --green:         #1e7e3e;
    --green-dim:     rgba(30, 126, 62, 0.08);
    --red:           #E61616;
    --red-dim:       rgba(230, 22, 22, 0.07);
    --blue:          #1a56a0;

    /* Type */
    --font-display:  'DM Serif Display', Georgia, serif;
    --font-body:     'DM Sans', system-ui, sans-serif;

    /* Spacing */
    --radius-sm:     5px;
    --radius:        8px;
    --radius-lg:     12px;

    /* Transitions */
    --tx:            150ms ease;
}

html { font-size: 16px; }

body {
    font-family: var(--font-body);
    font-size: .9375rem;
    line-height: 1.6;
    background: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

img { display: block; max-width: 100%; }
a { color: var(--accent); text-decoration: none; transition: color var(--tx); }
a:hover { color: var(--accent-dark); }

/* ── Navigation ────────────────────────────────────────────── */
.nav {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 2rem;
    padding: 0 2rem;
    background: #000000;
    border-bottom: 3px solid var(--accent);
    height: 64px;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: .875rem;
    flex-shrink: 0;
    text-decoration: none;
}

.nav-logo-img {
    height: 32px;
    width: auto;
    display: block;
}

.nav-divider {
    width: 1px;
    height: 28px;
    background: rgba(255,255,255,.2);
    flex-shrink: 0;
}

.nav-name {
    font-family: var(--font-display);
    font-size: .95rem;
    color: #ffffff;
    letter-spacing: .01em;
    line-height: 1.2;
    max-width: 260px;
}

.nav-links {
    display: flex;
    gap: .125rem;
    list-style: none;
    flex: 1;
}

.nav-link {
    padding: .4rem 1rem;
    border-radius: var(--radius-sm);
    color: rgba(255,255,255,.7);
    font-size: .875rem;
    font-weight: 500;
    transition: all var(--tx);
    display: block;
}

.nav-link:hover { color: #ffffff; background: rgba(255,255,255,.1); }
.nav-link.active {
    color: #ffffff;
    background: var(--accent);
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.nav-email {
    font-size: .8125rem;
    color: rgba(255,255,255,.55);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Main layout ───────────────────────────────────────────── */
.main {
    flex: 1;
    padding: 2.5rem 2rem 4rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* ── Footer ────────────────────────────────────────────────── */
.footer {
    padding: 1rem 2rem;
    text-align: center;
    font-size: .75rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    background: var(--bg-elevated);
}

/* ── Page header ───────────────────────────────────────────── */
.page-header {
    margin-bottom: 2rem;
    padding-bottom: 1.25rem;
    border-bottom: 2px solid var(--border);
}

.page-title {
    font-family: var(--font-display);
    font-size: 1.875rem;
    font-weight: 400;
    color: var(--text-primary);
    line-height: 1.2;
    margin-bottom: .3rem;
}

.page-sub {
    color: var(--text-secondary);
    font-size: .9375rem;
}

/* ── Flash messages ────────────────────────────────────────── */
.flash {
    padding: .75rem 1rem;
    border-radius: var(--radius-sm);
    font-size: .875rem;
    margin-bottom: 1.5rem;
    border-left: 3px solid;
    animation: flash-in .2s ease;
}

@keyframes flash-in {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.flash-ok    { background: var(--green-dim); border-color: var(--green); color: var(--green); }
.flash-error { background: var(--red-dim);   border-color: var(--red);   color: var(--accent-dark); }

/* ── Status banner ─────────────────────────────────────────── */
.status-banner {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: .875rem 1.25rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    margin-bottom: 2rem;
    animation: flash-in .3s ease;
}

.status-banner.status-on  {
    border-color: var(--green);
    background: var(--green-dim);
}
.status-banner.status-off { opacity: .8; }

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    background: #cccccc;
}

.status-on .status-indicator {
    background: var(--green);
    box-shadow: 0 0 6px rgba(30,126,62,.5);
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% { box-shadow: 0 0 6px rgba(30,126,62,.5); }
    50%       { box-shadow: 0 0 12px rgba(30,126,62,.7); }
}

.status-text { flex: 1; font-size: .9375rem; color: var(--text-secondary); }
.status-text strong { color: var(--text-primary); }
.status-action { flex-shrink: 0; }

/* ── Category sections ─────────────────────────────────────── */
.category-section { margin-bottom: 3rem; }

.category-title {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 400;
    color: var(--text-secondary);
    margin-bottom: 1.25rem;
    padding-bottom: .625rem;
    border-bottom: 1px solid var(--border);
    letter-spacing: .02em;
}

/* ── Template grid ─────────────────────────────────────────── */
.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.25rem;
}

.template-card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: border-color var(--tx), transform var(--tx), box-shadow var(--tx);
    display: flex;
    flex-direction: column;
}

.template-card:hover {
    border-color: #aaaaaa;
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(0,0,0,.1);
}

.template-card--active {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 1px var(--accent), 0 6px 24px rgba(230,22,22,.12);
}

/* Thumbnail */
.template-thumb {
    position: relative;
    aspect-ratio: 16 / 9;
    background: var(--bg-elevated);
    overflow: hidden;
    border-bottom: 1px solid var(--border);
}

.thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .4s ease;
}

.template-card:hover .thumb-img { transform: scale(1.03); }

.thumb-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: #cccccc;
    background: repeating-linear-gradient(
        45deg,
        #f5f5f5,
        #f5f5f5 10px,
        #ebebeb 10px,
        #ebebeb 20px
    );
}

.thumb-badge {
    position: absolute;
    top: .5rem;
    right: .5rem;
    padding: .2rem .6rem;
    border-radius: 4px;
    background: var(--accent);
    color: #ffffff;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
}

/* Card body */
.template-body {
    padding: 1.125rem;
    display: flex;
    flex-direction: column;
    gap: .75rem;
    flex: 1;
}

.template-meta {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
}

.template-cat-tag, .template-name-tag {
    font-size: .7rem;
    padding: .15rem .5rem;
    border-radius: 4px;
    letter-spacing: .04em;
}

.template-cat-tag {
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.template-name-tag {
    background: var(--accent-glow);
    color: var(--accent-dark);
    border: 1px solid rgba(230,22,22,.2);
    font-family: 'Courier New', monospace;
}

.template-label {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.3;
}

.template-form { display: flex; flex-direction: column; gap: .625rem; }

.template-actions {
    display: flex;
    gap: .5rem;
    margin-top: .25rem;
}

/* ── Two-column admin layout ───────────────────────────────── */
.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: start;
}

.two-col--wide {
    grid-template-columns: 5fr 7fr;
}

@media (max-width: 800px) {
    .two-col, .two-col--wide { grid-template-columns: 1fr; }
}

/* ── Card ──────────────────────────────────────────────────── */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.card-title {
    font-family: var(--font-display);
    font-size: 1.125rem;
    font-weight: 400;
    color: var(--text-primary);
    margin-bottom: 1.25rem;
    padding-bottom: .75rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: .625rem;
}

/* ── Form elements ─────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: .35rem; }

.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .75rem;
}

@media (max-width: 600px) { .field-row { grid-template-columns: 1fr; } }

.label {
    font-size: .8125rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: .02em;
}

.label-hint {
    font-weight: 400;
    color: var(--text-muted);
    font-size: .75rem;
}

.input {
    padding: .6rem .8rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
    background: #ffffff;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: .9rem;
    transition: border-color var(--tx), box-shadow var(--tx);
    width: 100%;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
}

.input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.input::placeholder { color: #bbbbbb; }

.input-code {
    font-size: 1.5rem;
    letter-spacing: .4em;
    text-align: center;
    font-family: 'Courier New', monospace;
}

.input-sm { font-size: .875rem; padding: .5rem .7rem; }

select.input {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23888888' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .75rem center;
    padding-right: 2.25rem;
    cursor: pointer;
}

.stack { display: flex; flex-direction: column; gap: .875rem; }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: .6rem 1.25rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: .875rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all var(--tx);
    white-space: nowrap;
    text-decoration: none;
}

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

.btn-primary {
    background: var(--accent);
    color: #ffffff;
    border-color: var(--accent);
}
.btn-primary:hover {
    background: var(--accent-dark);
    border-color: var(--accent-dark);
    color: #ffffff;
    box-shadow: 0 3px 12px rgba(230,22,22,.3);
}

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border-color: var(--border-light);
}
.btn-secondary:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-danger {
    background: var(--red-dim);
    color: var(--accent-dark);
    border-color: rgba(230,22,22,.25);
}
.btn-danger:hover {
    background: rgba(230,22,22,.14);
    color: var(--accent);
    border-color: rgba(230,22,22,.4);
}

.btn-ghost {
    background: transparent;
    color: #ffffff;
    border: 1px solid var(--accent);
    padding: .4rem .9rem;
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: .8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--tx);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    background: var(--accent);
}
.btn-ghost:hover { background: var(--accent-dark); border-color: var(--accent-dark); color: #ffffff; }

.btn-full { width: 100%; }

.btn-sm { padding: .4rem .875rem; font-size: .8125rem; }

.btn-icon {
    width: 30px;
    height: 30px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
    background: var(--bg-elevated);
    color: var(--text-muted);
    cursor: pointer;
    font-size: .8rem;
    transition: all var(--tx);
    padding: 0;
    flex-shrink: 0;
}

.btn-icon--danger:hover {
    background: var(--red-dim);
    color: var(--accent);
    border-color: rgba(230,22,22,.3);
}

/* ── User list ─────────────────────────────────────────────── */
.user-list { display: flex; flex-direction: column; gap: .5rem; }

.user-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .75rem 1rem;
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    transition: border-color var(--tx), background var(--tx);
    gap: .75rem;
}
.user-row:hover { border-color: #aaaaaa; background: var(--bg-hover); }

.user-info { display: flex; align-items: center; gap: .625rem; flex: 1; min-width: 0; }

.user-email {
    font-size: .875rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.role-badge {
    font-size: .7rem;
    font-weight: 700;
    padding: .15rem .5rem;
    border-radius: 4px;
    letter-spacing: .05em;
    text-transform: uppercase;
    flex-shrink: 0;
}
.role-badge--admin { background: var(--accent-glow); color: var(--accent-dark); border: 1px solid rgba(230,22,22,.2); }
.role-badge--user  { background: var(--bg-hover); color: var(--text-muted); border: 1px solid var(--border); }

.you-tag {
    font-size: .75rem;
    color: var(--blue);
    background: rgba(26,86,160,.08);
    padding: .15rem .5rem;
    border-radius: 4px;
    border: 1px solid rgba(26,86,160,.15);
}

/* ── Template list (admin page) ────────────────────────────── */
.tpl-list { display: flex; flex-direction: column; gap: .625rem; }

.tpl-row {
    display: flex;
    align-items: center;
    gap: .875rem;
    padding: .75rem;
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    transition: border-color var(--tx), background var(--tx);
}
.tpl-row:hover { border-color: #aaaaaa; background: var(--bg-hover); }

.tpl-row-thumb {
    width: 64px;
    height: 40px;
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
}
.tpl-thumb-img { width: 100%; height: 100%; object-fit: cover; }
.tpl-thumb-empty { font-size: 1.25rem; color: #cccccc; }

.tpl-row-info {
    display: flex;
    flex-direction: column;
    gap: .15rem;
    flex: 1;
    min-width: 0;
}
.tpl-row-label { font-size: .875rem; color: var(--text-primary); font-weight: 500; }
.tpl-row-name  { font-size: .75rem; color: var(--accent-dark); font-family: monospace; }
.tpl-row-meta  { font-size: .75rem; color: var(--text-muted); }

.tpl-row-actions {
    display: flex;
    align-items: center;
    gap: .5rem;
    flex-shrink: 0;
}

/* ── Badges ────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.5rem;
    height: 1.5rem;
    padding: 0 .4rem;
    border-radius: 100px;
    font-size: .7rem;
    font-weight: 700;
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
}

.badge--green { background: var(--green-dim); color: var(--green); border-color: rgba(30,126,62,.25); }

/* ── Auth page ─────────────────────────────────────────────── */
.auth-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
    padding: 2rem;
    background: var(--bg-base);
}

.auth-card {
    width: 100%;
    max-width: 440px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    box-shadow: 0 8px 40px rgba(0,0,0,.1);
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.auth-logo-img {
    height: 40px;
    width: auto;
    margin: 0 auto .75rem;
    display: block;
}

.auth-title {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 400;
    color: var(--text-primary);
    margin-bottom: 0;
    line-height: 1.3;
}

.auth-sub {
    font-size: .875rem;
    color: var(--text-secondary);
    margin-top: .5rem;
}

/* Red accent bar at top of login card */
.auth-card::before {
    content: '';
    display: block;
    height: 4px;
    background: var(--accent);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    margin: -2.5rem -2.5rem 2rem;
}

.auth-form { display: flex; flex-direction: column; gap: 1rem; }

.email-badge {
    padding: .5rem .8rem;
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    border: 1px solid var(--border-light);
    font-size: .875rem;
    color: var(--accent-dark);
    font-family: monospace;
}

/* ── Dev note ──────────────────────────────────────────────── */
.dev-note {
    margin-top: 1rem;
    padding: .75rem;
    border-radius: var(--radius-sm);
    background: rgba(26,86,160,.05);
    border: 1px solid rgba(26,86,160,.15);
    font-size: .78rem;
    color: var(--text-secondary);
    word-break: break-all;
}
.dev-note code {
    font-family: monospace;
    color: var(--blue);
    font-size: .78rem;
}

/* ── Thumbnail preview (templates page) ────────────────────── */
.thumb-preview {
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border-light);
    aspect-ratio: 16 / 9;
    background: var(--bg-elevated);
}
.thumb-preview img { width: 100%; height: 100%; object-fit: cover; }

/* ── Empty state ───────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

/* ── Misc utilities ────────────────────────────────────────── */
.inline-form { display: inline-flex; }
.muted { color: var(--text-muted); font-size: .875rem; }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 700px) {
    .nav { padding: .75rem 1rem; gap: 1rem; flex-wrap: wrap; height: auto; }
    .nav-user { flex: 100%; justify-content: space-between; }
    .main { padding: 1.5rem 1rem 3rem; }
    .page-title { font-size: 1.5rem; }
    .auth-card { padding: 1.75rem; }
    .auth-card::before { margin: -1.75rem -1.75rem 1.75rem; }
    .template-grid { grid-template-columns: 1fr; }
}

/* ── Animations ────────────────────────────────────────────── */
@keyframes fade-up {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

.category-section {
    animation: fade-up .4s ease both;
}
.category-section:nth-child(2) { animation-delay: .06s; }
.category-section:nth-child(3) { animation-delay: .12s; }
.category-section:nth-child(4) { animation-delay: .18s; }

.card, .auth-card {
    animation: fade-up .35s ease both;
}
