/* Admin Panel Styles - extends main style.css */

/* Variables matching existing color system */
:root {
    --primary-dark: #2c3e50;
    --secondary-dark: #34495e;
    --primary-blue: #3498db;
    --success-green: #2ecc71;
    --danger-red: #e74c3c;
    --warning-yellow: #f39c12;
    --light-gray: #ecf0f1;
    --bg-gray: #f5f5f5;
    --text-gray: #7f8c8d;
    --text-dark: #333;
}

/* Auth Pages (Login/Setup) */
.auth-body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

.auth-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}

.auth-card {
    background: white;
    border-radius: 8px;
    padding: 40px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
}

.auth-header h1 {
    margin: 0 0 10px 0;
    color: var(--primary-dark);
    font-size: 28px;
}

.auth-header p {
    margin: 0;
    color: var(--text-gray);
}

.setup-notice {
    background: #e8f4fd;
    border-left: 4px solid var(--primary-blue);
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
}

.setup-notice strong {
    display: block;
    margin-bottom: 5px;
    color: var(--primary-dark);
}

.setup-notice p {
    margin: 0;
    color: var(--text-gray);
    font-size: 14px;
}

/* Admin Layout */
.admin-body {
    margin: 0;
    background: var(--bg-gray);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    min-height: 100vh;
}

.admin-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 250px;
    background: var(--primary-dark);
    color: white;
    display: flex;
    flex-direction: column;
    z-index: 100;
}

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

.sidebar-header h2 {
    margin: 0 0 5px 0;
    font-size: 22px;
}

.admin-badge {
    font-size: 12px;
    background: var(--primary-blue);
    padding: 3px 8px;
    border-radius: 3px;
    display: inline-block;
}

.nav-list {
    list-style: none;
    padding: 0;
    margin: 0;
    flex: 1;
    overflow-y: auto;
}

.nav-section {
    margin-top: 20px;
}

.nav-section-title {
    display: block;
    padding: 10px 20px 5px 20px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.5);
}

.nav-subsection {
    list-style: none;
    padding: 0;
    margin: 0;
}

.nav-link {
    display: block;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.nav-link.active {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border-left-color: var(--primary-blue);
}

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

.logout-form {
    margin: 0;
}

.logout-btn {
    background: none;
    border: none;
    cursor: pointer;
    width: 100%;
    text-align: left;
    font-size: inherit;
    padding: 12px 0;
}

.impersonation-notice {
    background: var(--warning-yellow);
    color: var(--primary-dark);
    padding: 10px;
    border-radius: 4px;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.admin-main {
    margin-left: 250px;
    min-height: 100vh;
    padding: 30px;
}

.admin-container {
    max-width: 1200px;
    margin: 0 auto;
}

/* Flash Messages */
.flash-messages {
    margin-bottom: 20px;
}

.alert {
    padding: 15px 20px;
    border-radius: 4px;
    margin-bottom: 10px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-info {
    background: #e8f4fd;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 30px;
    flex-wrap: wrap;
    gap: 15px;
}

.page-header h1 {
    margin: 0;
    color: var(--primary-dark);
    font-size: 28px;
}

.page-header-content {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.page-actions {
    display: flex;
    gap: 10px;
}

.back-link {
    color: var(--text-gray);
    text-decoration: none;
    font-size: 14px;
}

.back-link:hover {
    color: var(--primary-blue);
}

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

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    text-align: center;
}

.stat-value {
    font-size: 36px;
    font-weight: bold;
    color: var(--primary-dark);
}

.stat-label {
    color: var(--text-gray);
    font-size: 14px;
    margin-top: 5px;
}

.stat-sub {
    color: var(--text-gray);
    font-size: 12px;
    margin-top: 5px;
}

/* Data Tables */
.data-table {
    width: 100%;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border-collapse: collapse;
    overflow: hidden;
}

.data-table th,
.data-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--light-gray);
}

.data-table th {
    background: var(--bg-gray);
    color: var(--text-gray);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table tbody tr:hover {
    background: #fafafa;
}

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

.data-table .actions {
    white-space: nowrap;
}

/* Sections */
.section {
    margin-bottom: 30px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.section-header h2 {
    margin: 0;
    font-size: 20px;
    color: var(--primary-dark);
}

/* Detail Grid */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.detail-card {
    background: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.detail-card.full-width {
    grid-column: 1 / -1;
}

.detail-card h3 {
    margin: 0 0 20px 0;
    color: var(--primary-dark);
    font-size: 16px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--light-gray);
}

.detail-list {
    margin: 0;
}

.detail-list dt {
    font-size: 12px;
    color: var(--text-gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
}

.detail-list dd {
    margin: 0 0 15px 0;
    color: var(--text-dark);
}

.detail-list dd:last-child {
    margin-bottom: 0;
}

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

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-danger {
    background: #f8d7da;
    color: #721c24;
}

.badge-secondary {
    background: #e9ecef;
    color: #6c757d;
}

/* Status Display */
.status-display {
    display: flex;
    align-items: center;
    gap: 10px;
}

.status-label {
    font-weight: 500;
    color: var(--text-dark);
}

/* Detail Table */
.detail-table {
    width: 100%;
    border-collapse: collapse;
}

.detail-table th,
.detail-table td {
    padding: 12px 0;
    text-align: left;
    border-bottom: 1px solid var(--light-gray);
}

.detail-table th {
    color: var(--text-gray);
    font-weight: 500;
    width: 40%;
}

.detail-table td {
    color: var(--text-dark);
}

.detail-table tr:last-child th,
.detail-table tr:last-child td {
    border-bottom: none;
}

/* Auth Footer */
.auth-footer {
    margin-top: 20px;
    text-align: center;
}

.auth-footer .link {
    color: var(--text-gray);
    text-decoration: none;
    font-size: 14px;
}

.auth-footer .link:hover {
    color: var(--primary-blue);
}

/* Form text helper */
.form-text {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: var(--text-gray);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--light-gray);
    color: var(--text-dark);
}

.btn:hover {
    background: #ddd;
}

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

.btn-primary:hover {
    background: #2980b9;
}

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

.btn-success:hover {
    background: #27ae60;
}

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

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

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

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

.btn-warning {
    background: var(--warning-yellow);
    color: var(--primary-dark);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-block {
    display: block;
    width: 100%;
}

/* Forms */
.form-card {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    max-width: 500px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-dark);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

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

.form-help {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: var(--text-gray);
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 25px;
}

.auth-form .form-group {
    margin-bottom: 20px;
}

/* Inline forms */
.inline-form {
    display: inline;
}

/* API Key Display */
.api-key-display {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-gray);
    padding: 15px;
    border-radius: 4px;
    margin-top: 10px;
}

.api-key {
    font-family: 'Courier New', monospace;
    font-size: 14px;
    word-break: break-all;
    flex: 1;
}

/* Warning Box */
.warning-box {
    background: #fff3cd;
    border-left: 4px solid var(--warning-yellow);
    padding: 15px;
    border-radius: 4px;
    font-size: 14px;
}

/* Info Box */
.info-box {
    background: #e8f4fd;
    border-left: 4px solid var(--primary-blue);
    padding: 15px;
    border-radius: 4px;
    font-size: 14px;
}

.info-box ul {
    margin: 5px 0 10px 0;
    padding-left: 20px;
}

.info-box li {
    margin: 3px 0;
}

/* Code Blocks */
.code-block {
    background: var(--primary-dark);
    color: #ecf0f1;
    padding: 20px;
    border-radius: 4px;
    overflow-x: auto;
}

.code-block pre {
    margin: 0;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

code {
    font-family: 'Courier New', monospace;
    background: var(--bg-gray);
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 13px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-gray);
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.empty-state a {
    color: var(--primary-blue);
}

/* Utilities */
.text-muted {
    color: var(--text-gray);
}

.mt-2 {
    margin-top: 10px;
}

.mt-3 {
    margin-top: 15px;
}

/* Responsive */
@media (max-width: 768px) {
    .admin-sidebar {
        transform: translateX(-100%);
    }

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

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

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

    .page-header {
        flex-direction: column;
    }
}
