/* Activity Log Admin Styles */

/* Main layout override - make sidebar sticky */
.sb-module-layout .sb-module-sidebar {
    position: sticky;
    top: 52px;
}

.sb-module-main {
    flex: 1;
    min-width: 0;
}

/* Filter badge */
.activity-log-filter-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 6px;
    margin-left: 8px;
    font-size: 10px;
    font-weight: 600;
    color: white;
    background: var(--primary-500);
    border-radius: 9px;
}

/* Action buttons */
.activity-log-action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 500;
    color: #475569;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.activity-log-action-btn:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #334155;
}

.activity-log-action-btn:active {
    transform: translateY(1px);
}

.activity-log-action-btn svg {
    flex-shrink: 0;
    opacity: 0.7;
}

.activity-log-action-btn:hover svg {
    opacity: 1;
}

.activity-log-action-btn-primary {
    color: white;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    border-color: #2563eb;
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.15);
}

.activity-log-action-btn-primary svg {
    opacity: 0.9;
}

.activity-log-action-btn-primary:hover {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    border-color: #1d4ed8;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.25);
    color: white;
}

.activity-log-action-btn-danger {
    color: white;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    border-color: #dc2626;
    box-shadow: 0 1px 2px rgba(220, 38, 38, 0.15);
}

.activity-log-action-btn-danger:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    border-color: #b91c1c;
    box-shadow: 0 2px 4px rgba(220, 38, 38, 0.25);
    color: white;
}

/* Toggle switch */
.activity-log-toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.activity-log-toggle-input {
    display: none;
}

.activity-log-toggle-slider {
    position: relative;
    width: 36px;
    height: 20px;
    background: #cbd5e1;
    border-radius: 10px;
    transition: background 0.2s ease;
    flex-shrink: 0;
}

.activity-log-toggle-slider::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s ease;
}

.activity-log-toggle-input:checked + .activity-log-toggle-slider {
    background: #3b82f6;
}

.activity-log-toggle-input:checked + .activity-log-toggle-slider::after {
    transform: translateX(16px);
}

.activity-log-toggle-label {
    font-size: 13px;
    font-weight: 500;
    color: #64748b;
}

/* Loading skeleton */
.activity-log-skeleton-row td {
    padding: 14px 16px;
}

.activity-log-skeleton {
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite;
    border-radius: 4px;
    height: 16px;
}

.activity-log-skeleton-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.activity-log-skeleton-badge {
    width: 70px;
    height: 22px;
    border-radius: 11px;
}

.activity-log-skeleton-text {
    height: 14px;
}

.activity-log-skeleton-text-sm {
    height: 12px;
    width: 80px;
}

.activity-log-skeleton-text-md {
    height: 14px;
    width: 120px;
}

.activity-log-skeleton-text-lg {
    height: 14px;
    width: 180px;
}

@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Filter form styling */
.activity-log-filters-form .sb-module-field {
    margin-bottom: 14px;
}

.activity-log-filters-form .sb-module-field:last-child {
    margin-bottom: 0;
}

.activity-log-filters-form label {
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    display: block;
}

/* Form inputs */
.activity-log-select,
.activity-log-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 13px;
    color: #334155;
    background: white;
    transition: all 0.15s ease;
    line-height: 1.4;
}

.activity-log-select:hover,
.activity-log-input:hover {
    border-color: #cbd5e1;
}

.activity-log-select:focus,
.activity-log-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.activity-log-select-sm {
    padding: 6px 10px;
    font-size: 12px;
}

/* Custom date range */
.activity-log-custom-dates {
    margin-top: -6px;
    padding: 12px;
    background: #f8fafc;
    border-radius: 6px;
    margin-bottom: 14px;
    border: 1px solid #f1f5f9;
}

.activity-log-custom-dates .sb-module-field {
    margin-bottom: 10px;
}

.activity-log-custom-dates .sb-module-field:last-child {
    margin-bottom: 0;
}

/* Per page selector */
.activity-log-per-page {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #64748b;
}

.activity-log-per-page label {
    white-space: nowrap;
    font-weight: 500;
}

/* Bulk actions */
.activity-log-bulk-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-right: 16px;
}

.activity-log-selected-count {
    font-size: 12px;
    color: #64748b;
    font-weight: 500;
}

/* Table Styles */
.activity-log-table {
    width: 100%;
}

.activity-log-table th {
    font-size: 11px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.activity-log-table td {
    font-size: 13px;
    color: #475569;
    vertical-align: middle;
}

.activity-log-table th.sortable {
    cursor: pointer;
    user-select: none;
    transition: all 0.15s ease;
}

.activity-log-table th.sortable:hover {
    background: #f8fafc;
    color: #334155;
}

.activity-log-table th.sortable.active {
    color: #3b82f6;
}

.sort-indicator {
    margin-left: 4px;
    opacity: 0.4;
    font-size: 10px;
}

.sort-indicator::after {
    content: '↕';
    font-family: sans-serif;
}

th.sortable.active .sort-indicator {
    opacity: 1;
}

th.sortable.asc .sort-indicator::after {
    content: '↑';
}

th.sortable.desc .sort-indicator::after {
    content: '↓';
}

/* Row Styles - Subtle backgrounds */
.activity-log-row-critical {
    background: #fef2f2 !important;
    border-left: 3px solid #fca5a5 !important;
}

.activity-log-row-critical:hover {
    background: #fee2e2 !important;
}

.activity-log-row-warning {
    background: #fffbeb !important;
    border-left: 3px solid #fcd34d !important;
}

.activity-log-row-warning:hover {
    background: #fef3c7 !important;
}

/* Checkbox */
.activity-log-checkbox {
    width: 16px;
    height: 16px;
    margin: 0;
    cursor: pointer;
    accent-color: #3b82f6;
}

/* Date column - Refined typography */
.activity-log-col-date {
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Consolas', monospace;
    font-size: 11px;
    color: #94a3b8;
    white-space: nowrap;
    letter-spacing: -0.2px;
}

/* User column */
.activity-log-user-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.activity-log-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #818cf8, #6366f1);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
    text-transform: uppercase;
    box-shadow: 0 1px 2px rgba(99, 102, 241, 0.2);
}

.activity-log-user-name {
    font-weight: 500;
    color: #334155;
    font-size: 13px;
}

/* IP Address - More subtle */
.activity-log-ip {
    background: #f1f5f9;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Consolas', monospace;
    color: #64748b;
    letter-spacing: -0.2px;
}

/* Badges - Refined and subtle */
.activity-log-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    text-transform: capitalize;
    white-space: nowrap;
    letter-spacing: -0.1px;
}

/* Action/Severity Badges - Softer colors */
.activity-log-badge-critical {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.activity-log-badge-success {
    background: #f0fdf4;
    color: #15803d;
    border: 1px solid #bbf7d0;
}

.activity-log-badge-warning {
    background: #fffbeb;
    color: #b45309;
    border: 1px solid #fde68a;
}

.activity-log-badge-info {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

.activity-log-badge-default {
    background: #f8fafc;
    color: #475569;
    border: 1px solid #e2e8f0;
}

/* Role Badges - Subtle variations */
.activity-log-badge-admin {
    background: #faf5ff;
    color: #7c3aed;
    border: 1px solid #e9d5ff;
}

.activity-log-badge-editor {
    background: #eff6ff;
    color: #2563eb;
    border: 1px solid #bfdbfe;
}

.activity-log-badge-author {
    background: #ecfdf5;
    color: #059669;
    border: 1px solid #a7f3d0;
}

.activity-log-badge-contributor {
    background: #fff7ed;
    color: #c2410c;
    border: 1px solid #fed7aa;
}

.activity-log-badge-subscriber {
    background: #f8fafc;
    color: #475569;
    border: 1px solid #e2e8f0;
}

.activity-log-badge-guest {
    background: #f8fafc;
    color: #94a3b8;
    border: 1px solid #e2e8f0;
    font-style: italic;
}

/* Object Column */
.activity-log-object-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    white-space: nowrap;
}

.activity-log-object-name {
    font-weight: 500;
    color: #334155;
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex-shrink: 1;
    font-size: 13px;
}

.activity-log-object-type {
    font-size: 11px;
    color: #94a3b8;
    flex-shrink: 0;
}

.activity-log-no-data {
    color: #cbd5e1;
    font-size: 13px;
}

/* Action Buttons - Refined */
.activity-log-actions-wrapper {
    display: flex;
    gap: 4px;
    justify-content: flex-end;
    opacity: 0;
    transition: opacity 0.2s ease;
}

tr:hover .activity-log-actions-wrapper {
    opacity: 1;
}

.activity-log-expand-btn,
.activity-log-delete-btn {
    padding: 5px;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    color: #94a3b8;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.activity-log-expand-btn:hover {
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #3b82f6;
}

.activity-log-delete-btn:hover {
    background: #fef2f2;
    border-color: #fecaca;
    color: #ef4444;
}

.activity-log-expand-btn .dashicons,
.activity-log-delete-btn .dashicons {
    width: 16px;
    height: 16px;
    font-size: 16px;
}

/* Modal Styles - Refined */
.activity-log-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.activity-log-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(2px);
}

.activity-log-modal-content {
    position: relative;
    background: white;
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    max-width: 480px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.activity-log-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #f1f5f9;
    background: white;
}

.activity-log-modal-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #1e293b;
}

.activity-log-modal-close {
    background: none;
    border: none;
    font-size: 20px;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    transition: color 0.15s ease;
    border-radius: 4px;
}

.activity-log-modal-close:hover {
    color: #475569;
    background: #f1f5f9;
}

.activity-log-modal-body {
    padding: 20px;
    overflow-y: auto;
}

.activity-log-modal-body p {
    margin: 0;
    font-size: 14px;
    color: #64748b;
    line-height: 1.6;
}

.activity-log-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 20px;
    border-top: 1px solid #f1f5f9;
    background: #f8fafc;
}

.activity-log-user-agent-text {
    background: #f8fafc;
    padding: 14px;
    border-radius: 8px;
    font-size: 11px;
    font-family: 'SF Mono', Monaco, 'Cascadia Code', 'Consolas', monospace;
    color: #64748b;
    margin: 0;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 280px;
    overflow-y: auto;
    border: 1px solid #e2e8f0;
    line-height: 1.5;
}

/* Responsive Styles */
@media (max-width: 1200px) {
    .sb-module-layout {
        grid-template-columns: 260px 1fr;
    }
}

@media (max-width: 1024px) {
    .sb-module-layout {
        grid-template-columns: 1fr;
    }

    .sb-module-layout .sb-module-sidebar {
        position: relative;
        top: 0;
    }

    .sb-module-table-wrapper {
        overflow-x: auto;
    }

    .activity-log-table {
        min-width: 800px;
    }
}

@media (max-width: 782px) {
    .sb-module-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .sb-module-card-header-right {
        width: 100%;
        justify-content: space-between;
    }

    .activity-log-bulk-actions {
        margin-right: 0;
    }

    .activity-log-modal-content {
        margin: 20px;
        width: calc(100% - 40px);
    }
}
