* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background: #f5f6fa;
    color: #1f2430;
}

.wrapper {
    max-width: 560px;
    margin: 0 auto;
    padding: 48px 20px;
}

.wrapper.wide { max-width: 900px; }
.wrapper.narrow { max-width: 380px; }

.page-header {
    text-align: center;
    margin-bottom: 28px;
}

.wrapper.wide .page-header,
.wrapper.narrow .page-header { text-align: left; }

.page-header h1 {
    margin: 0 0 6px;
    font-size: 26px;
    background: linear-gradient(90deg, #833ab4, #fd1d1d, #fcb045);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    margin: 0;
    color: #6b7280;
    font-size: 14px;
}

.ig-form {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.ig-form input[type="text"] {
    flex: 1;
    padding: 12px 14px;
    border: 1px solid #d7dae0;
    border-radius: 8px;
    font-size: 14px;
}

.ig-form button, .stacked-form button {
    padding: 12px 20px;
    border: none;
    border-radius: 8px;
    background: #833ab4;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
}

.ig-form button:hover, .stacked-form button:hover { background: #6b2e94; }
.ig-form button:disabled { background: #b39ddb; cursor: wait; }

.alert {
    padding: 12px 14px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-error { background: #fdecea; color: #b3261e; border: 1px solid #f5c2bd; }
.alert-success { background: #e6f4ea; color: #1e7c3a; border: 1px solid #b7e0c3; }

.loading {
    padding: 16px;
    text-align: center;
    color: #6b7280;
    font-size: 14px;
}

.result-card {
    background: #fff;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.06);
}

.preview-img { width: 100%; border-radius: 8px; display: block; margin-bottom: 14px; }

.badge {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 999px;
    margin-bottom: 8px;
}

.badge-video { background: #e8def8; color: #4a2b8a; }
.badge-image { background: #dcefe0; color: #1e7c3a; }

.caption { font-size: 13px; color: #4b5563; margin: 0 0 14px; }

.btn-download {
    display: inline-block;
    padding: 10px 18px;
    background: #1f2430;
    color: #fff;
    border-radius: 8px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
}

.btn-download:hover { background: #000; }

.page-footer { text-align: center; margin-top: 28px; font-size: 12px; color: #9aa1ac; }

/* ==== Admin ==== */

.admin-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid #e0e2e8;
    margin-bottom: 24px;
    font-size: 14px;
}

.admin-nav a { margin-left: 16px; color: #4b5563; text-decoration: none; }
.admin-nav a:hover { color: #1f2430; }

.stacked-form { display: flex; flex-direction: column; gap: 14px; max-width: 420px; }

.stacked-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: #4b5563; }

.stacked-form input {
    padding: 10px 12px;
    border: 1px solid #d7dae0;
    border-radius: 8px;
    font-size: 14px;
}

.muted { color: #9aa1ac; font-size: 13px; }

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 14px;
    margin-bottom: 32px;
}

.stat-card {
    background: #fff;
    border-radius: 10px;
    padding: 18px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.stat-value { display: block; font-size: 28px; font-weight: 700; }
.stat-success { color: #1e7c3a; }
.stat-failed { color: #b3261e; }
.stat-label { font-size: 12px; color: #9aa1ac; }

.section-title { font-size: 16px; margin-bottom: 12px; }

.table-wrap { overflow-x: auto; background: #fff; border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.05); }

.log-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.log-table th, .log-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #eef0f3; white-space: nowrap; }
.log-table td.truncate { max-width: 260px; overflow: hidden; text-overflow: ellipsis; }

.badge-status { padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.badge-success { background: #e6f4ea; color: #1e7c3a; }
.badge-failed { background: #fdecea; color: #b3261e; }
