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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    background: #0d1117;
    color: #c9d1d9;
    min-height: 100vh;
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    border-bottom: 1px solid #21262d;
}

nav .logo {
    font-size: 1.2rem;
    font-weight: 700;
    color: #58a6ff;
    text-decoration: none;
}

nav div { display: flex; gap: 1rem; }
nav a { color: #8b949e; text-decoration: none; }
nav a:hover { color: #c9d1d9; }

main {
    max-width: 960px;
    margin: 2rem auto;
    padding: 0 2rem;
}

.hero { text-align: center; margin-top: 4rem; }
.hero h1 { font-size: 3rem; color: #58a6ff; margin-bottom: 0.5rem; }
.hero p { color: #8b949e; margin-bottom: 2rem; }

h2 { margin-bottom: 1.5rem; }

.btn {
    display: inline-block;
    padding: 0.6rem 1.5rem;
    background: #238636;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    font-size: 0.9rem;
}
.btn:hover { background: #2ea043; }

.btn-small {
    padding: 0.2rem 0.6rem;
    background: transparent;
    color: #8b949e;
    border: 1px solid #30363d;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
}
.btn-danger:hover { background: #da3633; color: #fff; border-color: #da3633; }

form { max-width: 600px; }
label {
    display: block;
    margin-bottom: 1rem;
    color: #8b949e;
    font-size: 0.85rem;
}
input[type="text"], input[type="password"], select, textarea {
    display: block;
    width: 100%;
    margin-top: 0.3rem;
    padding: 0.5rem;
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 6px;
    color: #c9d1d9;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.9rem;
}
textarea { resize: vertical; min-height: 200px; }
select { max-width: 200px; }

.tabs { display: flex; gap: 0; margin-bottom: 1.5rem; }
.tab {
    padding: 0.5rem 1.2rem;
    background: #161b22;
    border: 1px solid #30363d;
    color: #8b949e;
    cursor: pointer;
    font-size: 0.9rem;
}
.tab:first-child { border-radius: 6px 0 0 6px; }
.tab:last-child { border-radius: 0 6px 6px 0; }
.tab.active { background: #21262d; color: #c9d1d9; border-color: #58a6ff; }

.drop-zone {
    border: 2px dashed #30363d;
    border-radius: 8px;
    padding: 3rem 2rem;
    text-align: center;
    color: #8b949e;
    cursor: pointer;
    margin-bottom: 1rem;
    transition: border-color 0.2s;
}
.drop-zone.dragover { border-color: #58a6ff; background: rgba(88,166,255,0.05); }
.drop-zone img { max-width: 100%; max-height: 300px; margin-top: 1rem; border-radius: 4px; }

.paste-header { margin-bottom: 1.5rem; }
.paste-meta {
    display: flex;
    gap: 1rem;
    align-items: center;
    color: #8b949e;
    font-size: 0.85rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}
.paste-meta a { color: #58a6ff; text-decoration: none; }

pre {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 1rem;
    overflow-x: auto;
    font-size: 0.9rem;
    line-height: 1.5;
}
code { font-family: 'SF Mono', 'Fira Code', monospace; }

.image-view {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
}
.image-view img { max-width: 100%; border-radius: 4px; }

.muted { color: #484f58; }
.error { color: #f85149; margin-bottom: 1rem; }

.api-example {
    margin-top: 1rem;
    text-align: left;
    display: inline-block;
    background: #161b22;
    padding: 1rem;
    border-radius: 8px;
    font-size: 0.85rem;
}
.api-example code { color: #8b949e; }

table { width: 100%; border-collapse: collapse; }
th, td {
    text-align: left;
    padding: 0.6rem 0.8rem;
    border-bottom: 1px solid #21262d;
    font-size: 0.9rem;
}
th { color: #8b949e; font-weight: 500; }
td a { color: #58a6ff; text-decoration: none; }
td a:hover { text-decoration: underline; }

.paste-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

.paste-card {
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 8px;
    overflow: hidden;
}

.paste-thumb {
    display: block;
    width: 100%;
    height: 160px;
    overflow: hidden;
    background: #0d1117;
}
.paste-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.paste-thumb-text {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #484f58;
    font-size: 1.5rem;
    font-family: 'SF Mono', 'Fira Code', monospace;
}

.paste-card-info {
    padding: 0.75rem;
}
.paste-card-title {
    display: block;
    color: #58a6ff;
    text-decoration: none;
    font-weight: 500;
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.paste-card-title:hover { text-decoration: underline; }
.paste-card-meta {
    display: block;
    color: #484f58;
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
}

.quick-drop {
    border: 2px dashed #30363d;
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    color: #484f58;
    margin-bottom: 1.5rem;
    transition: all 0.2s;
}
.quick-drop.active {
    border-color: #58a6ff;
    background: rgba(88,166,255,0.08);
    color: #58a6ff;
}

.upload-progress {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    margin-bottom: 1.5rem;
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 8px;
    color: #8b949e;
}
.upload-spinner {
    width: 20px; height: 20px;
    border: 2px solid #30363d;
    border-top-color: #58a6ff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.copy-toast {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    margin-bottom: 1.5rem;
    background: #0f2d1e;
    border: 2px solid #238636;
    border-radius: 8px;
}
.copy-toast input {
    flex: 1;
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 6px;
    color: #c9d1d9;
    padding: 0.6rem;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.95rem;
}
.btn-copy {
    padding: 0.6rem 2rem;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.05em;
}

/* Video paste card thumbnail: poster image with play overlay */
.paste-thumb-video {
    position: relative;
    background: #0d1117;
}
.paste-thumb-video img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.85;
}
.paste-thumb-video .play-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: rgba(255,255,255,0.9);
    text-shadow: 0 1px 6px rgba(0,0,0,0.6);
    pointer-events: none;
}

/* Text paste card thumbnail (pre-rendered on upload) */
.paste-thumb-text-img {
    background: #0d1117;
}
.paste-thumb-text-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.paste-thumb-text-img span {
    /* Fallback rendered by onerror when the server-side thumb is missing. */
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #484f58;
    font-size: 1.5rem;
    font-family: 'SF Mono', 'Fira Code', monospace;
}

/* Video landing page player */
.video-view {
    margin-top: 1rem;
    background: #000;
    border-radius: 6px;
    overflow: hidden;
}
.video-view video {
    display: block;
    width: 100%;
    max-height: 70vh;
    background: #000;
}

/* Expired paste indicator */
.expired-badge {
    display: inline-block;
    padding: 0.1rem 0.45rem;
    margin-left: 0.4rem;
    border: 1px solid #da3633;
    border-radius: 3px;
    background: rgba(218, 54, 51, 0.15);
    color: #ff7b72;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    vertical-align: middle;
}
.paste-card-expired .paste-thumb img,
.paste-card-expired .paste-thumb-file,
.paste-card-expired .paste-thumb-text-img img {
    opacity: 0.45;
    filter: grayscale(40%);
}

/* File paste card thumbnail */
.paste-thumb-file {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #8b949e;
    font-size: 1rem;
    font-family: 'SF Mono', 'Fira Code', monospace;
    background: #161b22;
    text-transform: lowercase;
}
.paste-thumb-file span {
    padding: 0.25rem 0.6rem;
    border: 1px solid #30363d;
    border-radius: 4px;
}

/* File landing page download block */
.file-download {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1rem;
    padding: 1.25rem;
    background: #161b22;
    border: 1px solid #30363d;
    border-radius: 8px;
}
.file-download input[type="text"] {
    flex: 1;
    min-width: 16rem;
    margin-top: 0;
    background: #0d1117;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.9rem;
}
.file-download .btn {
    padding: 0.5rem 1.25rem;
    font-size: 0.95rem;
}

/* Dashboard API tokens section */
.tokens-section {
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid #21262d;
}
.tokens-section h2 {
    margin-bottom: 0.5rem;
}
.tokens-section .muted {
    margin-bottom: 1rem;
    font-size: 0.85rem;
}
/* Inline "extend expiry" dropdown on paste cards + landing pages */
.extend-form {
    display: inline-block;
}
.extend-form select {
    margin-top: 0;
    width: auto;
    padding: 0.2rem 0.4rem;
    font-size: 0.8rem;
    color: #8b949e;
    background: transparent;
    border: 1px solid #30363d;
    border-radius: 4px;
    cursor: pointer;
}
.extend-form select:hover { color: #c9d1d9; border-color: #484f58; }

/* Per-card action row (extend + delete live together) */
.paste-card-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* /admin/config form */
.admin-form { max-width: 700px; }
.admin-field {
    padding: 0.8rem 0;
    border-bottom: 1px solid #21262d;
}
.admin-field:last-of-type { border-bottom: none; }
.admin-field-label {
    display: inline-block;
    font-size: 0.85rem;
    color: #c9d1d9;
    margin-bottom: 0.25rem;
}
.admin-field input[type="text"],
.admin-field input[type="number"] {
    max-width: 320px;
}
.admin-field-meta {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    font-size: 0.75rem;
    color: #484f58;
    margin-top: 0.3rem;
}
.admin-field-desc { flex: 1; }
.admin-field-default { white-space: nowrap; color: #484f58; }
.admin-field-default code {
    background: #161b22;
    padding: 0.05rem 0.3rem;
    border-radius: 3px;
    color: #8b949e;
}
.admin-inline {
    display: inline;
    font-size: 0.85rem;
    color: #8b949e;
    margin-left: 0.5rem;
}
.admin-inline input { display: inline-block; width: auto; margin: 0 0.3rem 0 0; }
.admin-actions {
    padding-top: 1rem;
    display: flex;
    justify-content: flex-end;
}
.admin-notice {
    padding: 0.6rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}
.admin-notice-ok {
    background: rgba(46, 160, 67, 0.12);
    border: 1px solid #2ea043;
    color: #7ee787;
}

.token-list {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.token-list th, .token-list td {
    padding: 0.6rem 0.5rem;
    text-align: left;
    border-bottom: 1px solid #21262d;
}
.token-list th {
    color: #8b949e;
    font-weight: 500;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
