/* Calendar semantic colors — Pico v2 built-in palette */
:root {
    --accent:    var(--pico-color-orange-500, #f97316);
    --accent-2:  var(--pico-color-yellow-500, #eab308);
    --purple:    var(--pico-color-purple-500, #a855f7);
    --del-color: var(--pico-color-red-500,    #ef4444);
    --ins-color: #d4f0e4;
    --ins-text-color: #1a6b4a;
    --ins-border-color: #aed6c0;
}

/* Optional: Customize scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background-color: var(--pico-border-color);
    border-radius: 4px;
}


/* ── Navigation — lp-nav applied globally ────────────── */
nav.lp-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--pico-background-color);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--pico-border-color);
    width: 100%;
    padding-left: 3rem;
    padding-right: 3rem;
}

/* Push page content below the fixed nav */
body { padding-top: 5.5rem; }

/* Logo */
.nav-logo-wrap {
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--pico-color);
    list-style: none;
}
.nav-logo-accent { color: var(--pico-primary); }

/* Nav links */
nav ul { margin: 0; padding: 0; }
nav ul li { list-style: none; }

.nav-links-desktop a,
nav ul li a {
    font-size: 0.85rem;
    color: var(--pico-muted-color);
    text-decoration: none;
    transition: color 0.15s;
}
.nav-links-desktop a:hover,
nav ul li a:hover { color: var(--pico-color); }

/* Auth dropdown */
nav details[role="list"] summary {
    font-size: 0.85rem;
    color: var(--pico-muted-color);
}
nav details[role="list"] > ul {
    flex-direction: column !important;
    min-width: 9rem;
    border: 1px solid var(--pico-border-color);
    border-radius: 8px;
    background: var(--pico-card-background-color);
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

/* Links globally */
a {
    --pico-text-decoration: none;
    text-decoration: none;
    color: inherit;
    display: inline-block;
}
a:hover { color: inherit; }

/* Mobile nav */
.nav-mobile { display: none !important; }

@media (max-width: 768px) {
    .nav-links-desktop { display: none !important; }
    .nav-mobile { display: flex !important; }

    .nav-hamburger-btn {
        cursor: pointer;
        font-size: 1.3rem;
        padding: 0.25rem 0.5rem;
        list-style: none;
        user-select: none;
    }
    .nav-hamburger-btn::marker,
    .nav-hamburger-btn::-webkit-details-marker { display: none; }

    .nav-hamburger-details { position: relative; }

    .nav-hamburger-menu {
        position: absolute;
        right: 0;
        top: 2.4rem;
        background: var(--pico-card-background-color);
        border: 1px solid var(--pico-border-color);
        border-radius: 8px;
        padding: 0.5rem 0;
        min-width: 180px;
        z-index: 999;
        display: flex;
        flex-direction: column;
        box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    }
    .nav-hamburger-menu a {
        display: block;
        padding: 0.6rem 1.25rem;
        font-size: 0.9rem;
        color: var(--pico-muted-color);
        border-bottom: 1px solid var(--pico-border-color);
    }
    .nav-hamburger-menu a:last-child { border-bottom: none; }
    .nav-hamburger-menu a:hover { color: var(--pico-color); }
}


.trash-icon {
    display: inline-block;
    width: 1em;
    height: 1em;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M19 4h-3.5l-1-1h-5l-1 1H5v2h14M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12z'/%3E%3C/svg%3E") no-repeat center;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M19 4h-3.5l-1-1h-5l-1 1H5v2h14M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6v12z'/%3E%3C/svg%3E") no-repeat center;
}

.pencil-icon {
    display: inline-block;
    width: 1em;
    height: 1em;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.39-.39-1.02-.39-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z'/%3E%3C/svg%3E") no-repeat center;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.39-.39-1.02-.39-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z'/%3E%3C/svg%3E") no-repeat center;
}

/* Modal styles */
#modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    display: none;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: var(--pico-card-background-color);
    padding: 20px;
    border-radius: 8px;
    width: 90% !important;
    max-width: 1200px !important;
    min-width: 800px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

article.modal-content {
    width: 90% !important;
    max-width: 1200px !important;
    min-width: 800px;
}

/* Decks grid — single column */
.decks-grid {
    display: grid !important;
    grid-template-columns: 1fr;
    gap: 1.5rem !important;
    row-gap: 1.5rem !important;
}

/* Create deck form — stack vertically on mobile */
.deck-create-form-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
    padding: 1rem;
    border: 1px solid var(--pico-border-color);
    border-radius: 4px;
}

.deck-create-form-row label:first-child {
    white-space: nowrap;
    margin-bottom: 0;
}

.deck-create-form-row input[name="deck_name"] {
    flex: 1;
    min-width: 0;
    margin-bottom: 0;
}

.deck-create-form-row .federate-label {
    white-space: nowrap;
    display: flex;
    align-items: center;
    margin-bottom: 0;
}

.deck-create-form-row button[type="submit"] {
    white-space: nowrap;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    margin-bottom: 0;
}

@media (max-width: 480px) {
    .deck-create-form-row input[name="deck_name"] {
        width: 100%;
    }
}

/* Workflows */
.workflow-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.workflow-grid {
    display: grid !important;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 600px) {
    .workflow-grid {
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
    }
}

@media (max-width: 600px) {
    .workflow-table-wrap td.wf-hide,
    .workflow-table-wrap th.wf-hide {
        display: none;
    }

    .workflow-actions {
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .workflow-actions a {
        margin-left: 0 !important;
    }
}

/* Lexicons */
.lexicon-create-layout {
    display: flex;
    gap: 2rem;
}

.lexicon-create-layout > div:first-child {
    flex: 1;
    padding-right: 2rem;
}

.lexicon-create-layout > div:last-child {
    flex: 1;
}

@media (max-width: 600px) {
    .lexicon-create-layout {
        flex-direction: column;
    }

    .lexicon-create-layout > div:first-child {
        padding-right: 0;
    }
}

/* Breadcrumb bar */
#breadcrumb-bar {
    padding: 0.35rem 0;
    font-size: 0.8rem;
    border-bottom: 1px solid var(--pico-border-color);
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.bc-link {
    color: var(--pico-muted-color);
    text-decoration: none;
    display: inline;
}

.bc-link:hover {
    color: var(--pico-primary);
}

.bc-sep {
    color: var(--pico-muted-color);
    margin: 0 0.35em;
    opacity: 0.5;
}

.bc-current {
    color: var(--pico-color);
}

/* Home page — assigned cards two-column grid */
.assigned-cards-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

@media (min-width: 600px) {
    .assigned-cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Home page — main + sidebar layout */
.home-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    align-items: start;
}

.home-layout > :first-child {
    min-width: 0;
    overflow: hidden;
}

.assigned-cards-grid {
    min-width: 0;
}

.assigned-cards-grid > * {
    min-width: 0;
    overflow: hidden;
}

@media (min-width: 900px) {
    .home-layout {
        grid-template-columns: 1fr 340px;
    }
}

/* TODO queue sidebar */
.todo-sidebar {
    position: sticky;
    top: 1rem;
}

.todo-sidebar h3 {
    font-size: 0.9rem;
    letter-spacing: 0.08em;
    color: var(--pico-muted-color);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--pico-border-color);
}

.todo-queue-item {
    padding: 0.6rem 0.75rem;
    border-left: 3px solid var(--pico-primary);
    margin-bottom: 0.5rem;
    background: var(--pico-card-background-color);
    border-radius: 0 4px 4px 0;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
}

.todo-queue-item * {
    user-select: none;
    -webkit-user-select: none;
}

.todo-queue-item:active {
    cursor: grabbing;
}

.todo-drag-ghost {
    opacity: 0.35;
    border-left-color: var(--pico-muted-color);
}

.todo-queue-item a {
    font-weight: 500;
    font-size: 0.875rem;
    display: block;
    margin-bottom: 0.2rem;
}

.todo-queue-item .todo-meta {
    font-size: 0.75rem;
    color: var(--pico-muted-color);
}

/* Card detail — two-column layout (details + replies) */
.card-detail-grid {
    grid-template-columns: 1fr !important;
}

@media (min-width: 800px) {
    .card-detail-grid {
        grid-template-columns: 1fr 1fr !important;
    }
}

/* ── lp-product section ──────────────────────────────── */
.lp-product {
    padding: 3rem 0;
    border-bottom: 1px solid var(--pico-border-color);
    background: linear-gradient(180deg, var(--pico-background-color) 0%, var(--pico-card-background-color) 100%);
}
.lp-cards-demo {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 1.5rem;
}
@media (max-width: 768px) {
    .lp-cards-demo { grid-template-columns: 1fr; }
}
.lp-col {
    background: var(--pico-card-background-color);
    border: 1px solid var(--pico-border-color);
    border-radius: 12px;
    padding: 18px;
}
.lp-col-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--pico-border-color);
}
.lp-col-head h4 {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    color: var(--pico-color);
    margin: 0;
}
.lp-col-count {
    font-size: 12px;
    color: var(--pico-muted-color);
    background: var(--pico-border-color);
    padding: 2px 8px;
    border-radius: 999px;
}

/* ── Utility classes ─────────────────────────────────── */
.muted        { color: var(--pico-muted-color); }
.accent       { color: var(--pico-primary); }
.accent-2     { color: var(--accent-2); }
.text-sm      { font-size: 0.8rem; }
.text-xs      { font-size: 0.72rem; }
.italic       { font-style: italic; }
.flex-row     { display: flex; align-items: center; gap: 0.5rem; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.mono         { font-family: monospace; }

/* ── Card internals ──────────────────────────────────── */
.card-hd {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}
.card-hd h4, .card-hd h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}
.card-hd a { color: var(--pico-color); }
.card-hd a:hover { color: var(--pico-primary); }

.card-ft {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.75rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--pico-border-color);
    font-size: 0.72rem;
    color: var(--pico-muted-color);
}

.card-field {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    padding: 0.4em 0;
    border-bottom: 1px solid var(--pico-border-color);
}
.card-field:last-child { border-bottom: none; }
.card-field-key {
    color: var(--pico-muted-color);
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    min-width: 35%;
    flex-shrink: 0;
}
.card-field-val { color: var(--pico-color); flex: 1; }
.card-field-val.details { padding: 0.25em 0; }

/* ── Tag chips ───────────────────────────────────────── */
.tag-chip {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: lowercase;
    padding: 2px 8px;
    border-radius: 999px;
    background: var(--pico-border-color);
    color: var(--pico-muted-color);
    margin-right: 4px;
}

/* ── State badge ─────────────────────────────────────── */
.state-badge {
    display: inline-flex;
    align-items: center;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--pico-border-color);
    color: var(--pico-muted-color);
}

/* ── Icon action links ───────────────────────────────── */
.icon-action {
    opacity: 0.35;
    font-size: 0.9rem;
    text-decoration: none;
    transition: opacity 0.15s;
}
.icon-action:hover { opacity: 0.8; }

/* ── Detail page sections ────────────────────────────── */
.detail-section {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--pico-border-color);
}
.detail-section:last-child { border-bottom: none; }

/* CLI bar — mobile improvements */
@media (max-width: 600px) {
    #cli-bar {
        padding: 0.4rem 0.5rem;
    }

    #cli-input {
        font-size: 16px !important; /* prevent iOS auto-zoom */
        padding: 0.6rem 0.75rem !important;
    }
}
