/* ============================================================================
   File: admin.css
   Purpose: Define the complete visual styling system for the SMAPITS admin
            interface, including layout, tables, forms, buttons, permissions
            matrix, color inputs, and reusable UI components.

   Description:
     This stylesheet provides the unified design language for all admin pages.
     It includes:
       • Base typography, spacing, and background rules
       • Layout containers for admin pages and content cards
       • Form inputs, buttons, badges, and toolbars
       • Table styling for user/role/permission management
       • Action dropdown menus used across all admin modules
       • Form-card and table-form layouts for edit/create pages
       • Permission matrix grid system
       • Color input styling for group/asset color selection

     The admin UI is built around:
       – Clean, modern, neutral styling
       – Consistent spacing and rounded corners
       – Reusable components shared across Users, Roles, Permissions,
         Groups, and Map‑related admin tools

   Notes:
     • All components are designed to work with the fixed admin header.
     • Color palette follows the SMAPITS neutral/blue/gray theme.
     • Buttons use semantic colors (primary, danger, success, secondary).
     • Tables and cards use subtle shadows for depth.
     • Permission matrix uses responsive CSS grid for flexible layout.
     • Color swatch inputs are normalized to match form input height.

   Author: Roger Oakley
   Last Updated: 2026‑07‑14
============================================================================ */

/* -----------------------------------------------------------
   BASE
----------------------------------------------------------- */
body {
    margin: 0;
    padding: 20px;
    font-family: "Inter", sans-serif;
    background: #f5f5f5;
    color: #333;
}

/* -----------------------------------------------------------
   LAYOUT
----------------------------------------------------------- */
.admin-main {
    margin-top: 140px; /* push below fixed header */
    padding: 0px;
}

.admin-content-inner {
    padding: 0;
    background: none;
    border-radius: 0;
    box-shadow: none;
}


/* Page Header */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding: 0 20px;
}

.admin-header h1 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
}

/* -----------------------------------------------------------
   INPUTS
----------------------------------------------------------- */
.input,
.form-input {
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
    min-width: 160px;
    width: 100%;
}

/* -----------------------------------------------------------
   BUTTONS
----------------------------------------------------------- */
.btn-primary,
.btn-danger,
.btn-success,
.btn-secondary {
    display: inline-block;
    padding: 10px 16px;
    border-radius: 6px;
    text-decoration: none;
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 14px;
}

.btn-primary { background: #1976d2; }
.btn-primary:hover { background: #125a9c; }

.btn-danger { background: #d9534f; }
.btn-danger:hover { background: #b52b27; }

.btn-success { background: #28a745; }
.btn-success:hover { background: #1e7e34; }

.btn-secondary { background: #6c757d; }
.btn-secondary:hover { background: #545b62; }

/* -----------------------------------------------------------
   BADGES
----------------------------------------------------------- */
.badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    color: #fff;
}

.badge-red { background: #d9534f; }
.badge-blue { background: #0275d8; }
.badge-green { background: #5cb85c; }
.badge-gray { background: #6c757d; }

/* -----------------------------------------------------------
   FILTER TOOLBAR (Users page)
----------------------------------------------------------- */
.admin-filter-toolbar {
    margin: 0 0px 16px 0px;
    background: #f8f8f8;
    padding: 12px 16px;
    border: 1px solid #e2e2e2;
    border-radius: 10px 10px 0 0;
    border-bottom: none;
}

.admin-filter-toolbar-inner {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* -----------------------------------------------------------
   TABLES (Roles, Users, Permissions)
----------------------------------------------------------- */
.admin-table-card {
    background: #fff;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    margin: 0;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th {
    background: #f5f5f5;
    padding: 12px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #ddd;
}

.admin-table td {
    padding: 12px;
    border-top: 1px solid #eee;
}

.admin-table tr:hover {
    background: #fafafa;
}

/* -----------------------------------------------------------
   ACTION DROPDOWN (Unified Across All Pages)
----------------------------------------------------------- */
.action-dropdown {
    position: relative;
    display: inline-block;
}

.action-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    line-height: 1;
}

.action-btn:hover {
    background: #eee;
}

.action-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 32px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-width: 240px;
    width: max-content;
    z-index: 9999;
    overflow: visible;
}

.action-menu a,
.action-menu span.disabled-action {
    display: block;
    padding: 10px 14px;
    text-decoration: none;
    color: #333;
    font-size: 14px;
    white-space: nowrap;
}

.action-menu a:hover {
    background: #f5f5f5;
}

.action-menu .danger {
    color: #d9534f;
}

.action-menu .danger:hover {
    background: #ffecec;
}

/* Disabled item (Permissions page "In Use") */
.disabled-action {
    color: #888;
    cursor: default;
    background: #fafafa;
}


/* -----------------------------------------------------------
   FORM CARDS (Edit User, Edit Role, etc.)
----------------------------------------------------------- */
.admin-form-card {
    background: #fff;
    padding: 0;
    border-radius: 8px;
    border: 1px solid #ddd;
    margin: 0 20px;
    overflow: hidden;
}

/* Table-style form layout */
.admin-form-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-form-table th {
    background: #f3f3f3;
    width: 240px;
    padding: 14px 18px;
    font-weight: 600;
    border-bottom: 1px solid #e0e0e0;
    vertical-align: top;
}

.admin-form-table td {
    padding: 14px 18px;
    border-bottom: 1px solid #e0e0e0;
}

.admin-form-table tr:nth-child(even) td {
    background: #fafafa;
}

.admin-form-table tr:last-child th,
.admin-form-table tr:last-child td {
    border-bottom: none;
}

/* Form actions */
.form-actions {
    display: flex;
    gap: 10px;
    padding: 20px;
}

/* -----------------------------------------------------------
   MISC
----------------------------------------------------------- */
.error {
    background: #ffdddd;
    padding: 12px;
    border-left: 4px solid #d9534f;
    margin: 20px;
    border-radius: 4px;
    text-align: center;
    color: #d33;
    font-weight: 600;
}

/* -------------------------------------------------------------
    Permissions
--------------------------------------------------------------- */
.permission-matrix {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.perm-category {
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fafafa;
    overflow: hidden;
}

.perm-category-header {
    background: #f0f0f0;
    padding: 10px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.perm-category-header strong {
    font-size: 15px;
}

.perm-select-all {
    background: #e0e0e0;
    border: none;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
}

.perm-select-all:hover {
    background: #d0d0d0;
}

.perm-category-body {
    padding: 12px 14px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 8px 16px;
}

.perm-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.perm-item input[type="checkbox"] {
    transform: scale(1.2);
}
 /* ---------------------------------------------------------------
    Color Swatch
------------------------------------------------------------------ */
.color-input {
    width: 50px;
    height: 38px; /* match .form-input height */
    padding: 0;
    border: 1px solid #ccc;
    border-radius: 6px;
    cursor: pointer;
    display: inline-block;
    vertical-align: middle; /* aligns with text inputs */
    box-sizing: border-box;
}


.color-input::-webkit-color-swatch-wrapper {
    padding: 0;
    border-radius: 6px;
}

.color-input::-webkit-color-swatch {
    border: none;
    border-radius: 6px;
}

.color-wrapper {
    display: flex;
    align-items: center;
}
