/* QR Manager — Minimal Dark Theme */

:root {
    --bg: #0f172a;
    --surface: #1e293b;
    --surface-hover: #334155;
    --border: #334155;
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --primary: #6366f1;
    --primary-hover: #818cf8;
    --danger: #ef4444;
    --success: #22c55e;
    --radius: 8px;
    --shadow: 0 1px 3px rgba(0,0,0,0.3);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Header */
header {
    margin-bottom: 2rem;
}

header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

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

.back-link {
    color: var(--primary);
    text-decoration: none;
    font-size: 0.875rem;
    display: inline-block;
    margin-bottom: 0.5rem;
}
.back-link:hover { color: var(--primary-hover); }

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

.card h2 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text);
}

/* Forms */
.form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.flex-1 { flex: 1; }
.flex-2 { flex: 2; }

label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.optional {
    font-weight: 400;
    text-transform: none;
    letter-spacing: normal;
}

input[type="text"],
input[type="url"] {
    padding: 0.5rem 0.75rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.9rem;
    transition: border-color 0.2s;
}

input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

input::placeholder { color: var(--text-muted); opacity: 0.5; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font-size: 0.85rem;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
    white-space: nowrap;
}

.btn:hover { background: var(--surface-hover); }

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}
.btn-primary:hover { background: var(--primary-hover); }

.btn-danger {
    color: var(--danger);
    border-color: transparent;
    background: transparent;
}
.btn-danger:hover { background: rgba(239, 68, 68, 0.1); }

.btn-sm {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
}

.btn-copy {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.8rem;
    padding: 0.1rem 0.3rem;
    border-radius: 4px;
    transition: background 0.15s;
}
.btn-copy:hover { background: var(--surface-hover); }

/* QR List */
.qr-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.qr-item {
    display: flex;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    transition: border-color 0.2s;
}

.qr-item:hover { border-color: var(--primary); }

.qr-preview {
    flex-shrink: 0;
}

.qr-preview img {
    border-radius: 6px;
    background: white;
    padding: 4px;
}

.qr-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.35rem;
}

.qr-title {
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.qr-urls {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.qr-short, .qr-target {
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.label {
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    flex-shrink: 0;
}

.url-link {
    color: var(--primary);
    text-decoration: none;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.8rem;
}
.url-link:hover { text-decoration: underline; }

.url-target { color: var(--text-muted); }

.qr-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.clicks { color: var(--success); font-weight: 500; }

.qr-actions {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex-shrink: 0;
    justify-content: center;
}

.inline { display: inline; }

.count {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 400;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    text-align: center;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    word-break: break-all;
}

.stat-value.short-url { font-size: 0.9rem; }
.stat-value a { color: var(--primary); text-decoration: none; }
.stat-value a:hover { text-decoration: underline; }

.target-link { font-size: 0.85rem !important; }

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.25rem;
}

/* Chart */
.chart-container {
    height: 250px;
    position: relative;
}

/* Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.data-table th {
    text-align: left;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid rgba(51, 65, 85, 0.5);
    color: var(--text);
}

.data-table tr:last-child td { border-bottom: none; }

.text-right { text-align: right; }
.text-center { text-align: center; }
.nowrap { white-space: nowrap; }
.mono { font-family: 'SF Mono', 'Fira Code', monospace; font-size: 0.8rem; }
.muted { color: var(--text-muted); }

.ua-cell {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* QR Large Preview */
.qr-large {
    border-radius: 8px;
    background: white;
    padding: 8px;
    margin-bottom: 1rem;
}

.qr-download-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

/* Format groups for download options */
.qr-formats {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.format-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    justify-content: center;
}

.format-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    min-width: 120px;
    text-align: right;
    flex-shrink: 0;
}

.format-options {
    display: flex;
    gap: 0.4rem;
}

@media (max-width: 640px) {
    .format-group {
        flex-direction: column;
        gap: 0.3rem;
    }
    .format-label {
        text-align: center;
        min-width: unset;
    }
}

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

/* API Docs */
.api-docs details summary {
    cursor: pointer;
    list-style: none;
}
.api-docs details summary::-webkit-details-marker { display: none; }

.api-content {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.api-endpoint code {
    background: var(--bg);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.85rem;
    color: var(--primary);
}

.api-endpoint pre {
    background: var(--bg);
    padding: 0.75rem;
    border-radius: 6px;
    font-size: 0.8rem;
    overflow-x: auto;
    margin-top: 0.5rem;
    color: var(--text-muted);
}

.api-endpoint p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Responsive */
@media (max-width: 640px) {
    .container { padding: 1rem 0.75rem; }
    .form-row { flex-direction: column; }
    .qr-item { flex-direction: column; align-items: center; text-align: center; }
    .qr-info { align-items: center; }
    .qr-short, .qr-target { flex-wrap: wrap; justify-content: center; }
    .qr-meta { justify-content: center; }
    .qr-actions { flex-direction: row; flex-wrap: wrap; justify-content: center; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    header h1 { font-size: 1.4rem; }
}
