/* ==========================================
   Admin Panel Styles - Shadcn-Inspired
   ========================================== */

/* Admin Layout */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.admin-sidebar {
    width: 260px;
    background: hsl(var(--card));
    border-right: 1px solid hsl(var(--border));
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 40;
    transition: transform 0.2s ease;
}

.admin-sidebar.collapsed {
    transform: translateX(-100%);
}

.sidebar-header {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid hsl(var(--border));
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: hsl(var(--foreground));
}

.sidebar-nav {
    flex: 1;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0.75rem;
    border-radius: var(--radius);
    color: hsl(var(--muted-foreground));
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background 0.15s ease, color 0.15s ease;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.nav-item:hover {
    background: hsl(var(--accent));
    color: hsl(var(--accent-foreground));
}

.nav-item.active {
    background: hsl(var(--accent));
    color: hsl(var(--accent-foreground));
    font-weight: 600;
}

.sidebar-footer {
    padding: 0.75rem;
    border-top: 1px solid hsl(var(--border));
}

/* Main Content */
.admin-main {
    flex: 1;
    margin-left: 260px;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left 0.2s ease;
}

.admin-sidebar.collapsed + .admin-main {
    margin-left: 0;
}

/* Top Bar */
.admin-topbar {
    background: hsl(var(--card));
    border-bottom: 1px solid hsl(var(--border));
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 30;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.topbar-title {
    font-size: 1.125rem;
    font-weight: 600;
}

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

.admin-user {
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem;
    color: hsl(var(--foreground));
}

/* Content Area */
.admin-content {
    padding: 1.5rem;
    flex: 1;
}

/* Sections */
.admin-section {
    display: none;
}

.admin-section.active {
    display: block;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.stat-card {
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    padding: 1.25rem;
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: hsl(var(--muted-foreground));
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: hsl(var(--foreground));
    margin-top: 0.25rem;
}

/* Cards */
.card {
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
}

.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid hsl(var(--border));
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
}

.card-body {
    padding: 1.25rem;
}

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

/* Buttons */
.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

.btn-xs {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    border-radius: calc(var(--radius) - 2px);
}

.btn-danger {
    background: hsl(0, 72%, 51%);
    color: white;
    border: 1px solid hsl(0, 72%, 51%);
}

.btn-danger:hover {
    background: hsl(0, 72%, 45%);
}

.btn-success {
    background: hsl(142, 71%, 45%);
    color: white;
    border: 1px solid hsl(142, 71%, 45%);
}

.btn-success:hover {
    background: hsl(142, 71%, 38%);
}

.btn-outline {
    background: transparent;
    border: 1px solid hsl(var(--border));
    color: hsl(var(--foreground));
    cursor: pointer;
}

.btn-outline:hover {
    background: hsl(var(--accent));
}

/* Filters Bar */
.filters-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.filters-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.filters-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    color: hsl(var(--muted-foreground));
    pointer-events: none;
}

.search-input {
    padding: 0.5rem 0.75rem 0.5rem 2.25rem;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    background: hsl(var(--background));
    color: hsl(var(--foreground));
    font-size: 0.875rem;
    width: 260px;
    outline: none;
    transition: border-color 0.15s ease;
}

.search-input:focus {
    border-color: hsl(var(--ring));
}

.search-input::placeholder {
    color: hsl(var(--muted-foreground));
}

.filter-select {
    padding: 0.5rem 0.75rem;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    background: hsl(var(--background));
    color: hsl(var(--foreground));
    font-size: 0.875rem;
    outline: none;
    cursor: pointer;
}

.filter-select:focus {
    border-color: hsl(var(--ring));
}

.results-count {
    font-size: 0.8125rem;
    color: hsl(var(--muted-foreground));
    white-space: nowrap;
}

/* Admin Table */
.table-wrapper {
    overflow-x: auto;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.admin-table thead {
    background: hsl(var(--muted) / 0.5);
}

.admin-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: hsl(var(--muted-foreground));
    white-space: nowrap;
    border-bottom: 1px solid hsl(var(--border));
}

.admin-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid hsl(var(--border));
    color: hsl(var(--foreground));
    vertical-align: middle;
}

.admin-table tbody tr:hover {
    background: hsl(var(--muted) / 0.3);
}

.admin-table .table-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: hsl(var(--muted-foreground));
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.5;
    white-space: nowrap;
}

.badge-admin {
    background: hsl(262, 83%, 58%, 0.15);
    color: hsl(262, 83%, 58%);
}

.badge-user {
    background: hsl(var(--muted) / 0.5);
    color: hsl(var(--muted-foreground));
}

.badge-active {
    background: hsl(142, 71%, 45%, 0.15);
    color: hsl(142, 71%, 45%);
}

.badge-inactive {
    background: hsl(0, 72%, 51%, 0.15);
    color: hsl(0, 72%, 51%);
}

.badge-verified {
    background: hsl(199, 89%, 48%, 0.15);
    color: hsl(199, 89%, 48%);
}

.badge-unverified {
    background: hsl(45, 93%, 47%, 0.15);
    color: hsl(45, 93%, 40%);
}

.badge-completed {
    background: hsl(142, 71%, 45%, 0.15);
    color: hsl(142, 71%, 45%);
}

.badge-processing {
    background: hsl(199, 89%, 48%, 0.15);
    color: hsl(199, 89%, 48%);
}

.badge-pending {
    background: hsl(45, 93%, 47%, 0.15);
    color: hsl(45, 93%, 40%);
}

.badge-failed {
    background: hsl(0, 72%, 51%, 0.15);
    color: hsl(0, 72%, 51%);
}

.badge-pending_approval {
    background: hsl(25, 95%, 53%, 0.15);
    color: hsl(25, 95%, 40%);
}

.badge-approved {
    background: hsl(142, 71%, 45%, 0.15);
    color: hsl(142, 71%, 45%);
}

.badge-rejected {
    background: hsl(0, 72%, 51%, 0.15);
    color: hsl(0, 72%, 51%);
}

.badge-none {
    background: hsl(var(--muted) / 0.5);
    color: hsl(var(--muted-foreground));
}

/* Sidebar notification badge */
.nav-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.3rem;
    border-radius: 9999px;
    background: hsl(25, 95%, 53%);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    line-height: 1;
    margin-left: auto;
}

/* Action buttons group */
.action-group {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.action-btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    border-radius: calc(var(--radius) - 2px);
    border: 1px solid hsl(var(--border));
    background: transparent;
    color: hsl(var(--foreground));
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.action-btn:hover {
    background: hsl(var(--accent));
}

.action-btn.danger {
    color: hsl(0, 72%, 51%);
    border-color: hsl(0, 72%, 51%, 0.3);
}

.action-btn.danger:hover {
    background: hsl(0, 72%, 51%, 0.1);
}

.action-btn.success {
    color: hsl(142, 71%, 45%);
    border-color: hsl(142, 71%, 45%, 0.3);
}

.action-btn.success:hover {
    background: hsl(142, 71%, 45%, 0.1);
}

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

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

.pagination-btn {
    padding: 0.375rem 0.75rem;
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    background: hsl(var(--card));
    color: hsl(var(--foreground));
    font-size: 0.8125rem;
    cursor: pointer;
    transition: background 0.15s ease;
}

.pagination-btn:hover:not(:disabled) {
    background: hsl(var(--accent));
}

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

.pagination-btn.active {
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    border-color: hsl(var(--primary));
}

.pagination-info {
    font-size: 0.8125rem;
    color: hsl(var(--muted-foreground));
    margin: 0 0.5rem;
}

/* Confirm dialog overlay */
.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.confirm-dialog {
    background: hsl(var(--card));
    border: 1px solid hsl(var(--border));
    border-radius: var(--radius);
    padding: 1.5rem;
    max-width: 400px;
    width: 90%;
}

.confirm-dialog h3 {
    margin: 0 0 0.5rem;
    font-size: 1rem;
    font-weight: 600;
}

.confirm-dialog p {
    margin: 0 0 1.25rem;
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
}

.confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

.confirm-actions button {
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    cursor: pointer;
    border: 1px solid hsl(var(--border));
    background: hsl(var(--card));
    color: hsl(var(--foreground));
    transition: background 0.15s ease;
}

.confirm-actions button:hover {
    background: hsl(var(--accent));
}

.confirm-actions .confirm-yes {
    background: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    border-color: hsl(var(--primary));
}

.confirm-actions .confirm-yes:hover {
    opacity: 0.9;
}

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

.detail-row {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.detail-label {
    font-size: 0.75rem;
    font-weight: 500;
    color: hsl(var(--muted-foreground));
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.detail-value {
    font-size: 0.875rem;
    color: hsl(var(--foreground));
    word-break: break-word;
}

.detail-preview {
    margin-top: 0.375rem;
    padding: 0.75rem;
    background: hsl(var(--muted) / 0.3);
    border-radius: var(--radius);
    font-size: 0.8125rem;
    color: hsl(var(--foreground));
    line-height: 1.5;
    max-height: 150px;
    overflow-y: auto;
}

/* Analytics Dashboard */
.analytics-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1rem;
}

.analytics-card {
    min-height: 0;
}

.chart-container {
    position: relative;
    height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.analytics-stat-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.analytics-stat-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid hsl(var(--border));
}

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

.analytics-stat-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.analytics-stat-name {
    flex: 1;
    font-size: 0.875rem;
    color: hsl(var(--muted-foreground));
}

.analytics-stat-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: hsl(var(--foreground));
}

/* Responsive */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

    .admin-sidebar {
        transform: translateX(-100%);
    }

    .admin-sidebar.open {
        transform: translateX(0);
    }

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

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

    .analytics-row {
        grid-template-columns: 1fr;
    }

    .filters-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filters-left {
        flex-direction: column;
    }

    .search-input {
        width: 100%;
    }

    .filter-select {
        width: 100%;
    }
}
