/* Admin Panel Styles - matching main site design */

/* Back link style */
.nav-item.back-link {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
    color: #6b7280;
}

.nav-item.back-link:hover {
    background: #f3f4f6;
    color: #1a1a1a;
}

/* Page Header */
.admin-header {
    margin-bottom: 32px;
}

.admin-header h1 {
    font-size: 28px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 8px 0;
}

.admin-header .subtitle {
    color: #6b7280;
    font-size: 15px;
    margin: 0;
}

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.metrics-row {
    margin-bottom: 24px;
}

.metric-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 24px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    transition: border-color 0.2s;
}

.metric-card:hover {
    border-color: #d1d5db;
}

.metric-card.wide {
    grid-column: span 2;
}

.metric-card.loading {
    opacity: 0.6;
}

.metric-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: #f9fafb;
}

.metric-icon svg {
    width: 22px;
    height: 22px;
    color: #6b7280;
}

.metric-content {
    flex: 1;
    min-width: 0;
}

.metric-value {
    font-size: 24px;
    font-weight: 600;
    color: #1a1a1a;
    line-height: 1.2;
    margin-bottom: 4px;
}

.metric-label {
    font-size: 14px;
    color: #6b7280;
}

/* User Distribution */
.user-distribution {
    display: flex;
    gap: 48px;
    margin-top: 16px;
}

.dist-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dist-value {
    font-size: 28px;
    font-weight: 600;
    color: #1a1a1a;
}

.dist-label {
    font-size: 14px;
    color: #6b7280;
}

/* Colored indicators for distribution */
.dist-item.trial .dist-value::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 2px;
    background: #f59e0b;
    margin-right: 8px;
    vertical-align: middle;
}

.dist-item.paid .dist-value::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 2px;
    background: #10b981;
    margin-right: 8px;
    vertical-align: middle;
}

/* Admin Toolbar */
.admin-toolbar {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    align-items: center;
}

.search-box {
    display: flex;
    gap: 8px;
    flex: 1;
    max-width: 400px;
}

.search-box input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
}

.search-box input:focus {
    outline: none;
    border-color: #1a1a1a;
}

.search-box input::placeholder {
    color: #9ca3af;
}

.btn-search {
    padding: 12px 24px;
    background: #1a1a1a;
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    transition: background 0.2s;
}

.btn-search:hover {
    background: #333;
}

.filters select {
    padding: 12px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
    cursor: pointer;
    color: #1a1a1a;
}

.filters select:focus {
    outline: none;
    border-color: #1a1a1a;
}

/* Users Table */
.users-table-container {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
}

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

.users-table th,
.users-table td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

.users-table th {
    background: #f9fafb;
    font-weight: 500;
    color: #6b7280;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.users-table tbody tr:hover {
    background: #f9fafb;
}

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

.users-table tr.inactive {
    opacity: 0.5;
}

.loading-row,
.error-row,
.empty-row {
    text-align: center;
    color: #6b7280;
    padding: 48px 16px !important;
}

.error-row {
    color: #ef4444;
}

/* User Email Cell */
.user-email-cell {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
}

.badge.admin {
    background: #fef3c7;
    color: #b45309;
}

.badge.unlimited {
    background: #dbeafe;
    color: #1d4ed8;
}

.badge.plan {
    background: #f3f4f6;
    color: #4b5563;
}

/* Status */
.status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

.status.active {
    background: #d1fae5;
    color: #065f46;
}

.status.inactive {
    background: #fee2e2;
    color: #991b1b;
}

/* Buttons */
.btn-icon {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: #6b7280;
    border-radius: 6px;
    transition: background 0.2s, color 0.2s;
}

.btn-icon:hover {
    background: #f3f4f6;
    color: #1a1a1a;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 24px;
    padding: 16px 0;
}

.pagination button {
    padding: 8px 16px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.pagination button:hover {
    border-color: #1a1a1a;
}

.page-info {
    color: #6b7280;
    font-size: 14px;
}

.total-count {
    color: #6b7280;
    font-size: 14px;
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal {
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    color: #1a1a1a;
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #6b7280;
    line-height: 1;
    padding: 4px;
    border-radius: 4px;
}

.modal-close:hover {
    background: #f3f4f6;
    color: #1a1a1a;
}

.modal-body {
    padding: 24px;
}

/* Form */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #1a1a1a;
    font-size: 14px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #1a1a1a;
}

.form-group input:disabled {
    background: #f9fafb;
    color: #6b7280;
}

.form-group.checkbox label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 400;
}

.form-group.checkbox input {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
}

.btn-primary,
.btn-secondary {
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: #1a1a1a;
    color: #fff;
    border: none;
}

.btn-primary:hover {
    background: #333;
}

.btn-secondary {
    background: #fff;
    color: #1a1a1a;
    border: 1px solid #e5e7eb;
}

.btn-secondary:hover {
    border-color: #1a1a1a;
}

/* User Details in Modal */
.user-details,
.user-subscriptions {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid #e5e7eb;
}

.user-details h3,
.user-subscriptions h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    color: #1a1a1a;
}

.user-details p {
    margin: 8px 0;
    font-size: 14px;
    color: #6b7280;
}

.user-details p strong {
    color: #1a1a1a;
}

.user-subscriptions ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.user-subscriptions li {
    padding: 12px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 14px;
}

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

@media (max-width: 768px) {
    .metrics-grid {
        grid-template-columns: 1fr;
    }

    .metric-card.wide {
        grid-column: span 1;
    }

    .admin-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .search-box {
        max-width: none;
    }

    .users-table-container {
        overflow-x: auto;
    }
}
