/* =========================================
   Admin pages shared style
   ========================================= */

.admin-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 24px;
}

/* Cards / stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 20px;
}

.stat-card .stat-icon {
    font-size: 32px;
    margin-bottom: 10px;
}

.stat-card .stat-label {
    color: var(--muted);
    font-size: 13px;
}

.stat-card .stat-value {
    font-size: 24px;
    font-weight: 700;
    margin-top: 4px;
}

.stat-card .stat-value.green { color: var(--green); }
.stat-card .stat-value.red   { color: var(--red); }
.stat-card .stat-value.blue  { color: var(--primary); }

/* Toolbar */
.toolbar {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.toolbar input,
.toolbar select {
    height: 40px;
    border: 1px solid #dce2ea;
    border-radius: 9px;
    padding: 0 12px;
    font-size: 14px;
    outline: none;
}

.toolbar input:focus,
.toolbar select:focus { border-color: var(--primary); }

.toolbar .spacer { flex: 1; }

.btn {
    height: 40px;
    padding: 0 18px;
    border: none;
    border-radius: 9px;
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
}

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

.btn.green { background: var(--green); }
.btn.green:hover { background: var(--green-dark); }
.btn.red { background: var(--red); }
.btn.gray { background: #788494; }
.btn.outline { background: #fff; color: var(--text); border: 1px solid #dce2ea; }
.btn.outline:hover { background: #f2f6fc; }

.btn.blue.outline { background: #fff; color: #0969e8; border: 1px solid #0969e8; }
.btn.blue.outline:hover { background: #0969e815; }
.btn.green.outline { background: #fff; color: #059669; border: 1px solid #059669; }
.btn.green.outline:hover { background: #05966915; }
.btn.orange.outline { background: #fff; color: #ea580c; border: 1px solid #ea580c; }
.btn.orange.outline:hover { background: #ea580c15; }
.btn.red.outline { background: #fff; color: #e53935; border: 1px solid #e53935; }
.btn.red.outline:hover { background: #e5393515; }
.btn.purple.outline { background: #fff; color: #7c3aed; border: 1px solid #7c3aed; }
.btn.purple.outline:hover { background: #7c3aed15; }

/* Tables */
.table-wrap {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow: hidden;
    overflow-x: auto;
}

table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

table.data th {
    background: #f7f9fc;
    text-align: left;
    padding: 12px 14px;
    font-weight: 700;
    color: #596575;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

table.data td {
    padding: 12px 14px;
    border-bottom: 1px solid #f0f2f5;
    vertical-align: middle;
}

table.data tr:hover td { background: #fafcff; }
table.data tr:last-child td { border-bottom: none; }

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}
.badge.green { background: #ecfaf2; color: var(--green); }
.badge.red   { background: #fff3f3; color: var(--red); }
.badge.blue  { background: #edf5ff; color: var(--primary); }
.badge.gray  { background: #f0f2f5; color: #788494; }

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(12,24,40,.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}
.modal-overlay.show { display: flex; }

.modal {
    width: 480px;
    max-width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
}

.modal-head {
    background: var(--primary);
    color: #fff;
    padding: 18px 22px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 16px 16px 0 0;
}

.modal-head h3 { font-size: 17px; }

.modal-close {
    width: 32px; height: 32px;
    border: none; border-radius: 50%;
    background: rgba(255,255,255,.15);
    color: #fff; font-size: 18px;
    cursor: pointer;
}

.modal-body { padding: 22px; }

.form-field { margin-bottom: 16px; }

.form-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
}

.form-field input,
.form-field select,
.form-field textarea {
    width: 100%;
    height: 42px;
    border: 1px solid #dce2ea;
    border-radius: 9px;
    padding: 0 12px;
    font-size: 14px;
    outline: none;
}

.form-field textarea { height: auto; padding: 10px 12px; resize: vertical; }
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus { border-color: var(--primary); }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

.modal-actions .btn { flex: 1; }

/* Toast */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #182230;
    color: #fff;
    padding: 14px 24px;
    border-radius: 10px;
    font-size: 14px;
    z-index: 10000;
    opacity: 0;
    transition: .3s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Empty state */
.empty {
    text-align: center;
    padding: 40px;
    color: var(--muted);
    font-size: 14px;
}

/* Pagination */
.pager {
    display: flex;
    justify-content: center;
    gap: 8px;
    padding: 16px 0;
}
.pager a, .pager span {
    min-width: 34px; height: 34px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 8px; font-size: 13px;
    border: 1px solid #e3e7ed;
    background: #fff; cursor: pointer;
    text-decoration: none; color: var(--text);
}
.pager span.active { background: var(--primary); color: #fff; border-color: var(--primary); }

@media(max-width:950px) {
    .form-row { grid-template-columns: 1fr; }
}
