/* VendorPad Connected — Admin Panel Styles */

:root {
    --color-primary: #0E7570;
    --color-primary-dark: #0A5854;
    --color-primary-light: #12A09A;
    --color-accent: #D97706;
    --color-bg: #f8f9fa;
    --color-surface: #ffffff;
    --color-border: #e2e8f0;
    --color-text: #1a1a2e;
    --color-text-secondary: #64748b;
    --color-danger: #dc2626;
    --color-success: #16a34a;
    --color-warning: #f59e0b;
    --color-info: #3b82f6;
    --font-body: 'system-ui', -apple-system, 'Segoe UI', Roboto, sans-serif;
    --radius: 0.5rem;
    --radius-sm: 0.375rem;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,0.07);
    --sidebar-width: 240px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font-body);
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    font-size: 0.875rem;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ═══════════════════════════════════════
   Auth Layout
   ═══════════════════════════════════════ */

.auth-body {
    background: linear-gradient(135deg, var(--color-primary-dark) 0%, var(--color-primary) 100%);
    min-height: 100vh;
}

.auth-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--color-surface);
    border-radius: var(--radius);
    padding: 2.5rem 2rem;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    text-align: center;
}

.auth-card__logo {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.logo-vendor { color: var(--color-text); }
.logo-pad { color: var(--color-primary); }
.logo-tag-block {
    display: block;
    font-size: 0.6875rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--color-accent);
    margin-top: 0.125rem;
}

.auth-card__subtitle {
    color: var(--color-text-secondary);
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
}

.auth-form { text-align: left; }

/* ═══════════════════════════════════════
   Admin Layout (Sidebar + Content)
   ═══════════════════════════════════════ */

.admin-body { overflow: hidden; height: 100vh; }

.admin-layout {
    display: flex;
    height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--color-primary-dark);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    overflow-y: auto;
    transition: transform 0.25s ease;
}

.sidebar__header {
    padding: 1.25rem 1rem 0.75rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar__logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: white;
    text-decoration: none;
}

.sidebar__logo .logo-pad { color: rgba(255,255,255,0.6); }

.sidebar__tag {
    display: block;
    font-size: 0.5625rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--color-accent);
    margin-top: 0.125rem;
}

.sidebar__nav {
    flex: 1;
    padding: 0.5rem 0;
}

.sidebar__section {
    padding: 0.25rem 0;
}

.sidebar__heading {
    display: block;
    padding: 0.75rem 1rem 0.25rem;
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255,255,255,0.4);
}

.sidebar__item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 1rem;
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: 400;
    transition: all 0.15s ease;
    border-left: 3px solid transparent;
}

.sidebar__item:hover {
    background: rgba(255,255,255,0.08);
    color: white;
    text-decoration: none;
}

.sidebar__item--active {
    background: rgba(255,255,255,0.12);
    color: white;
    border-left-color: var(--color-accent);
    font-weight: 500;
}

.sidebar__icon {
    flex-shrink: 0;
    opacity: 0.7;
}

.sidebar__item--active .sidebar__icon { opacity: 1; }

/* Main area */
.admin-main-area {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* Top bar */
.topbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1.5rem;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar__toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    color: var(--color-text-secondary);
}

.topbar__title {
    font-size: 1.125rem;
    font-weight: 600;
    flex: 1;
}

.topbar__right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.topbar__admin {
    font-size: 0.8125rem;
    color: var(--color-text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.topbar__logout {
    font-size: 0.8125rem;
    color: var(--color-danger);
}

/* Role badges */
.role-badge {
    display: inline-flex;
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.role-badge--super_admin { background: #fef3c7; color: #92400e; }
.role-badge--admin { background: #dbeafe; color: #1e40af; }
.role-badge--viewer { background: #f1f5f9; color: #475569; }

/* Content area */
.admin-content {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    min-height: 0;
}

/* Mobile sidebar */
@media (max-width: 1023px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar--open {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0,0,0,0.3);
    }

    .admin-main-area {
        margin-left: 0;
    }

    .topbar__toggle {
        display: flex;
    }
}

/* ═══════════════════════════════════════
   Dashboard
   ═══════════════════════════════════════ */

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.kpi-card {
    background: var(--color-surface);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    border-left: 4px solid var(--color-primary);
}

.kpi-card--accent { border-left-color: var(--color-accent); }

.kpi-card__label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-secondary);
    margin-bottom: 0.375rem;
}

.kpi-card__value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.2;
}

.kpi-card__delta {
    font-size: 0.75rem;
    color: var(--color-text-secondary);
    margin-top: 0.25rem;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 2fr 1fr;
    }
}

.dashboard-section {
    background: var(--color-surface);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1.5rem;
}

.section-title {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--color-text);
}

/* Activity feed */
.activity-feed { max-height: 400px; overflow-y: auto; }

.activity-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--color-border);
}

.activity-item:last-child { border-bottom: none; }

.activity-item__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-primary);
    margin-top: 0.5rem;
    flex-shrink: 0;
}

.activity-item__text { font-size: 0.8125rem; }

.activity-item__meta {
    font-size: 0.6875rem;
    color: var(--color-text-secondary);
    margin-top: 0.125rem;
}

/* Alert items */
.alert-list { display: flex; flex-direction: column; gap: 0.5rem; }

.alert-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.625rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
}

.alert-item--info { background: #eff6ff; color: #1e40af; }
.alert-item--warning { background: #fefce8; color: #a16207; }
.alert-item--danger { background: #fef2f2; color: #b91c1c; }

.alert-item__icon { flex-shrink: 0; }
.alert-item__text { flex: 1; }
.alert-item__action { font-weight: 500; white-space: nowrap; }

/* ═══════════════════════════════════════
   Shared Components
   ═══════════════════════════════════════ */

/* Alerts (flash messages) */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

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

/* Forms */
.form-group { margin-bottom: 1rem; }

.form-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--color-text);
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-family: inherit;
    background: white;
    color: var(--color-text);
    transition: border-color 0.15s ease;
}

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

.form-input--sm, .form-select--sm {
    padding: 0.375rem 0.5rem;
    font-size: 0.8125rem;
    width: auto;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.5rem 1rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    font-family: inherit;
    transition: all 0.15s ease;
}

.btn--primary { background: var(--color-primary); color: white; }
.btn--primary:hover { background: var(--color-primary-dark); text-decoration: none; }
.btn--ghost { background: transparent; color: var(--color-text-secondary); border-color: var(--color-border); }
.btn--ghost:hover { background: var(--color-bg); text-decoration: none; }
.btn--danger { background: var(--color-danger); color: white; }
.btn--sm { padding: 0.25rem 0.625rem; font-size: 0.8125rem; }
.btn--full { width: 100%; }

/* Data tables */
.table-wrapper {
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
}

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

.data-table th, .data-table td {
    padding: 0.625rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
    font-size: 0.8125rem;
}

.data-table th {
    font-weight: 600;
    color: var(--color-text-secondary);
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    background: #fafafa;
    white-space: nowrap;
}

.clickable-row { cursor: pointer; }
.clickable-row:hover { background: #f8fafc; }

.empty-row { text-align: center; color: var(--color-text-secondary); padding: 2rem !important; }
.text-muted { color: var(--color-text-secondary); }
.nowrap { white-space: nowrap; }

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.badge--bug { background: #fef2f2; color: #b91c1c; }
.badge--feature_request { background: #eff6ff; color: #1d4ed8; }
.badge--general { background: #f0fdf4; color: #15803d; }
.badge--usability { background: #fefce8; color: #a16207; }
.badge--source { background: #f1f5f9; color: #475569; }

.badge--priority-low { background: #f0fdf4; color: #15803d; }
.badge--priority-medium { background: #fefce8; color: #a16207; }
.badge--priority-high { background: #fff7ed; color: #c2410c; }
.badge--priority-critical { background: #fef2f2; color: #b91c1c; }

.badge--status-new { background: #eff6ff; color: #1d4ed8; }
.badge--status-reviewed { background: #fefce8; color: #a16207; }
.badge--status-in_progress { background: #f5f3ff; color: #6d28d9; }
.badge--status-resolved { background: #f0fdf4; color: #15803d; }
.badge--status-wont_fix { background: #f1f5f9; color: #475569; }

.badge--active { background: #f0fdf4; color: #15803d; }
.badge--trialling { background: #fefce8; color: #a16207; }
.badge--past_due { background: #fef2f2; color: #b91c1c; }
.badge--cancelled { background: #f1f5f9; color: #475569; }

/* Filters bar */
.filters-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 1.25rem;
    padding: 0.75rem;
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1rem;
}

.pagination__link { font-size: 0.875rem; font-weight: 500; }
.pagination__info { color: var(--color-text-secondary); font-size: 0.8125rem; }

/* Cards */
.card {
    background: var(--color-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    margin-bottom: 1rem;
}

.card__header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.card__header h3 { font-size: 0.875rem; font-weight: 600; }
.card__body { padding: 1rem; }

/* Detail grid */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: 768px) {
    .detail-grid { grid-template-columns: 2fr 1fr; }
}

/* Page header */
.page-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.page-title { font-size: 1.5rem; font-weight: 700; }
.page-count { color: var(--color-text-secondary); font-size: 0.875rem; }

/* Meta list (detail sidebar) */
.meta-list { display: flex; flex-direction: column; gap: 0.625rem; }

.meta-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    font-size: 0.8125rem;
}

.meta-label { color: var(--color-text-secondary); font-weight: 500; white-space: nowrap; }
.meta-value { text-align: right; word-break: break-all; }

/* Screenshots */
.screenshot-img {
    max-width: 100%;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
}

.attachment-grid { display: flex; gap: 0.75rem; flex-wrap: wrap; }

.attachment-thumb img {
    width: 8rem;
    height: 8rem;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
}

.feedback-notes { white-space: pre-wrap; line-height: 1.7; }
.notes-cell { max-width: 20rem; }
.device-info { font-size: 0.6875rem; max-width: 14rem; }

/* Stats grid (business detail) */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
}

.stat-item {
    text-align: center;
    padding: 0.75rem 0.5rem;
    background: var(--color-bg);
    border-radius: var(--radius-sm);
}

.stat-item__value {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-item__label {
    display: block;
    font-size: 0.6875rem;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 0.25rem;
}

/* Action list (sidebar buttons) */
.action-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.action-form { margin: 0; }

/* Plan badge */
.badge--plan { background: #dbeafe; color: #1e40af; }
