/* Admin Dashboard Styles */

:root {
    --bg-dark: #0f0f23;
    --bg-card: #16213e;
    --bg-input: #1a1a2e;
    --text-primary: #eee;
    --text-secondary: #aaa;
    --accent: #4db5ff;
    --accent-hover: #3da5ef;
    --success: #28a745;
    --warning: #ffc107;
    --danger: #dc3545;
    --border: #333;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Login Page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 1rem;
}

.login-card {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.login-card h1 {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--accent);
}

.back-link {
    text-align: center;
    margin-top: 1rem;
    font-size: 0.9rem;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 1rem;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.2s;
    text-align: center;
}

.btn-primary {
    background: var(--accent);
    color: #000;
    font-weight: 600;
    width: 100%;
}

.btn-primary:hover {
    background: var(--accent-hover);
    text-decoration: none;
}

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border);
}

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

.btn-danger:hover {
    background: #c82333;
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
}

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

/* Error/Success Messages */
.error-message {
    background: var(--danger);
    color: white;
    padding: 0.75rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.success-message {
    background: var(--success);
    color: white;
    padding: 0.75rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

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

.sidebar {
    width: 250px;
    background: var(--bg-card);
    padding: 1.5rem;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-logo {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 2rem;
    display: block;
}

.sidebar-nav {
    list-style: none;
}

.sidebar-nav li {
    margin-bottom: 0.5rem;
}

.sidebar-nav a {
    display: block;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.sidebar-nav a:hover,
.sidebar-nav a.active {
    background: var(--bg-input);
    color: var(--text-primary);
    text-decoration: none;
}

.sidebar-nav a.active {
    border-left: 3px solid var(--accent);
}

.main-content {
    flex: 1;
    margin-left: 250px;
    padding: 2rem;
}

.page-header {
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 1.75rem;
    margin-bottom: 0.5rem;
}

.page-header p {
    color: var(--text-secondary);
}

/* Cards */
.card {
    background: var(--bg-card);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.card-header h2 {
    font-size: 1.25rem;
}

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

.stat-card {
    background: var(--bg-card);
    border-radius: 8px;
    padding: 1.5rem;
}

.stat-card h3 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

.stat-card .value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
}

/* Tables */
.table-container {
    overflow-x: auto;
}

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

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

th {
    background: var(--bg-input);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    color: var(--text-secondary);
}

tr:hover {
    background: rgba(77, 181, 255, 0.05);
}

/* Status Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

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

.badge-warning {
    background: var(--warning);
    color: #000;
}

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

.badge-info {
    background: var(--accent);
    color: #000;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    padding: 2rem;
    border-radius: 8px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.modal-header h2 {
    font-size: 1.25rem;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
}

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

/* API Key Display */
.api-key-display {
    background: var(--bg-input);
    padding: 1rem;
    border-radius: 4px;
    font-family: monospace;
    word-break: break-all;
    margin: 1rem 0;
}

/* Filters */
.filters {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.filters select,
.filters input {
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-input);
    color: var(--text-primary);
}

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

.pagination button {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-primary);
    border-radius: 4px;
    cursor: pointer;
}

.pagination button:hover:not(:disabled) {
    background: var(--border);
}

.pagination button.active {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        position: relative;
        height: auto;
    }

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

    .admin-layout {
        flex-direction: column;
    }

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

    .filters {
        flex-direction: column;
    }
}

/* File Upload */
.file-upload {
    border: 2px dashed var(--border);
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s;
}

.file-upload:hover {
    border-color: var(--accent);
}

.file-upload.dragover {
    border-color: var(--accent);
    background: rgba(77, 181, 255, 0.1);
}

.file-upload input {
    display: none;
}

/* Actions */
.actions {
    display: flex;
    gap: 0.5rem;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.empty-state h3 {
    margin-bottom: 0.5rem;
}

/* Logout button in sidebar */
.logout-btn {
    margin-top: 2rem;
    width: 100%;
}

/* Utility Classes */
.text-muted {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.mono {
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

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

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

.alert-warning {
    background: var(--warning);
    color: #000;
}

/* Info Box */
.info-box {
    background: var(--bg-input);
    border-left: 3px solid var(--accent);
    padding: 1rem;
    margin: 1rem 0;
    border-radius: 0 4px 4px 0;
}

.info-box h4 {
    margin-bottom: 0.5rem;
    color: var(--accent);
}

.info-box ol, .info-box ul {
    margin-left: 1.5rem;
    color: var(--text-secondary);
}

.info-box li {
    margin-bottom: 0.25rem;
}

/* Code Block */
.code-block {
    background: var(--bg-input);
    border-radius: 4px;
    padding: 1rem;
    overflow-x: auto;
}

.code-block h4 {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    text-transform: uppercase;
}

.code-block pre {
    margin: 0;
    font-family: 'SF Mono', Monaco, 'Courier New', monospace;
    font-size: 0.85rem;
    line-height: 1.5;
}

.code-block code {
    color: var(--accent);
}

/* Stats Row */
.stats-row {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.stat {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}
