/* ============================================================
   NIOM Admin — Shared Stylesheet
   Include via: <link rel="stylesheet" href="/static/css/admin-style.css">
   ============================================================ */

/* ---- Reset ---- */
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f5f5;
}

/* ---- Topbar ---- */
.topbar {
    background: #2c3e50;
    color: #fff;
    padding: 14px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.topbar h1 { font-size: 18px; font-weight: 600; display: inline; }
.topbar a { color: #ecf0f1; text-decoration: none; margin-left: 20px; font-size: 14px; }
.topbar a:hover { text-decoration: underline; }
.topbar .user-info { font-size: 14px; }
.topbar .btn-logout {
    background: #e74c3c; color: #fff; border: none;
    padding: 6px 16px; border-radius: 4px; cursor: pointer;
    margin-left: 16px; font-size: 13px;
}
.topbar .btn-logout:hover { background: #c0392b; }

/* ---- Layout ---- */
.container { max-width: 900px; margin: 30px auto; padding: 0 20px; }
.container-wide { max-width: 1100px; margin: 30px auto; padding: 0 20px; }
.loading { text-align: center; padding: 60px; color: #999; }
.hidden { display: none; }

/* ---- Buttons ---- */
.btn {
    padding: 8px 18px; border: none; border-radius: 4px;
    font-size: 14px; cursor: pointer; color: #fff;
}
.btn-primary { background: #3498db; }
.btn-primary:hover { background: #2980b9; }
.btn-success { background: #27ae60; }
.btn-success:hover { background: #219a52; }
.btn-danger { background: #e74c3c; }
.btn-danger:hover { background: #c0392b; }
.btn-secondary { background: #7f8c8d; }
.btn-secondary:hover { background: #6c7a7b; }
.btn:disabled { background: #999; cursor: not-allowed; }
.btn-sm { padding: 5px 12px; font-size: 13px; }

/* ---- Alerts ---- */
.alert {
    padding: 10px 14px; border-radius: 4px;
    margin-bottom: 16px; font-size: 14px;
}
.alert-error { color: #d32f2f; background: #fdecea; border: 1px solid #f5c6cb; }
.alert-success { color: #155724; background: #d4edda; border: 1px solid #c3e6cb; }
.alert-warning { color: #856404; background: #fff3cd; border: 1px solid #ffc107; }

/* ---- Toolbar ---- */
.toolbar {
    display: flex; align-items: center; gap: 12px;
    margin-bottom: 20px; flex-wrap: wrap;
}
.toolbar input[type="text"] {
    padding: 8px 12px; font-size: 14px; border: 1px solid #ccc;
    border-radius: 4px; width: 260px;
}
.toolbar select {
    padding: 8px 12px; font-size: 14px;
    border: 1px solid #ccc; border-radius: 4px;
}

/* ---- Table ---- */
table {
    width: 100%; border-collapse: collapse; background: #fff;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}
th, td {
    border: 1px solid #e0e0e0; padding: 10px 14px;
    text-align: left; font-size: 14px;
}
th { background: #f8f9fa; font-weight: 600; color: #555; }
td.actions { text-align: center; white-space: nowrap; }

/* ---- Pagination ---- */
.pagination {
    display: flex; justify-content: center; align-items: center;
    gap: 8px; margin-top: 16px; flex-wrap: wrap;
}
.pagination button {
    padding: 6px 14px; border: 1px solid #ccc; background: #fff;
    border-radius: 4px; cursor: pointer; font-size: 13px;
}
.pagination button:disabled { opacity: 0.5; cursor: not-allowed; }
.pagination button:not(:disabled):hover { background: #f0f0f0; }
.pagination span { font-size: 13px; color: #777; margin-left: 8px; }

/* ---- Modal ---- */
.modal-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,0.4); z-index: 100;
    justify-content: center; align-items: center;
}
.modal-overlay.active { display: flex; }
.modal {
    background: #fff; border-radius: 8px; padding: 28px 32px;
    width: 100%; max-width: 460px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
}
.modal h3 { margin-bottom: 18px; color: #333; }
.modal .form-group { margin-bottom: 14px; }
.modal .form-group label {
    display: block; margin-bottom: 5px;
    font-weight: 500; color: #555; font-size: 14px;
}
.modal .form-group input,
.modal .form-group select,
.modal .form-group textarea {
    width: 100%; padding: 9px 12px; border: 1px solid #ddd;
    border-radius: 4px; font-size: 14px; outline: none;
    font-family: inherit;
}
.modal .form-group input:focus,
.modal .form-group select:focus,
.modal .form-group textarea:focus { border-color: #4a90d9; }
.modal-actions {
    display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px;
}

/* ---- Dashboard: Nav Cards ---- */
.welcome-msg { font-size: 20px; margin-bottom: 30px; color: #333; }
.nav-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 16px;
}
.nav-card {
    background: #fff; padding: 24px; border-radius: 8px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.08);
    text-decoration: none; color: #333; display: block;
    transition: box-shadow 0.2s, transform 0.15s;
}
.nav-card:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    transform: translateY(-2px);
}
.nav-card h3 { margin-bottom: 6px; color: #2c3e50; }
.nav-card p { font-size: 13px; color: #777; }

/* ---- Dashboard: Stats Cards ---- */
.stats-section { margin-bottom: 32px; }
.stats-section h2 { font-size: 16px; color: #555; margin-bottom: 12px; }
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
}
.stat-card {
    background: #fff; padding: 20px 18px; border-radius: 8px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.08);
    border-left: 4px solid #3498db;
}
.stat-card .stat-value { font-size: 28px; font-weight: 700; color: #2c3e50; }
.stat-card .stat-label { font-size: 13px; color: #777; margin-top: 4px; }
.stat-card.green  { border-left-color: #27ae60; }
.stat-card.orange { border-left-color: #f39c12; }
.stat-card.red    { border-left-color: #e74c3c; }
.stat-card.purple { border-left-color: #8e44ad; }
.stat-card.teal   { border-left-color: #16a085; }
.section-divider { border: none; border-top: 1px solid #e0e0e0; margin: 8px 0 24px; }

/* ---- Permission Page Specifics ---- */
.profile-header { margin-bottom: 16px; }
.profile-header h2 { color: #333; margin-bottom: 4px; }
.profile-header p { color: #777; font-size: 14px; }
th.clickable { cursor: pointer; }
th.clickable:hover { background: #eef1f4; }
.row-icon { font-weight: bold; margin-right: 6px; }
.row-icon.clickable { cursor: pointer; }
.btn-save {
    margin-top: 16px; padding: 10px 24px;
    background: #27ae60; color: #fff; border: none;
    border-radius: 4px; font-size: 15px; cursor: pointer;
}
.btn-save:hover { background: #219a52; }
.btn-save:disabled { background: #999; cursor: not-allowed; }

/* ---- Public Pages (activation, reset-password, etc.) ---- */
.page-centered {
    display: flex; justify-content: center; align-items: center;
    min-height: 100vh;
}
.card {
    background: #fff; padding: 40px; border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.1);
    width: 100%; max-width: 420px;
}
.card h2 { margin-bottom: 8px; color: #333; text-align: center; }
.card .subtitle {
    text-align: center; color: #777; font-size: 14px; margin-bottom: 24px;
}
.card .form-group { margin-bottom: 16px; }
.card .form-group label {
    display: block; margin-bottom: 6px;
    font-weight: 500; color: #555; font-size: 14px;
}
.card .form-group input {
    width: 100%; padding: 10px 12px;
    border: 1px solid #ddd; border-radius: 4px;
    font-size: 14px; outline: none; transition: border-color 0.2s;
}
.card .form-group input:focus { border-color: #4a90d9; }
.card .btn-block {
    width: 100%; padding: 12px; font-size: 16px; margin-top: 8px;
}
.msg {
    padding: 10px; border-radius: 4px;
    margin-bottom: 16px; font-size: 14px; display: none;
}
.msg-error { color: #d32f2f; background: #fdecea; }
.msg-success { color: #155724; background: #d4edda; }
.msg-invalid { color: #856404; background: #fff3cd; }
