/* ============================================================================
   FTPC Admin - moderan, profesionalan UI
   ============================================================================ */

*, *::before, *::after { box-sizing: border-box; }
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #0F172A;
    background: #F1F5F9;
    font-size: 14px;
    line-height: 1.5;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; }
ul { list-style: none; padding: 0; margin: 0; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; line-height: 1.2; }
small { font-size: 12px; color: #64748B; }
code { font-family: SFMono-Regular, Consolas, monospace; background: #F1F5F9; padding: 2px 6px; border-radius: 4px; font-size: 12px; }
hr { border: none; border-top: 1px solid #E2E8F0; }

:root {
    --primary: #1E40AF;
    --primary-dark: #1E3A8A;
    --primary-light: #3B82F6;
    --accent: #EF4444;
    --orange: #F59E0B;
    --green: #10B981;
    --bg: #F1F5F9;
    --surface: #FFFFFF;
    --border: #E2E8F0;
    --text: #0F172A;
    --text-muted: #64748B;
}

/* ===== TOP BAR ===== */
.topbar {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    color: #fff;
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,.1);
}
.topbar__brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    font-size: 17px;
}
.topbar__nav { display: flex; align-items: center; gap: 14px; }
.topbar__user { color: #DBEAFE; font-size: 13px; font-weight: 500; padding-right: 8px; border-right: 1px solid rgba(255,255,255,.2); }
.topbar__link {
    color: #DBEAFE;
    font-size: 13px;
    padding: 6px 12px;
    border-radius: 6px;
    transition: all .15s;
    font-weight: 500;
}
.topbar__link:hover { background: rgba(255,255,255,.1); color: #fff; }
.topbar__logout { background: rgba(239,68,68,.2); color: #FCA5A5; }
.topbar__logout:hover { background: var(--accent); color: #fff; }

/* ===== LAYOUT ===== */
.layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: calc(100vh - 60px);
}
.sidebar {
    background: #fff;
    border-right: 1px solid var(--border);
    padding: 24px 0;
    display: flex;
    flex-direction: column;
}
.sidebar__menu li { margin: 2px 12px; }
.sidebar__menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    border-radius: 8px;
    color: var(--text);
    font-weight: 500;
    transition: all .15s;
}
.sidebar__menu a:hover { background: var(--bg); }
.sidebar__menu a.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff;
    box-shadow: 0 4px 12px rgba(30,64,175,.2);
}
.sidebar__menu a span { font-size: 16px; }
.sidebar__quick {
    margin-top: auto;
    padding: 16px;
    border-top: 1px solid var(--border);
}
.main {
    padding: 28px 32px;
    max-width: 1400px;
    width: 100%;
}

/* ===== LOGIN SCREEN ===== */
.login-body {
    background: linear-gradient(135deg, #0F172A 0%, var(--primary) 100%);
    min-height: 100vh;
    margin: 0;
}
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.login-card {
    background: #fff;
    padding: 44px;
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,.4);
    width: 100%;
    max-width: 420px;
    text-align: center;
}
.login-logo { margin: 0 auto 16px; }
.login-card h1 { color: var(--primary); margin-bottom: 8px; font-size: 24px; }
.login-sub { color: var(--text-muted); margin-bottom: 28px; font-size: 14px; }
.login-card form { text-align: left; }
.login-foot { margin-top: 24px; font-size: 13px; color: var(--text-muted); }
.login-foot a { color: var(--primary); }

/* ===== PAGE HEAD ===== */
.page { width: 100%; }
.page__head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 16px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}
.page__head h1 { font-size: 28px; margin-bottom: 4px; }
.page__head p { margin: 0; color: var(--text-muted); font-size: 14px; }
.page__h2 { font-size: 18px; margin: 32px 0 16px; }
.page__section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.page__section-head h2 { font-size: 16px; }
.back {
    display: inline-block;
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 6px;
    transition: color .15s;
}
.back:hover { color: var(--primary); }

/* ===== STATS GRID ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}
.stat {
    background: #fff;
    border-radius: 14px;
    padding: 20px;
    display: flex;
    gap: 14px;
    align-items: flex-start;
    transition: all .2s;
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
a.stat:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.08); }
.stat__icon {
    font-size: 32px;
    width: 56px;
    height: 56px;
    border-radius: 12px;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.stat__label { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); font-weight: 700; display: block; }
.stat__value { display: block; font-size: 28px; font-weight: 800; margin: 4px 0; line-height: 1; }
.stat__sub { font-size: 12px; color: var(--text-muted); display: block; margin-top: 2px; }
.stat__sub--warn { color: var(--accent); font-weight: 600; }
.stat--blue   { border-top: 4px solid var(--primary); }
.stat--blue   .stat__icon { background: #DBEAFE; }
.stat--orange { border-top: 4px solid var(--orange); }
.stat--orange .stat__icon { background: #FEF3C7; }
.stat--green  { border-top: 4px solid var(--green); }
.stat--green  .stat__icon { background: #D1FAE5; }
.stat--green  .stat__value { color: var(--green); }

/* ===== QUICK ACTIONS ===== */
.quick-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 28px;
}
.quick {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text);
    transition: all .2s;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.quick span { font-size: 24px; }
.quick:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: 0 8px 20px rgba(30,64,175,.12); color: var(--primary); }
.quick--primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff !important;
    border: none;
}
.quick--primary:hover { color: #fff; box-shadow: 0 12px 28px rgba(30,64,175,.4); }

/* ===== STATUS OVERVIEW ===== */
.status-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}
.status-tile {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: center;
    color: var(--text);
    transition: all .15s;
}
.status-tile:hover { border-color: var(--primary); transform: translateY(-2px); }
.status-tile strong { font-size: 28px; font-weight: 800; }

/* ===== STATUS PILLS ===== */
.status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .3px;
}
.status--blue   { background: #DBEAFE; color: #1E40AF; }
.status--orange { background: #FEF3C7; color: #92400E; }
.status--green  { background: #D1FAE5; color: #065F46; }
.status--red    { background: #FEE2E2; color: #991B1B; }
.status--gray   { background: #F1F5F9; color: #475569; }

/* ===== CARDS ===== */
.card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 24px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.card h3 {
    font-size: 16px;
    margin: 0 0 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}
.card--sticky { position: sticky; top: 80px; }

/* ===== GRID 2COL ===== */
.grid-2col {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 24px;
}

/* ===== FILTERS ===== */
.status-filters {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.status-filters a {
    padding: 8px 14px;
    border-radius: 999px;
    background: #fff;
    border: 1px solid var(--border);
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    transition: all .15s;
}
.status-filters a:hover { border-color: var(--primary); color: var(--primary); }
.status-filters a.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.status-filters a span { font-size: 11px; opacity: .7; margin-left: 4px; }

.filters-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.filters-bar input[type=search],
.filters-bar select {
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    flex: 1;
    min-width: 200px;
}
.filters-bar select { flex: 0 0 200px; }

/* ===== TABLES ===== */
.table-wrap {
    background: #fff;
    border-radius: 14px;
    border: 1px solid var(--border);
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
    margin-bottom: 16px;
}
.table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}
.table thead { background: #F8FAFC; }
.table th, .table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
    vertical-align: middle;
}
.table th {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-muted);
    font-weight: 700;
}
.table tbody tr:hover { background: #F8FAFC; }
.table tbody tr:last-child td { border-bottom: none; }
.table tfoot td { font-size: 13px; padding: 8px 16px; border: none; }
.thumb {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border);
}
.thumb--empty {
    background: #F1F5F9;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

/* ===== FORMS ===== */
.form-field { margin-bottom: 18px; }
.form-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text);
}
.form-field input,
.form-field textarea,
.form-field select {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font: inherit;
    color: var(--text);
    background: #fff;
    transition: all .15s;
}
.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30,64,175,.1);
}
.form-field textarea { resize: vertical; min-height: 80px; font-family: inherit; }
.form-field small {
    display: block;
    margin-top: 6px;
    color: var(--text-muted);
    font-size: 12px;
}
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
.form-error { color: var(--accent); font-size: 13px; display: block; margin-top: 4px; }
.form-actions { display: flex; gap: 8px; margin-top: 16px; }

.checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    font-size: 14px;
    cursor: pointer;
    user-select: none;
}
.checkbox input { width: auto; margin: 0; cursor: pointer; }

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 18px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    color: var(--text);
    background: #fff;
    border: 1px solid var(--border);
    transition: all .15s;
}
.btn:hover { border-color: var(--primary); color: var(--primary); }
.btn--primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: #fff !important;
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(30,64,175,.25);
}
.btn--primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(30,64,175,.4);
    color: #fff;
}
.btn--lg { padding: 13px 24px; font-size: 15px; }
.btn--small { padding: 5px 12px; font-size: 12px; }
.btn--block { display: flex; width: 100%; }
.btn--danger { color: var(--accent); border-color: #FCA5A5; background: #FEF2F2; }
.btn--danger:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ===== ALERTS ===== */
.alert {
    padding: 14px 18px;
    border-radius: 10px;
    margin-bottom: 16px;
    border-left: 4px solid;
    font-size: 14px;
}
.alert--success { background: #D1FAE5; color: #065F46; border-color: var(--green); }
.alert--error   { background: #FEE2E2; color: #991B1B; border-color: var(--accent); }
.alert--info    { background: #DBEAFE; color: #1E40AF; border-color: var(--primary); }

/* ===== EMPTY STATES ===== */
.empty {
    background: #fff;
    border: 2px dashed var(--border);
    padding: 40px;
    border-radius: 12px;
    text-align: center;
    color: var(--text-muted);
}

/* ===== IMAGE GRID (product images) ===== */
.img-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}
.img-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border);
}
.img-item img { width: 100%; height: 100%; object-fit: cover; }
.img-badge {
    position: absolute;
    top: 6px; left: 6px;
    background: var(--primary);
    color: #fff;
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 6px;
    font-weight: 700;
}
.img-delete {
    position: absolute;
    top: 6px; right: 6px;
}
.img-delete button {
    background: rgba(239,68,68,.9);
    color: #fff;
    border-radius: 50%;
    width: 24px; height: 24px;
    display: flex; align-items: center; justify-content: center;
    font-size: 12px;
    transition: background .15s;
}
.img-delete button:hover { background: var(--accent); }

/* ===== CATEGORY ROW (collapsibles) ===== */
.cat-row {
    border-bottom: 1px solid var(--border);
    padding: 12px 0;
}
.cat-row:last-child { border-bottom: none; }
.cat-row summary {
    cursor: pointer;
    padding: 4px 0;
    font-size: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.cat-row[open] summary { margin-bottom: 12px; }
.cat-form { padding: 12px 16px; background: var(--bg); border-radius: 8px; }

/* ===== PAGINATION ===== */
.pagination {
    display: flex;
    gap: 4px;
    justify-content: center;
    margin: 24px 0;
}
.pagination a, .pagination span {
    padding: 8px 13px;
    border-radius: 8px;
    background: #fff;
    border: 1px solid var(--border);
    font-size: 13px;
    color: var(--text);
}
.pagination a:hover { border-color: var(--primary); color: var(--primary); }
.pagination a.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ===== CHARTS GRID ===== */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 16px;
}
.charts-grid .card { margin-bottom: 0; }
.charts-grid canvas { max-height: 280px; }

/* ===== NOTIFICATION TOAST ===== */
.toast {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 1000;
    background: linear-gradient(135deg, var(--green), #059669);
    color: #fff;
    padding: 16px 20px;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(16,185,129,.4);
    max-width: 360px;
    cursor: pointer;
    animation: slideIn .4s ease-out;
}
.toast strong { display: block; margin-bottom: 4px; font-size: 15px; }
.toast small { display: block; color: rgba(255,255,255,.85); font-size: 12px; }
.toast__close {
    position: absolute;
    top: 6px; right: 10px;
    color: #fff;
    opacity: .7;
    font-size: 18px;
}
@keyframes slideIn {
    from { transform: translateX(120%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
    .layout { grid-template-columns: 1fr; }
    .sidebar { border-right: none; border-bottom: 1px solid var(--border); padding: 12px 0; }
    .sidebar__menu { display: flex; gap: 4px; padding: 0 12px; overflow-x: auto; }
    .sidebar__menu li { margin: 0; flex-shrink: 0; }
    .sidebar__menu a { white-space: nowrap; }
    .sidebar__quick { display: none; }
    .grid-2col { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .main { padding: 16px; }
    .topbar__user { display: none; }
    .topbar__nav .topbar__link:nth-child(2) { display: none; }
    .charts-grid { grid-template-columns: 1fr; }
}
