/* ═══════════════════════════════════════════════════════════════════════════
   Common CSS - Shared styles across the site
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─────────────────────────────────────────────────────────────────────────────
   CSS Variables / Theme
   ───────────────────────────────────────────────────────────────────────────── */
:root, [data-theme="light"] {
    --bg: #f6f7f9;
    --surface: #ffffff;
    --card: #ffffff;
    --border: #e5e7eb;
    --text: #0f172a;
    --muted: #64748b;
    --primary: #1557ff;
    --primary-hover: #0f47d9;
    --brand: #1557ff;
    --brand-600: #0f47d9;
    --danger: #dc2626;
    --success: #16a34a;
    --ring: rgba(21, 87, 255, 0.25);
    --radius: 12px;
    --shadow: 0 10px 25px rgba(2, 6, 23, 0.08);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0b1020;
        --surface: #0f172a;
        --card: #0f172a;
        --border: #1f2a44;
        --text: #e5e7eb;
        --muted: #94a3b8;
        --primary: #5b8cff;
        --primary-hover: #88aaff;
        --brand: #5b8cff;
        --brand-600: #88aaff;
        --ring: rgba(91, 140, 255, 0.35);
        --shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
    }
}

[data-theme="dark"] {
    --bg: #0b1020;
    --surface: #0f172a;
    --card: #0f172a;
    --border: #1f2a44;
    --text: #e5e7eb;
    --muted: #94a3b8;
    --primary: #5b8cff;
    --primary-hover: #88aaff;
    --brand: #5b8cff;
    --brand-600: #88aaff;
    --ring: rgba(91, 140, 255, 0.35);
    --shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
}

/* ─────────────────────────────────────────────────────────────────────────────
   Reset & Base
   ───────────────────────────────────────────────────────────────────────────── */
* { box-sizing: border-box }
html, body { height: 100% }

body {
    margin: 0;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, "Helvetica Neue", Arial, sans-serif;
    background: radial-gradient(1200px 600px at 10% -10%, rgba(21,87,255,.08), transparent 40%),
                radial-gradient(1200px 600px at 110% 110%, rgba(21,87,255,.08), transparent 40%),
                var(--bg);
    color: var(--text);
    line-height: 1.5;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Typography
   ───────────────────────────────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
    margin: 0;
    line-height: 1.2;
}

h1 { font-size: clamp(1.1rem, 2.2vw, 1.4rem); }

.subtitle {
    color: var(--muted);
    font-size: 0.9rem;
    margin: 0;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Layout
   ───────────────────────────────────────────────────────────────────────────── */
.wrap {
    width: min(1100px, 96vw);
    display: grid;
    gap: 1rem;
}

.wrap-sm { width: min(560px, 96vw); }
.wrap-md { width: min(800px, 96vw); }
.wrap-lg { width: min(1100px, 96vw); }

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

.card-title {
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card-title .icon {
    font-size: 1.1rem;
}

.card-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    flex: 1;
}

.card-footer {
    margin-top: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Forms
   ───────────────────────────────────────────────────────────────────────────── */
.form-group {
    display: grid;
    gap: 0.4rem;
}

label {
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--muted);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 0.5rem 0.625rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.9rem;
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
}

textarea {
    min-height: 100px;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.8rem;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    outline: 2px solid var(--primary);
    outline-offset: -1px;
    border-color: transparent;
}

.inline-group {
    display: flex;
    gap: 0.75rem;
}

.inline-group .form-group {
    flex: 1;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Buttons
   ───────────────────────────────────────────────────────────────────────────── */
button, .btn {
    padding: 0.55rem 0.9rem;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    background: var(--primary);
    color: #fff;
    transition: background 0.15s, transform 0.1s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

button:hover:not(:disabled),
.btn:hover:not(:disabled) {
    background: var(--primary-hover);
}

button:active:not(:disabled),
.btn:active:not(:disabled) {
    transform: translateY(1px);
}

button:disabled,
.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    width: 100%;
}

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

.btn-secondary:hover:not(:disabled) {
    background: var(--border);
}

.icon-btn {
    padding: 0.3rem 0.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 0.8rem;
}

.icon-btn:hover {
    background: var(--border);
    color: var(--text);
}

.btn-row {
    display: flex;
    gap: 0.5rem;
}

.btn-row button,
.btn-row .btn {
    flex: 1;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Drop Zone
   ───────────────────────────────────────────────────────────────────────────── */
.drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s ease;
    background: var(--bg);
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: var(--primary);
    background: rgba(21, 87, 255, 0.05);
}

.drop-zone.has-file {
    border-color: var(--success);
    background: rgba(22, 163, 74, 0.08);
}

.drop-zone-icon {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.drop-zone-text {
    color: var(--muted);
    font-size: 0.8rem;
}

.file-name {
    margin-top: 0.4rem;
    font-weight: 600;
    color: var(--success);
    word-break: break-all;
    font-size: 0.8rem;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Messages & Alerts
   ───────────────────────────────────────────────────────────────────────────── */
.message {
    padding: 0.6rem 0.8rem;
    border-radius: 8px;
    font-size: 0.8rem;
    display: none;
}

.message.show {
    display: block;
}

.message.success {
    background: rgba(22, 163, 74, 0.12);
    color: var(--success);
    border: 1px solid rgba(22, 163, 74, 0.3);
}

.message.error {
    background: rgba(220, 38, 38, 0.12);
    color: var(--danger);
    border: 1px solid rgba(220, 38, 38, 0.3);
}

/* ─────────────────────────────────────────────────────────────────────────────
   Utilities
   ───────────────────────────────────────────────────────────────────────────── */
.or-divider {
    text-align: center;
    color: var(--muted);
    font-size: 0.8rem;
    position: relative;
}

.or-divider::before,
.or-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background: var(--border);
}

.or-divider::before { left: 0; }
.or-divider::after { right: 0; }

.grow { flex: 1; }
.text-center { text-align: center; }
.text-muted { color: var(--muted); }

/* ─────────────────────────────────────────────────────────────────────────────
   Footer
   ───────────────────────────────────────────────────────────────────────────── */
footer {
    text-align: center;
    color: var(--muted);
    font-size: 0.85rem;
}

footer a {
    color: var(--primary);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Monospace / Code
   ───────────────────────────────────────────────────────────────────────────── */
.mono, code, pre {
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

.path {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
    font-size: 0.9rem;
    color: var(--muted);
}

/* ─────────────────────────────────────────────────────────────────────────────
   Keyboard
   ───────────────────────────────────────────────────────────────────────────── */
kbd {
    font: inherit;
    border: 1px solid var(--border);
    background: var(--card);
    border-bottom-width: 2px;
    padding: .1rem .4rem;
    border-radius: 6px;
}
