/**
 * Murphy Software Labs - Admin Panel Styles
 */

/* =============================================
   CSS Variables
   ============================================= */
:root {
    --admin-sidebar-width: 250px;
    --admin-topbar-height: 56px;
    --color-primary: #2563eb;
    --color-primary-hover: #1d4ed8;
    --color-secondary: #f3f4f6;
    --color-text: #1a1a1a;
    --color-text-muted: #6b7280;
    --color-border: #e5e7eb;
    --color-surface: #ffffff;
    --color-background: #fafbfc;
    --color-success: #16a34a;
    --color-warning: #ca8a04;
    --color-error: #dc2626;
    --color-info: #0284c7;
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --border-radius: var(--radius-md);
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --transition-fast: 150ms ease;
}

/* =============================================
   Reset & Base
   ============================================= */
*, *::before, *::after {
    box-sizing: border-box;
}

/* =============================================
   Admin Body
   ============================================= */
.admin-body {
    margin: 0;
    padding: 0;
    background: var(--color-background);
    min-height: 100vh;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--color-text);
    line-height: 1.5;
}

/* =============================================
   Admin Top Bar
   ============================================= */
.admin-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--admin-topbar-height);
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-lg);
    z-index: 100;
}

.admin-topbar__left {
    display: flex;
    align-items: center;
}

.admin-topbar__logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    text-decoration: none;
    color: var(--color-text);
    font-weight: 600;
}

.admin-topbar__logo:hover {
    text-decoration: none;
}

.admin-topbar__logo-icon {
    width: 28px;
    height: 28px;
}

.admin-topbar__logo-text {
    font-size: 1rem;
}

.admin-topbar__right {
    display: flex;
    align-items: center;
    gap: var(--space-lg);
}

.admin-topbar__user {
    font-size: 0.875rem;
    color: var(--color-text-muted);
}

.admin-topbar__logout {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    text-decoration: none;
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.admin-topbar__logout:hover {
    color: var(--color-error);
    background: #fef2f2;
    text-decoration: none;
}

/* =============================================
   Flash Messages
   ============================================= */
.admin-flash {
    position: fixed;
    top: var(--admin-topbar-height);
    left: var(--admin-sidebar-width);
    right: 0;
    z-index: 90;
    padding: var(--space-md);
}

.admin-flash .alert {
    max-width: 600px;
    margin: 0 auto;
}

/* =============================================
   Admin Layout (Sidebar + Content)
   ============================================= */
.admin-layout {
    display: flex;
    min-height: calc(100vh - var(--admin-topbar-height));
    margin-top: var(--admin-topbar-height);
}

/* =============================================
   Admin Sidebar
   ============================================= */
.admin-sidebar {
    position: fixed;
    top: var(--admin-topbar-height);
    left: 0;
    bottom: 0;
    width: var(--admin-sidebar-width);
    background: var(--color-text);
    color: white;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.admin-sidebar__header {
    padding: var(--space-lg) var(--space-md) var(--space-sm);
}

.admin-sidebar__title {
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255, 255, 255, 0.4);
    margin: 0;
    padding: 0 var(--space-md);
}

.admin-sidebar__nav {
    list-style: none;
    margin: 0;
    padding: 0;
}

.admin-sidebar__link {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-lg);
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    font-size: 0.9375rem;
    transition: all var(--transition-fast);
    border-left: 3px solid transparent;
}

.admin-sidebar__link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    text-decoration: none;
}

.admin-sidebar__link:focus {
    outline: none;
}

.admin-sidebar__link--active {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-left-color: var(--color-primary);
}

.admin-sidebar__link--sub {
    padding-left: calc(var(--space-lg) + var(--space-md));
    font-size: 0.875rem;
}

.admin-sidebar__icon {
    font-size: 1rem;
    width: 1.25rem;
    text-align: center;
}

.admin-sidebar__footer {
    margin-top: auto;
    padding: var(--space-lg) 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* =============================================
   Admin Content Area
   ============================================= */
.admin-content {
    flex: 1;
    margin-left: var(--admin-sidebar-width);
    padding: var(--space-xl);
    min-height: calc(100vh - var(--admin-topbar-height));
}

/* =============================================
   Page Header
   ============================================= */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-xl);
}

.page-header h1 {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 600;
}

/* =============================================
   Cards
   ============================================= */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
}

.card-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0;
}

/* =============================================
   Buttons
   ============================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-md);
    border: none;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--color-primary);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: var(--color-primary-hover);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-text);
}

.btn-outline:hover:not(:disabled) {
    background: var(--color-secondary);
    border-color: var(--color-text-muted);
}

.btn-danger {
    background: var(--color-error);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #b91c1c;
}

.btn-success {
    background: var(--color-success);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: #15803d;
}

.btn-sm {
    padding: var(--space-xs) var(--space-sm);
    font-size: 0.8125rem;
}

.btn-lg {
    padding: var(--space-md) var(--space-lg);
    font-size: 1rem;
}

/* =============================================
   Forms
   ============================================= */
.form-group {
    margin-bottom: var(--space-lg);
}

.form-label {
    display: block;
    margin-bottom: var(--space-sm);
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--color-text);
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: var(--space-sm) var(--space-md);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-family: inherit;
    color: var(--color-text);
    background: var(--color-surface);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--color-text-muted);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

.form-select {
    cursor: pointer;
}

.form-hint {
    display: block;
    margin-top: var(--space-xs);
    font-size: 0.8125rem;
    color: var(--color-text-muted);
}

/* =============================================
   Alerts
   ============================================= */
.alert {
    padding: var(--space-md);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-lg);
    font-size: 0.9375rem;
}

.alert p {
    margin: 0;
}

.alert-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: var(--color-success);
}

.alert-warning {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: var(--color-warning);
}

.alert-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: var(--color-error);
}

.alert-info {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: var(--color-primary);
}

/* =============================================
   Tables
   ============================================= */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: var(--space-md);
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}

.table th {
    font-weight: 600;
    font-size: 0.8125rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.025em;
    background: var(--color-secondary);
}

.table th:first-child {
    border-radius: var(--radius-md) 0 0 0;
}

.table th:last-child {
    border-radius: 0 var(--radius-md) 0 0;
}

.table tbody tr:hover {
    background: var(--color-secondary);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* =============================================
   Stats Grid
   ============================================= */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
}

.stat-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
}

.stat-card__label {
    font-size: 0.875rem;
    color: var(--color-text-muted);
    margin: 0 0 var(--space-xs);
}

.stat-card__value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--color-text);
    margin: 0;
}

/* =============================================
   Status Badges
   ============================================= */
.badge {
    display: inline-block;
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.badge-draft {
    background: var(--color-secondary);
    color: var(--color-text-muted);
}

.badge-published {
    background: #dcfce7;
    color: var(--color-success);
}

.badge-archived {
    background: #fef3c7;
    color: var(--color-warning);
}

.badge-pending {
    background: #fef3c7;
    color: var(--color-warning);
}

.badge-processing {
    background: #dbeafe;
    color: var(--color-primary);
}

.badge-completed {
    background: #dcfce7;
    color: var(--color-success);
}

.badge-failed {
    background: #fef2f2;
    color: var(--color-error);
}

/* =============================================
   Empty State
   ============================================= */
.empty-state {
    text-align: center;
    padding: var(--space-xl) var(--space-lg);
    color: var(--color-text-muted);
}

.empty-state__icon {
    font-size: 3rem;
    margin-bottom: var(--space-md);
    opacity: 0.5;
}

.empty-state__text {
    font-size: 1rem;
    margin: 0 0 var(--space-lg);
}

/* =============================================
   Utilities
   ============================================= */
.text-muted {
    color: var(--color-text-muted);
}

.text-sm {
    font-size: 0.875rem;
}

.text-center {
    text-align: center;
}

.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }

.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }

/* =============================================
   Responsive
   ============================================= */
@media (max-width: 1024px) {
    :root {
        --admin-sidebar-width: 220px;
    }
}

@media (max-width: 768px) {
    .admin-sidebar {
        display: none;
    }

    .admin-content {
        margin-left: 0;
        padding: var(--space-md);
    }

    .admin-flash {
        left: 0;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-md);
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}
