/* common.css — Shared site-wide styles for makefoxbot admin pages */

/* ── Reset ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── CSS Custom Properties ──────────────────────────────────────── */
:root {
    --primary:       #5865F2;
    --primary-hover: #4752c4;
    --primary-light: rgba(88, 101, 242, 0.15);

    --bg:            #1a1a2e;
    --bg-sidebar:    #16213e;
    --bg-card:       #1f2942;
    --bg-input:      #0f1729;
    --bg-hover:      #253352;
    --bg-active:     #2a3f6b;

    --text:          #e0e0e8;
    --text-muted:    #8892a4;
    --text-dim:      #5a6478;

    --border:        #2a3550;
    --border-light:  #354265;

    --success:       #43b581;
    --error:         #f04747;
    --warning:       #faa61a;
    --info:          #5865F2;

    --radius:        8px;
    --radius-lg:     12px;

    --shadow:        0 4px 24px rgba(0, 0, 0, 0.3);
    --shadow-sm:     0 2px 8px rgba(0, 0, 0, 0.2);

    --transition:    150ms ease;
}

/* ── Typography ─────────────────────────────────────────────────── */
html {
    font-size: 15px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

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

/* ── Buttons ────────────────────────────────────────────────────── */
.btn-primary,
.btn-secondary,
.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: none;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition), opacity var(--transition);
    white-space: nowrap;
}

.btn-primary {
    padding: 8px 18px;
    background: var(--primary);
    color: #fff;
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:disabled { opacity: 0.5; cursor: default; }

.btn-secondary {
    padding: 8px 18px;
    background: var(--bg-hover);
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg-active); }

.btn-icon {
    width: 34px;
    height: 34px;
    padding: 0;
    background: transparent;
    color: var(--text-muted);
    font-size: 1.15rem;
    border-radius: 50%;
}
.btn-icon:hover { background: var(--bg-hover); color: var(--text); }

/* ── Form Inputs ────────────────────────────────────────────────── */
input[type="text"],
textarea {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-input);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.9rem;
    outline: none;
    transition: border-color var(--transition);
}
input[type="text"]:focus,
textarea:focus {
    border-color: var(--primary);
}
input[type="text"]::placeholder,
textarea::placeholder {
    color: var(--text-dim);
}

/* ── Modals ─────────────────────────────────────────────────────── */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal.hidden { display: none; }

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
}

.modal-content {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    width: 400px;
    max-width: 90vw;
    box-shadow: var(--shadow);
}

.modal-header {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 16px;
}

.modal-body { margin-bottom: 20px; }

.modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* ── Toast Notifications ────────────────────────────────────────── */
#toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    padding: 12px 18px;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 500;
    color: #fff;
    box-shadow: var(--shadow-sm);
    animation: toast-in 250ms ease forwards;
    max-width: 360px;
    word-break: break-word;
}
.toast.removing {
    animation: toast-out 200ms ease forwards;
}

.toast-error   { background: var(--error); }
.toast-success { background: var(--success); }
.toast-info    { background: var(--info); }
.toast-warning { background: var(--warning); color: #1a1a2e; }

@keyframes toast-in {
    from { opacity: 0; transform: translateX(40px); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes toast-out {
    from { opacity: 1; transform: translateX(0); }
    to   { opacity: 0; transform: translateX(40px); }
}

/* ── Login Gate ─────────────────────────────────────────────────── */
#login-gate {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 40px;
    width: 400px;
    max-width: 90vw;
    box-shadow: var(--shadow);
    text-align: center;
}
.login-card h1 {
    font-size: 1.4rem;
    margin-bottom: 6px;
}
.login-card .subtitle {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 24px;
}

#login-status {
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 0.8rem;
    margin-bottom: 20px;
}
#login-status.connecting { background: rgba(250, 166, 26, 0.15); color: var(--warning); }
#login-status.info       { background: var(--primary-light); color: var(--primary); }
#login-status.success    { background: rgba(67, 181, 129, 0.15); color: var(--success); }
#login-status.error      { background: rgba(240, 71, 71, 0.15); color: var(--error); }

#login-area {
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Status Indicators ──────────────────────────────────────────── */
.status-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-dim);
    flex-shrink: 0;
}
.status-dot.connected    { background: var(--success); }
.status-dot.disconnected { background: var(--error); }
.status-dot.reconnecting {
    background: var(--warning);
    animation: status-pulse 1s ease-in-out infinite;
}

@keyframes status-pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.4; }
}

/* ── Utilities ──────────────────────────────────────────────────── */
.hidden { display: none !important; }

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-dim);
    font-size: 0.95rem;
    gap: 8px;
    padding: 40px;
    text-align: center;
    user-select: none;
}
.empty-state .icon {
    font-size: 2.5rem;
    opacity: 0.5;
}

/* ── App Header ────────────────────────────────────────────────── */
#app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 20px;
    background: var(--bg-sidebar);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
#app-header h1 { font-size: 1.1rem; font-weight: 600; }
.header-left { display: flex; align-items: center; gap: 12px; }
.header-right { display: flex; align-items: center; gap: 12px; }
.username { font-size: 0.85rem; color: var(--text-muted); }

/* ── Flagged — Blurred Spoiler ─────────────────────────────────── */
.flagged {
    position: relative;
}
.flagged img {
    filter: blur(20px);
    transition: filter 0.3s ease;
}
.flagged::after {
    content: "FLAGGED — Click to reveal";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--warning, #f0ad4e);
    background: rgba(0, 0, 0, 0.8);
    padding: 6px 14px;
    border-radius: 16px;
    pointer-events: none;
    white-space: nowrap;
}
.flagged.revealed img {
    filter: none;
}
.flagged.revealed::after {
    display: none;
}

/* ── Placeholder Pulse ─────────────────────────────────────────── */
@keyframes placeholder-pulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 0.3; }
}

/* ── Clickable Metadata ────────────────────────────────────────── */
.clickable-meta {
    cursor: pointer;
    transition: color var(--transition);
}
.clickable-meta:hover {
    color: var(--primary);
}

/* ── Lightbox ──────────────────────────────────────────────────── */
#lightbox {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
#lightbox.hidden { display: none; }
#lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
}
#lightbox-img {
    position: relative;
    max-width: 95vw;
    max-height: 95vh;
    border-radius: 4px;
}
#lightbox-img.hidden { display: none; }
.lightbox-loading {
    position: relative;
    width: 48px;
    height: 48px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
.lightbox-loading.hidden { display: none; }

/* ── Spin Animation ────────────────────────────────────────────── */
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ── Light Mode ─────────────────────────────────────────────────── */
@media (prefers-color-scheme: light) {
    :root {
        --primary:       #4752c4;
        --primary-hover: #3c46a8;
        --primary-light: rgba(71, 82, 196, 0.1);

        --bg:            #f5f5f7;
        --bg-sidebar:    #ffffff;
        --bg-card:       #ffffff;
        --bg-input:      #f0f0f3;
        --bg-hover:      #ecedf0;
        --bg-active:     #e2e4ea;

        --text:          #1a1a2e;
        --text-muted:    #6b7280;
        --text-dim:      #9ca3af;

        --border:        #d1d5db;
        --border-light:  #e5e7eb;

        --success:       #22a366;
        --error:         #dc2626;
        --warning:       #d97706;
        --info:          #4752c4;

        --shadow:        0 4px 24px rgba(0, 0, 0, 0.08);
        --shadow-sm:     0 2px 8px rgba(0, 0, 0, 0.05);
    }

    #login-status.connecting { background: rgba(217, 119, 6, 0.1); }
    #login-status.info       { background: rgba(71, 82, 196, 0.08); }
    #login-status.success    { background: rgba(34, 163, 102, 0.1); }
    #login-status.error      { background: rgba(220, 38, 38, 0.1); }

    .toast-warning { color: #fff; }
}
