/* LetterDeck — Plugin UI styles
   Brand: dark navy #0F1121, crimson #DC2626, DM Sans
   ------------------------------------------------------------------ */

:root {
    --ld-bg:        #0F1121;
    --ld-surface:   #161929;
    --ld-surface2:  #1E2235;
    --ld-border:    #2A2F47;
    --ld-crimson:   #DC2626;
    --ld-crimson-h: #B91C1C;
    --ld-text:      #E8EAF0;
    --ld-muted:     #8B90A7;
    --ld-white:     #FFFFFF;
    --ld-radius:    8px;
    --ld-font:      'DM Sans', -apple-system, sans-serif;
}

/* ── Base ─────────────────────────────────────────────────────────── */
#ld-generator, #ld-dashboard, #ld-login, #ld-register {
    font-family: var(--ld-font);
    color: var(--ld-text);
    max-width: 760px;
    margin: 0 auto;
    padding: 0 16px 48px;
}

.ld-loading {
    color: var(--ld-muted);
    padding: 32px 0;
    text-align: center;
}

/* ── Buttons ──────────────────────────────────────────────────────── */
.ld-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: var(--ld-radius);
    font-family: var(--ld-font);
    font-size: 15px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s, opacity 0.15s;
}

.ld-btn-primary {
    background: var(--ld-crimson);
    color: var(--ld-white);
}
.ld-btn-primary:hover { background: var(--ld-crimson-h); }

.ld-btn-secondary {
    background: var(--ld-surface2);
    color: var(--ld-text);
    border: 1px solid var(--ld-border);
}
.ld-btn-secondary:hover { background: var(--ld-border); }

.ld-btn-ghost {
    background: transparent;
    color: var(--ld-muted);
    border: 1px solid var(--ld-border);
}
.ld-btn-ghost:hover { color: var(--ld-text); border-color: var(--ld-text); }

.ld-btn-upgrade {
    background: var(--ld-crimson);
    color: var(--ld-white);
}
.ld-btn-sm { padding: 6px 14px; font-size: 13px; }
.ld-btn-full { width: 100%; justify-content: center; }
.ld-btn-generate { margin-top: 24px; padding: 14px 32px; font-size: 16px; }
.ld-btn:disabled { opacity: 0.6; cursor: not-allowed; }

.ld-locked { opacity: 0.5; cursor: not-allowed; }

/* ── Form ─────────────────────────────────────────────────────────── */
.ld-form-title {
    font-size: 26px;
    font-weight: 700;
    margin: 0 0 20px;
    color: var(--ld-white);
}

.ld-fieldset { display: flex; flex-direction: column; gap: 16px; }

.ld-field-group { display: flex; flex-direction: column; gap: 6px; }

.ld-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--ld-muted);
}
.ld-req { color: var(--ld-crimson); }
.ld-hint { font-weight: 400; font-size: 12px; }

.ld-input {
    background: var(--ld-surface2);
    border: 1px solid var(--ld-border);
    border-radius: var(--ld-radius);
    color: var(--ld-text);
    font-family: var(--ld-font);
    font-size: 15px;
    padding: 10px 14px;
    width: 100%;
    box-sizing: border-box;
    transition: border-color 0.15s;
    outline: none;
}
.ld-input:focus { border-color: var(--ld-crimson); }
.ld-input.ld-error { border-color: #EF4444; }
.ld-textarea { resize: vertical; min-height: 90px; }
.ld-select { appearance: none; cursor: pointer; }

/* ── Usage bar ────────────────────────────────────────────────────── */
.ld-usage-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding: 10px 14px;
    background: var(--ld-surface2);
    border-radius: var(--ld-radius);
    border: 1px solid var(--ld-border);
}
.ld-usage-text { font-size: 14px; color: var(--ld-muted); flex: 1; }

/* ── Badge ────────────────────────────────────────────────────────── */
.ld-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}
.ld-badge-pro { background: var(--ld-crimson); color: var(--ld-white); }

/* ── Output ───────────────────────────────────────────────────────── */
.ld-output {
    margin-top: 40px;
    padding: 24px;
    background: var(--ld-surface);
    border: 1px solid var(--ld-border);
    border-radius: var(--ld-radius);
}
.ld-output-title { margin: 0 0 16px; font-size: 18px; font-weight: 700; color: var(--ld-white); }
.ld-letter-text {
    width: 100%;
    box-sizing: border-box;
    background: var(--ld-bg);
    border: 1px solid var(--ld-border);
    border-radius: var(--ld-radius);
    color: var(--ld-text);
    font-family: 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.7;
    padding: 16px;
    resize: vertical;
}
.ld-dl-row {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    flex-wrap: wrap;
}

/* ── Gate ─────────────────────────────────────────────────────────── */
.ld-gate {
    text-align: center;
    padding: 64px 32px;
    background: var(--ld-surface);
    border: 1px solid var(--ld-border);
    border-radius: 12px;
}
.ld-gate-icon { font-size: 48px; margin-bottom: 16px; }
.ld-gate h3 { font-size: 22px; font-weight: 700; margin: 0 0 8px; color: var(--ld-white); }
.ld-gate p { color: var(--ld-muted); margin: 0 0 24px; }
.ld-gate-btns { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ── Dashboard ────────────────────────────────────────────────────── */
.ld-dash-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}
.ld-dash-header h2 { margin: 0; font-size: 24px; font-weight: 700; color: var(--ld-white); }

.ld-dash-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}
.ld-dash-card {
    background: var(--ld-surface2);
    border: 1px solid var(--ld-border);
    border-radius: var(--ld-radius);
    padding: 20px;
}
.ld-dash-card-label { font-size: 13px; color: var(--ld-muted); margin-bottom: 8px; }
.ld-dash-card-value { font-size: 28px; font-weight: 700; color: var(--ld-white); }

.ld-dash-section { margin-top: 32px; }
.ld-dash-section h3 { font-size: 18px; font-weight: 700; margin: 0 0 12px; color: var(--ld-white); }
.ld-dash-section p { color: var(--ld-muted); margin: 0 0 16px; }

.ld-dash-upgrade {
    margin-top: 32px;
    padding: 24px;
    background: linear-gradient(135deg, rgba(220,38,38,0.12), rgba(220,38,38,0.04));
    border: 1px solid rgba(220,38,38,0.3);
    border-radius: var(--ld-radius);
}
.ld-dash-upgrade h3 { font-size: 18px; font-weight: 700; margin: 0 0 8px; color: var(--ld-white); }
.ld-dash-upgrade p { color: var(--ld-muted); margin: 0 0 16px; }

.ld-category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}
.ld-cat-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px 12px;
    background: var(--ld-surface2);
    border: 1px solid var(--ld-border);
    border-radius: var(--ld-radius);
    text-decoration: none;
    color: var(--ld-text);
    font-size: 13px;
    font-weight: 500;
    text-align: center;
    transition: border-color 0.15s, background 0.15s;
}
.ld-cat-card:hover { border-color: var(--ld-crimson); background: var(--ld-surface); color: var(--ld-white); }
.ld-cat-icon { font-size: 28px; }
.ld-cat-label { line-height: 1.3; }

/* ── Auth ─────────────────────────────────────────────────────────── */
.ld-auth-box {
    max-width: 420px;
    margin: 0 auto;
    background: var(--ld-surface);
    border: 1px solid var(--ld-border);
    border-radius: 12px;
    padding: 40px;
}
.ld-auth-box h2 { font-size: 22px; font-weight: 700; margin: 0 0 6px; color: var(--ld-white); }
.ld-auth-sub { color: var(--ld-muted); margin: 0 0 24px; font-size: 14px; }
.ld-auth-error {
    background: rgba(239,68,68,0.1);
    border: 1px solid rgba(239,68,68,0.3);
    border-radius: var(--ld-radius);
    color: #FCA5A5;
    padding: 10px 14px;
    font-size: 14px;
    margin-bottom: 16px;
}
.ld-auth-links { margin: 16px 0 0; font-size: 14px; color: var(--ld-muted); text-align: center; }
.ld-auth-links a { color: var(--ld-crimson); text-decoration: none; }
.ld-terms { font-size: 12px; color: var(--ld-muted); text-align: center; margin: 12px 0 0; }
.ld-terms a { color: var(--ld-muted); }

/* ── Modal ────────────────────────────────────────────────────────── */
.ld-modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.7);
    display: flex; align-items: center; justify-content: center;
    z-index: 99999;
    padding: 16px;
}
.ld-modal {
    background: var(--ld-surface);
    border: 1px solid var(--ld-border);
    border-radius: 12px;
    padding: 32px;
    max-width: 420px;
    width: 100%;
}
.ld-modal h3 { margin: 0 0 12px; font-size: 20px; font-weight: 700; color: var(--ld-white); }
.ld-modal p { color: var(--ld-muted); margin: 0 0 24px; }
.ld-modal-btns { display: flex; gap: 12px; flex-wrap: wrap; }

/* ── Responsive ───────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .ld-dash-grid { grid-template-columns: 1fr 1fr; }
    .ld-auth-box { padding: 24px 20px; }
    .ld-dash-card-value { font-size: 22px; }
    .ld-dl-row { flex-direction: column; }
    .ld-dl-row .ld-btn { width: 100%; justify-content: center; }
}
