/* Admin Panel Styles */
:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --success-color: #48bb78;
    --danger-color: #f56565;
    --warning-color: #ed8936;
    --bg-color: #f7fafc;
    --sidebar-bg: #2d3748;
    --sidebar-hover: #4a5568;
    --text-primary: #2d3748;
    --text-secondary: #718096;
    --border-color: #e2e8f0;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-color);
    color: var(--text-primary);
}

#admin-app {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.admin-sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    padding: 2rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.admin-user {
    font-size: 0.875rem;
    opacity: 0.8;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 0.875rem 1.5rem;
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
}

.nav-item:hover {
    background: var(--sidebar-hover);
    color: white;
}

.nav-item.active {
    background: var(--primary-color);
    color: white;
    border-left: 4px solid white;
}

.nav-item .icon {
    margin-right: 0.75rem;
    font-size: 1.25rem;
}

.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.1);
}

.btn-logout {
    width: 100%;
    padding: 0.75rem;
    background: rgba(255,255,255,0.1);
    color: white;
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-logout:hover {
    background: rgba(255,255,255,0.2);
}

/* Main Content */
.admin-main {
    flex: 1;
    margin-left: 260px;
    padding: 2rem;
}

h1 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
}

h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

h3 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.search-box, .filter-box {
    display: flex;
    gap: 0.5rem;
}

.search-box input, .filter-box select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 0.875rem;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    display: flex;
    gap: 1rem;
    align-items: center;
}

.stat-icon {
    font-size: 2.5rem;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    width: 60px;
    height: 60px;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-info {
    flex: 1;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: bold;
    color: var(--text-primary);
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

.stat-detail {
    color: var(--text-secondary);
    font-size: 0.75rem;
    margin-top: 0.5rem;
}

/* Tables */
.table-container {
    background: white;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

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

.admin-table thead {
    background: var(--bg-color);
}

.admin-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.admin-table td {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
}

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

/* Buttons */
.btn {
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-secondary {
    background: var(--border-color);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--text-secondary);
    color: white;
}

.btn-icon {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.25rem;
    transition: all 0.2s;
}

.btn-icon:hover {
    transform: scale(1.2);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--border-color);
    color: var(--text-primary);
}

.badge-success {
    background: #c6f6d5;
    color: #22543d;
}

.badge-danger {
    background: #fed7d7;
    color: #742a2a;
}

.badge-warning {
    background: #feebc8;
    color: #7c2d12;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 2rem;
    border-radius: 1rem;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.modal-large {
    max-width: 800px;
}

.close {
    color: var(--text-secondary);
    float: right;
    font-size: 1.75rem;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close:hover {
    color: var(--text-primary);
}

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

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 0.875rem;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    margin-right: 0.5rem;
    width: 1.25rem;
    height: 1.25rem;
    cursor: pointer;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 2rem;
}

/* Pagination */
.pagination {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 2rem;
}

/* Alerts */
.alert {
    position: fixed;
    top: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 9999;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

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

/* User Details */
.user-details {
    display: grid;
    gap: 1.5rem;
}

.detail-section {
    padding: 1.5rem;
    background: var(--bg-color);
    border-radius: 0.5rem;
}

.detail-section h3 {
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-color);
}

.detail-section p {
    margin-bottom: 0.75rem;
}

.mini-table {
    width: 100%;
    margin-top: 1rem;
}

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

/* Analytics */
.analytics-section {
    background: white;
    border-radius: 1rem;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.chart-container {
    overflow-x: auto;
}

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

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

.chart-table thead {
    background: var(--bg-color);
}

.total-row {
    background: var(--bg-color);
    font-weight: bold;
}

/* Mobile Menu Button */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1001;
    background: var(--sidebar-bg);
    border: none;
    border-radius: 0.5rem;
    padding: 0.75rem;
    cursor: pointer;
    flex-direction: column;
    gap: 5px;
}

.mobile-menu-btn span {
    display: block;
    width: 24px;
    height: 2px;
    background: white;
    transition: all 0.3s;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

/* Responsive */
@media (max-width: 768px) {
    .mobile-menu-btn {
        display: flex;
    }

    .admin-sidebar {
        width: 260px;
        position: fixed;
        transform: translateX(-100%);
        z-index: 1000;
        transition: transform 0.3s ease;
    }

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

    .sidebar-overlay.active {
        display: block;
    }

    .admin-main {
        margin-left: 0;
        padding: 1rem;
        padding-top: 4rem;
    }

    h1 {
        font-size: 1.5rem;
    }

    h2 {
        font-size: 1.25rem;
    }

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

    .stat-card {
        padding: 1rem;
    }

    .stat-icon {
        width: 50px;
        height: 50px;
        font-size: 2rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }

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

    .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .search-box, .filter-box {
        flex-direction: column;
    }

    .search-box input, .filter-box select {
        width: 100%;
    }

    /* Table responsiveness */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .admin-table {
        min-width: 600px;
    }

    .admin-table th, .admin-table td {
        padding: 0.75rem 0.5rem;
        font-size: 0.8rem;
    }

    /* Modal */
    .modal-content {
        margin: 2rem auto;
        padding: 1.5rem;
        width: 95%;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        width: 100%;
    }

    /* Alerts */
    .alert {
        top: 1rem;
        right: 1rem;
        left: 1rem;
        padding: 0.75rem 1rem;
    }

    /* Pagination */
    .pagination {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    .admin-main {
        padding: 0.75rem;
        padding-top: 4rem;
    }

    .stat-card {
        flex-direction: column;
        text-align: center;
    }

    .stat-icon {
        margin: 0 auto;
    }

    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }

    .modal-content {
        padding: 1rem;
    }
}
