/* Admin Panel Styling */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #3b82f6;
    --secondary-color: #6b7280;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --info-color: #06b6d4;
    --bg-light: #f9fafb;
    --text-color: #1f2937;
    --border-color: #e5e7eb;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    transition: all 0.3s ease;
}

/* Cosmic Mode */
body.cosmic-mode {
    background: #000000;
    background-image:
        radial-gradient(circle at 20% 50%, rgba(120, 119, 198, 0.3), transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(138, 43, 226, 0.2), transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(27, 227, 255, 0.15), transparent 50%);
}

body.cosmic-mode .admin-header {
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(27, 227, 255, 0.3);
    box-shadow: 0 10px 30px rgba(27, 227, 255, 0.3);
}

body.cosmic-mode .admin-header h1 {
    color: #1be3ff;
    text-shadow: 0 0 10px rgba(27, 227, 255, 0.5);
}

body.cosmic-mode .stat-card {
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(27, 227, 255, 0.3);
    box-shadow: 0 8px 25px rgba(27, 227, 255, 0.2);
}

body.cosmic-mode .stat-value {
    color: #1be3ff;
    text-shadow: 0 0 10px rgba(27, 227, 255, 0.5);
}

body.cosmic-mode .stat-label {
    color: #9ca3af;
}

body.cosmic-mode .users-section,
body.cosmic-mode .table-container {
    background: rgba(0, 0, 0, 0.8) !important;
    border: 1px solid rgba(27, 227, 255, 0.3);
    box-shadow: 0 8px 25px rgba(27, 227, 255, 0.2);
}

body.cosmic-mode .table-header {
    background: transparent !important;
    border-bottom: 2px solid rgba(27, 227, 255, 0.3);
}

body.cosmic-mode .users-section h2,
body.cosmic-mode h2,
body.cosmic-mode h3 {
    color: #1be3ff;
    text-shadow: 0 0 10px rgba(27, 227, 255, 0.5);
}

body.cosmic-mode .users-section>div:first-child {
    background: transparent !important;
}

body.cosmic-mode .users-table thead {
    background: rgba(27, 227, 255, 0.2);
}

body.cosmic-mode .users-table th {
    color: #1be3ff;
    text-shadow: 0 0 10px rgba(27, 227, 255, 0.5);
}

body.cosmic-mode .users-table tbody tr {
    background: rgba(0, 0, 0, 0.4);
    border-bottom: 1px solid rgba(27, 227, 255, 0.1);
}

body.cosmic-mode .users-table tbody tr:hover {
    background: rgba(27, 227, 255, 0.1);
}

body.cosmic-mode .users-table td {
    color: #e5e7eb;
}

body.cosmic-mode .users-table {
    background: rgba(0, 0, 0, 0.8);
    border: 1px solid rgba(27, 227, 255, 0.3);
}

body.cosmic-mode .refresh-btn {
    background: linear-gradient(135deg, #1be3ff 0%, #667eea 50%, #9b59b6 100%);
    border: 1px solid rgba(27, 227, 255, 0.5);
}

body.cosmic-mode .btn-secondary {
    background: rgba(27, 227, 255, 0.15);
    color: #1be3ff;
    border: 1px solid rgba(27, 227, 255, 0.3);
}

body.cosmic-mode .btn-secondary:hover {
    background: rgba(27, 227, 255, 0.25);
}

body.cosmic-mode .btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    border: 1px solid rgba(239, 68, 68, 0.5);
}

body.cosmic-mode .btn-primary {
    background: linear-gradient(135deg, #1be3ff 0%, #667eea 50%, #9b59b6 100%);
    border: 1px solid rgba(27, 227, 255, 0.5);
}

body.cosmic-mode .theme-toggle {
    background: rgba(27, 227, 255, 0.15);
    border-color: rgba(27, 227, 255, 0.5);
    color: #1be3ff;
}

.admin-container {
    max-width: 1400px;
    margin: 0 auto;
}

/* Header */
.admin-header {
    background: white;
    border-radius: 15px;
    padding: 20px 30px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.admin-logo {
    height: 50px;
}

.admin-header h1 {
    color: var(--text-color);
    font-size: 24px;
}

.header-right {
    display: flex;
    gap: 10px;
}

/* Buttons */
.btn-primary,
.btn-secondary,
.btn-danger {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), #2563eb);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.btn-secondary:hover {
    background: #4b5563;
    transform: translateY(-2px);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
    transform: translateY(-2px);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.stat-card {
    background: white;
    border-radius: 15px;
    padding: 25px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.2);
}

.stat-icon {
    font-size: 40px;
    margin-bottom: 10px;
}

.stat-label {
    color: var(--secondary-color);
    font-size: 14px;
    margin-bottom: 10px;
}

.stat-value {
    color: var(--text-color);
    font-size: 32px;
    font-weight: 700;
}

/* Table Container */
.table-container {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.table-header h2 {
    color: var(--text-color);
}

/* Users Table */
.users-table {
    width: 100%;
    border-collapse: collapse;
}

.users-table thead {
    background: linear-gradient(135deg, var(--primary-color), #2563eb);
    color: white;
}

.users-table th,
.users-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    /* Prevent text wrapping */
}

.users-table th {
    font-weight: 600;
    font-size: 14px;
}

.users-table td {
    font-size: 14px;
    color: var(--text-color);
    vertical-align: middle;
}

.users-table tbody tr {
    transition: background 0.2s ease;
}

.users-table tbody tr:hover {
    background: #f3f4f6;
}

.users-table tbody tr.inactive-row {
    opacity: 0.6;
    background: #fef2f2;
}

/* Badges */
.badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    white-space: nowrap;
    /* Fix wrapping */
}

.badge-trial {
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    color: white;
}

.badge-paid {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.badge-lifetime {
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
    color: white;
}

.status-badge {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    /* Fix wrapping */
    display: inline-block;
}

.status-badge.active {
    background: #d1fae5;
    color: #065f46;
}

.status-badge.inactive {
    background: #fee2e2;
    color: #991b1b;
}

/* Action Buttons */
.btn-action {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-right: 5px;
}

.btn-extend {
    background: #dbeafe;
    color: #1e40af;
}

.btn-extend:hover {
    background: #bfdbfe;
    transform: translateY(-2px);
}

.btn-activate {
    background: #d1fae5;
    color: #065f46;
}

.btn-activate:hover {
    background: #a7f3d0;
    transform: translateY(-2px);
}

.btn-deactivate {
    background: #fee2e2;
    color: #991b1b;
}

.btn-deactivate:hover {
    background: #fecaca;
    transform: translateY(-2px);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    color: var(--text-color);
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--secondary-color);
    cursor: pointer;
    transition: color 0.3s ease;
}

.modal-close:hover {
    color: var(--danger-color);
}

.modal-body {
    padding: 30px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 20px 30px;
    border-top: 1px solid var(--border-color);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    color: var(--text-color);
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 14px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    transition: border 0.3s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-group input[readonly] {
    background: #f3f4f6;
    cursor: not-allowed;
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 15px;
}

.btn-quick {
    padding: 8px 12px;
    border: 2px solid var(--primary-color);
    background: white;
    color: var(--primary-color);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-quick:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .admin-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .header-right {
        width: 100%;
        justify-content: center;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .table-container {
        padding: 15px;
        overflow-x: auto;
    }

    .users-table {
        font-size: 12px;
    }

    .users-table th,
    .users-table td {
        padding: 10px 5px;
    }

    .quick-actions {
        grid-template-columns: repeat(2, 1fr);
    }
}