/* =========================================================
   LIKESTAR PUBLICATIONS
   MANAGEMENT ACTIVITY / AUDIT LOG
   BRAND SYSTEM
   White + Blue + Orange
   ========================================================= */

:root {
    --blue: #0057b8;
    --blue-dark: #003b7a;
    --blue-deep: #002f63;
    --blue-light: #eaf4ff;
    --blue-lighter: #f4f9ff;

    --orange: #ff7a00;
    --orange-dark: #df6500;
    --orange-light: #fff1e3;
    --orange-lighter: #fff8f0;

    --white: #ffffff;
    --black: #0b1728;
    --text: #26364a;
    --muted: #718096;
    --muted-light: #9aa7b6;

    --border: #e6ebf2;
    --border-strong: #d5dde8;
    --light: #f7f9fc;
    --surface-soft: #fbfcfe;

    --success: var(--blue);
    --success-light: var(--blue-light);

    --danger: var(--orange-dark);
    --danger-light: var(--orange-light);

    --warning: var(--orange-dark);
    --warning-light: var(--orange-light);

    --purple: var(--blue);
    --purple-light: var(--blue-light);

    --radius-sm: 10px;
    --radius-md: 18px;
    --radius-lg: 28px;

    --shadow-sm: 0 8px 25px rgba(11, 23, 40, 0.06);
    --shadow-md: 0 18px 45px rgba(11, 23, 40, 0.10);

    --sidebar: 260px;
    --topbar: 76px;

    --font-body: "DM Sans", sans-serif;
    --font-heading: "Plus Jakarta Sans", sans-serif;

    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
}

/* =========================================================
   RESET
   ========================================================= */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    background: var(--light);
    color: var(--text);
    font-family: var(--font-body);
}

body.modal-open {
    overflow: hidden;
}

button,
input,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.65;
}

a {
    color: inherit;
    text-decoration: none;
}

/* =========================================================
   SIDEBAR
   ========================================================= */

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar);

    background: var(--white);
    border-right: 1px solid var(--border);

    z-index: 1000;

    display: flex;
    flex-direction: column;
}

.brand {
    height: var(--topbar);

    display: flex;
    align-items: center;

    padding: 0 24px;

    border-bottom: 1px solid var(--border);
}

.brand img {
    width: 142px;
    height: auto;
    display: block;
}

.sidebar-label {
    padding: 24px 24px 10px;

    color: var(--muted);

    font-size: 10px;
    font-weight: 800;

    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.sidebar-nav {
    padding: 0 12px;
    overflow-y: auto;
    flex: 1;
}

.nav-link {
    min-height: 44px;

    display: flex;
    align-items: center;
    gap: 12px;

    padding: 10px 13px;
    margin-bottom: 4px;

    border-radius: 11px;

    color: var(--muted);

    font-size: 13px;
    font-weight: 600;

    transition:
        background var(--transition-fast),
        color var(--transition-fast),
        transform var(--transition-fast);
}

.nav-link:hover {
    background: var(--blue-lighter);
    color: var(--blue);
}

.nav-link:active {
    transform: translateY(1px);
}

.nav-link.active {
    background: var(--blue-light);
    color: var(--blue);
    font-weight: 700;
}

.nav-icon {
    width: 19px;
    height: 19px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    flex: 0 0 19px;
}

.nav-icon svg {
    width: 18px;
    height: 18px;

    stroke: currentColor;
    fill: none;

    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sidebar-bottom {
    padding: 14px 12px;

    border-top: 1px solid var(--border);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;

    padding: 10px;

    border-radius: 12px;
    background: var(--light);
}

.avatar {
    width: 38px;
    height: 38px;

    border-radius: 50%;

    background: var(--blue);
    color: var(--white);

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 12px;
    font-weight: 800;

    flex: 0 0 38px;
}

.sidebar-user-text {
    min-width: 0;
}

.sidebar-user-name {
    color: var(--black);

    font-size: 12px;
    font-weight: 700;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    margin-top: 2px;

    color: var(--muted);

    font-size: 11px;
    text-transform: capitalize;
}

/* =========================================================
   MAIN
   ========================================================= */

.main {
    min-height: 100vh;
    margin-left: var(--sidebar);
}

.topbar {
    height: var(--topbar);

    position: sticky;
    top: 0;
    z-index: 900;

    background: rgba(255, 255, 255, 0.94);

    backdrop-filter: blur(14px);

    border-bottom: 1px solid var(--border);

    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 0 34px;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.mobile-menu-button {
    width: 42px;
    height: 42px;

    border: 1px solid var(--border);
    border-radius: 11px;

    background: var(--white);
    color: var(--black);

    display: none;
    align-items: center;
    justify-content: center;

    transition:
        border-color var(--transition-fast),
        color var(--transition-fast),
        background var(--transition-fast);
}

.mobile-menu-button:hover {
    border-color: var(--blue);
    color: var(--blue);
    background: var(--blue-lighter);
}

.mobile-menu-button svg {
    width: 20px;
    height: 20px;

    stroke: currentColor;
    fill: none;

    stroke-width: 1.8;
    stroke-linecap: round;
}

.page-heading {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.page-heading h1 {
    color: var(--black);

    font-family: var(--font-heading);

    font-size: 20px;
    line-height: 1.2;
    font-weight: 800;
}

.page-heading p {
    color: var(--muted);
    font-size: 12px;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.notification-button {
    width: 42px;
    height: 42px;

    position: relative;

    border: 1px solid var(--border);
    border-radius: 11px;

    background: var(--white);
    color: var(--text);

    display: flex;
    align-items: center;
    justify-content: center;

    transition:
        border-color var(--transition-fast),
        color var(--transition-fast),
        background var(--transition-fast);
}

.notification-button:hover {
    border-color: var(--blue);
    color: var(--blue);
    background: var(--blue-lighter);
}

.notification-button svg {
    width: 19px;
    height: 19px;

    stroke: currentColor;
    fill: none;

    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.notification-dot {
    width: 7px;
    height: 7px;

    position: absolute;

    right: 9px;
    top: 8px;

    background: var(--orange);

    border: 2px solid var(--white);
    border-radius: 50%;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;

    padding-left: 6px;
}

.topbar-user .avatar {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
}

.topbar-user-info {
    display: flex;
    flex-direction: column;
}

.topbar-user-name {
    color: var(--black);
    font-size: 12px;
    font-weight: 700;
}

.topbar-user-role {
    color: var(--muted);
    font-size: 11px;
    text-transform: capitalize;
}

/* =========================================================
   CONTENT
   ========================================================= */

.content {
    max-width: 1600px;

    margin: 0 auto;

    padding: 34px;
}

.page-intro {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;

    gap: 24px;

    margin-bottom: 26px;
}

.page-intro h2 {
    color: var(--black);

    font-family: var(--font-heading);

    font-size: 27px;
    font-weight: 800;

    letter-spacing: -0.02em;
}

.page-intro p {
    max-width: 720px;

    margin-top: 7px;

    color: var(--muted);

    font-size: 13px;
    line-height: 1.7;
}

/* =========================================================
   STAT CARDS
   ========================================================= */

.stats-grid {
    display: grid;

    grid-template-columns:
        repeat(4, minmax(0, 1fr));

    gap: 16px;

    margin-bottom: 22px;
}

.stat-card {
    position: relative;

    background: var(--white);

    border: 1px solid var(--border);
    border-radius: var(--radius-md);

    padding: 20px;

    box-shadow: var(--shadow-sm);

    overflow: hidden;

    transition:
        transform var(--transition-fast),
        border-color var(--transition-fast),
        box-shadow var(--transition-fast);
}

.stat-card::before {
    content: "";

    position: absolute;

    left: 0;
    top: 0;
    bottom: 0;

    width: 3px;

    background: var(--blue);
}

.stat-card:nth-child(2)::before,
.stat-card:nth-child(4)::before {
    background: var(--orange);
}

.stat-card:hover {
    transform: translateY(-2px);

    border-color: var(--border-strong);

    box-shadow:
        0 12px 30px rgba(11, 23, 40, 0.08);
}

.stat-top {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 12px;
}

.stat-label {
    color: var(--muted);

    font-size: 12px;
    font-weight: 600;
}

.stat-icon {
    width: 38px;
    height: 38px;

    border-radius: 11px;

    background: var(--blue-light);
    color: var(--blue);

    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-card:nth-child(2) .stat-icon,
.stat-card:nth-child(4) .stat-icon {
    background: var(--orange-light);
    color: var(--orange-dark);
}

.stat-icon svg {
    width: 19px;
    height: 19px;

    stroke: currentColor;
    fill: none;

    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.stat-value {
    margin-top: 12px;

    color: var(--black);

    font-family: var(--font-heading);

    font-size: 27px;
    font-weight: 800;
}

.stat-description {
    margin-top: 4px;

    color: var(--muted);

    font-size: 11px;
}

/* =========================================================
   PANEL
   ========================================================= */

.panel {
    background: var(--white);

    border: 1px solid var(--border);
    border-radius: var(--radius-md);

    box-shadow: var(--shadow-sm);

    overflow: hidden;
}

.toolbar {
    padding: 18px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 16px;

    border-bottom: 1px solid var(--border);
}

.toolbar-left {
    display: flex;
    align-items: center;

    gap: 10px;

    flex: 1;

    flex-wrap: wrap;
}

.search-box {
    position: relative;

    min-width: 270px;
    max-width: 430px;

    flex: 1;
}

.search-box svg {
    width: 17px;
    height: 17px;

    position: absolute;

    left: 13px;
    top: 50%;

    transform: translateY(-50%);

    stroke: var(--muted);
    fill: none;

    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;

    pointer-events: none;
}

.search-box input,
.filter-select {
    width: 100%;
    height: 42px;

    border: 1px solid var(--border);
    border-radius: 10px;

    background: var(--white);
    color: var(--text);

    outline: none;

    font-size: 12px;

    transition:
        border var(--transition-fast),
        box-shadow var(--transition-fast),
        background var(--transition-fast);
}

.search-box input {
    padding: 0 13px 0 39px;
}

.search-box input::placeholder {
    color: var(--muted-light);
}

.filter-select {
    min-width: 150px;
    padding: 0 12px;
}

.search-box input:focus,
.filter-select:focus {
    border-color: var(--blue);

    box-shadow:
        0 0 0 3px rgba(0, 87, 184, 0.09);
}

.secondary-button {
    height: 42px;

    border: 1px solid var(--border);
    border-radius: 10px;

    padding: 0 13px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    gap: 7px;

    background: var(--white);
    color: var(--text);

    font-size: 12px;
    font-weight: 700;

    transition:
        border-color var(--transition-fast),
        color var(--transition-fast),
        background var(--transition-fast);
}

.secondary-button:hover {
    border-color: var(--blue);
    background: var(--blue-light);
    color: var(--blue);
}

.secondary-button.loading svg {
    animation: activityRefreshSpin 0.8s linear infinite;
}

.secondary-button svg {
    width: 16px;
    height: 16px;

    stroke: currentColor;
    fill: none;

    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

@keyframes activityRefreshSpin {
    to {
        transform: rotate(360deg);
    }
}

/* =========================================================
   ACTIVITY LIST
   ========================================================= */

.panel-heading {
    padding: 20px 20px 0;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 16px;
}

.panel-heading h3 {
    color: var(--black);

    font-family: var(--font-heading);

    font-size: 15px;
    font-weight: 800;
}

.panel-heading span {
    color: var(--muted);
    font-size: 11px;
}

.activity-list {
    padding: 14px 20px 20px;
}

.activity-row {
    display: grid;

    grid-template-columns:
        44px
        minmax(0, 1fr)
        auto;

    gap: 13px;

    align-items: center;

    padding: 15px 10px;

    margin: 0 -10px;

    border-bottom: 1px solid var(--border);

    border-radius: 10px;

    cursor: pointer;

    transition:
        background var(--transition-fast),
        transform var(--transition-fast);
}

.activity-row:hover {
    background: var(--blue-lighter);
}

.activity-row:focus {
    outline: none;

    background: var(--blue-lighter);

    box-shadow:
        0 0 0 2px rgba(0, 87, 184, 0.15);
}

.activity-row:active {
    transform: scale(0.998);
}

.activity-row:last-child {
    border-bottom: 0;
}

.activity-icon {
    width: 40px;
    height: 40px;

    border-radius: 12px;

    display: flex;
    align-items: center;
    justify-content: center;
}

.activity-icon svg {
    width: 18px;
    height: 18px;

    stroke: currentColor;
    fill: none;

    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Created */
.activity-create {
    background: var(--blue-light);
    color: var(--blue);
}

/* Updated */
.activity-update {
    background: var(--blue-lighter);
    color: var(--blue);
}

/* Deleted */
.activity-delete {
    background: var(--orange-light);
    color: var(--orange-dark);
}

/* Login */
.activity-login {
    background: var(--blue-light);
    color: var(--blue-dark);
}

/* Status */
.activity-status {
    background: var(--orange-light);
    color: var(--orange-dark);
}

.activity-main {
    min-width: 0;
}

.activity-title {
    color: var(--black);

    font-size: 12px;
    font-weight: 700;

    line-height: 1.5;
}

.activity-title strong {
    color: var(--blue);
}

.activity-meta {
    margin-top: 4px;

    display: flex;
    align-items: center;
    flex-wrap: wrap;

    gap: 6px;

    color: var(--muted);

    font-size: 10px;
}

.activity-target {
    display: inline-flex;
    align-items: center;

    min-height: 23px;

    padding: 0 8px;

    border-radius: 999px;

    background: var(--blue-light);

    color: var(--blue-dark);

    font-size: 10px;
    font-weight: 700;
}

.activity-time {
    color: var(--muted);

    font-size: 10px;

    white-space: nowrap;
}

.activity-action {
    min-width: 75px;

    display: flex;
    justify-content: flex-end;
}

.action-badge {
    min-height: 26px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 0 9px;

    border-radius: 999px;

    font-size: 9px;
    font-weight: 800;

    text-transform: capitalize;
}

/* Created */
.action-created {
    background: var(--blue-light);
    color: var(--blue);
}

/* Updated */
.action-updated {
    background: var(--blue-lighter);
    color: var(--blue-dark);
}

/* Deleted */
.action-deleted {
    background: var(--orange-light);
    color: var(--orange-dark);
}

/* Login */
.action-login {
    background: var(--blue-light);
    color: var(--blue-dark);
}

/* Status */
.action-status {
    background: var(--orange-light);
    color: var(--orange-dark);
}

/* =========================================================
   EMPTY STATE
   ========================================================= */

.empty-state {
    display: none;

    padding: 65px 24px;

    text-align: center;
}

.empty-state.visible {
    display: block;
}

.empty-icon {
    width: 56px;
    height: 56px;

    margin: 0 auto 14px;

    border-radius: 16px;

    background: var(--blue-light);
    color: var(--blue);

    display: flex;
    align-items: center;
    justify-content: center;
}

.empty-icon svg {
    width: 26px;
    height: 26px;

    stroke: currentColor;
    fill: none;

    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.empty-state h3 {
    color: var(--black);

    font-family: var(--font-heading);

    font-size: 16px;
    font-weight: 800;
}

.empty-state p {
    max-width: 480px;

    margin: 7px auto 0;

    color: var(--muted);

    font-size: 12px;
    line-height: 1.65;
}

/* =========================================================
   DETAIL MODAL
   ========================================================= */

.modal-backdrop {
    position: fixed;
    inset: 0;

    z-index: 2000;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 24px;

    background: rgba(7, 20, 36, 0.55);

    backdrop-filter: blur(5px);

    opacity: 0;
    visibility: hidden;

    transition:
        opacity var(--transition-normal),
        visibility var(--transition-normal);
}

.modal-backdrop.open {
    opacity: 1;
    visibility: visible;
}

.modal {
    width: min(100%, 620px);

    max-height:
        min(760px, calc(100vh - 48px));

    overflow-y: auto;

    background: var(--white);

    border: 1px solid rgba(230, 235, 242, 0.9);

    border-radius: 20px;

    box-shadow: var(--shadow-md);

    transform:
        translateY(12px)
        scale(0.98);

    transition:
        transform var(--transition-normal);
}

.modal-backdrop.open .modal {
    transform:
        translateY(0)
        scale(1);
}

.modal-header {
    padding: 21px 22px;

    border-bottom: 1px solid var(--border);

    display: flex;
    align-items: flex-start;
    justify-content: space-between;

    gap: 16px;
}

.modal-header h3 {
    color: var(--black);

    font-family: var(--font-heading);

    font-size: 17px;
    font-weight: 800;
}

.modal-header p {
    margin-top: 4px;

    color: var(--muted);

    font-size: 11px;
    line-height: 1.5;
}

.modal-close {
    width: 34px;
    height: 34px;

    border: 1px solid var(--border);
    border-radius: 9px;

    background: var(--white);
    color: var(--muted);

    display: flex;
    align-items: center;
    justify-content: center;

    transition:
        border-color var(--transition-fast),
        background var(--transition-fast),
        color var(--transition-fast);
}

.modal-close:hover {
    border-color: var(--orange);
    background: var(--orange-light);
    color: var(--orange-dark);
}

.modal-close svg {
    width: 16px;
    height: 16px;

    stroke: currentColor;
    fill: none;

    stroke-width: 2;
    stroke-linecap: round;
}

.detail-grid {
    display: grid;

    grid-template-columns: 1fr 1fr;

    gap: 1px;

    background: var(--border);

    border-bottom: 1px solid var(--border);
}

.detail-item {
    padding: 16px 18px;

    background: var(--white);
}

.detail-label {
    color: var(--muted);

    font-size: 10px;
    font-weight: 700;

    text-transform: uppercase;
    letter-spacing: 0.07em;
}

.detail-value {
    margin-top: 5px;

    color: var(--black);

    font-size: 12px;
    font-weight: 700;

    word-break: break-word;
}

.detail-full {
    grid-column: 1 / -1;
}

.detail-json {
    margin: 18px;

    padding: 15px;

    border: 1px solid var(--border);
    border-radius: 12px;

    background: var(--light);

    color: var(--text);

    font-family:
        Consolas,
        "Courier New",
        monospace;

    font-size: 10px;

    line-height: 1.65;

    overflow-x: auto;

    white-space: pre-wrap;
    word-break: break-word;
}

/* =========================================================
   AUDIT METADATA
   ========================================================= */

.audit-metadata {
    display: flex;
    flex-direction: column;

    width: 100%;

    border: 1px solid var(--border);

    border-radius: 10px;

    overflow: hidden;

    background: var(--surface-soft);
}

.audit-metadata-row {
    display: grid;

    grid-template-columns:
        minmax(120px, 0.7fr)
        minmax(0, 1.3fr);

    gap: 12px;

    padding: 9px 10px;

    border-bottom: 1px solid var(--border);
}

.audit-metadata-row:last-child {
    border-bottom: 0;
}

.audit-metadata-key {
    color: var(--muted);

    font-size: 10px;
    font-weight: 700;
}

.audit-metadata-value {
    color: var(--black);

    font-size: 10px;
    font-weight: 600;

    word-break: break-word;
}

/* =========================================================
   SIDEBAR OVERLAY
   ========================================================= */

.sidebar-overlay {
    position: fixed;
    inset: 0;

    z-index: 950;

    background: rgba(7, 20, 36, 0.45);

    opacity: 0;
    visibility: hidden;

    transition:
        opacity var(--transition-normal),
        visibility var(--transition-normal);
}

.sidebar-overlay.open {
    opacity: 1;
    visibility: visible;
}

/* =========================================================
   ROLE CONTROL
   ========================================================= */

[data-role-only] {
    display: none !important;
}

body.role-owner [data-role-only~="owner"],
body.role-manager [data-role-only~="manager"] {
    display: inline-flex !important;
}

body.role-owner [data-role-block~="owner"],
body.role-manager [data-role-block~="manager"] {
    display: block !important;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr));
    }

    .content {
        padding: 28px;
    }
}

@media (max-width: 980px) {
    :root {
        --sidebar: 250px;
    }

    .sidebar {
        transform: translateX(-100%);

        transition:
            transform var(--transition-normal);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main {
        margin-left: 0;
    }

    .mobile-menu-button {
        display: flex;
    }

    .topbar {
        padding: 0 20px;
    }

    .page-intro {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 720px) {
    .content {
        padding: 22px 16px;
    }

    .topbar {
        padding: 0 16px;
    }

    .topbar-user-info {
        display: none;
    }

    .page-heading p {
        display: none;
    }

    .page-intro h2 {
        font-size: 23px;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 11px;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-value {
        font-size: 23px;
    }

    .toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .toolbar-left {
        width: 100%;

        flex-direction: column;
        align-items: stretch;
    }

    .search-box {
        width: 100%;
        max-width: none;
        min-width: 0;
    }

    .filter-select,
    .toolbar .secondary-button {
        width: 100%;
    }

    .activity-row {
        grid-template-columns:
            40px
            minmax(0, 1fr);
    }

    .activity-action {
        grid-column: 2;

        justify-content: flex-start;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .detail-full {
        grid-column: auto;
    }

    .audit-metadata-row {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .modal-backdrop {
        padding: 12px;
    }

    .modal {
        max-height:
            calc(100vh - 24px);
    }
}

@media (max-width: 430px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .notification-button {
        width: 38px;
        height: 38px;
    }

    .mobile-menu-button {
        width: 38px;
        height: 38px;
    }

    .activity-title {
        font-size: 11px;
    }

    .activity-meta {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition: none !important;
        animation: none !important;
    }
}