/* AgilePro Admin Panel Styles */

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f5f5f5;
}

.container { max-width: 1400px; margin: 0 auto; padding: 20px; }

.header {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header h1 {
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 0;
}

.card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Login Form */
.login-form { max-width: 400px; margin: 100px auto; }
.form-group { margin-bottom: 15px; }

label { display: block; margin-bottom: 5px; font-weight: 500; }

input, select, textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

/* Buttons */
.btn {
    background: #007bff;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
}
.btn:hover { background: #0056b3; }
.btn:disabled { background: #6c757d; cursor: not-allowed; }
.btn-danger { background: #dc3545; }
.btn-danger:hover { background: #c82333; }
.btn-secondary { background: #6c757d; color: white; }
.btn-secondary:hover { background: #5a6268; }
.btn-primary { background: #007bff; }
.btn-warning { background: #ffc107; color: #212529; }
.btn-warning:hover { background: #e0a800; }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* Messages */
.error { color: #dc3545; margin-top: 10px; }
.success { color: #28a745; margin-top: 10px; }

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.stat-card {
    background: white;
    padding: 16px;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.2s;
    cursor: pointer;
}
.stat-card:hover { background: #f8f9fa; transform: translateY(-2px); }
.stat-card.active { background: #e3f2fd; border: 2px solid #2196f3; }
.stat-number { font-size: 1.8em; font-weight: bold; color: #007bff; }
.stat-label { color: #666; margin-top: 4px; font-size: 13px; }

/* Navigation Tabs */
.admin-nav {
    display: flex;
    gap: 4px;
    background: white;
    padding: 6px;
    border-radius: 8px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow-x: auto;
    flex-wrap: wrap;
}

.nav-tab {
    padding: 8px 16px;
    border: none;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #555;
    white-space: nowrap;
    transition: all 0.15s;
}
.nav-tab:hover { background: #f0f0f0; color: #333; }
.nav-tab.active { background: #007bff; color: white; }

/* Data Tables */
.data-table {
    width: 100%;
    border-collapse: collapse;
}
.data-table th,
.data-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
    font-size: 13px;
}
.data-table th { background: #f8f9fa; font-weight: 500; color: #555; }
.data-table tbody tr:hover { background: #f8f9fa; }
.data-table td .btn { margin-right: 4px; }
.data-table td .btn:last-child { margin-right: 0; }

/* Table Header */
.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    gap: 12px;
    flex-wrap: wrap;
}
.table-header h3 { margin: 0; }

.table-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-input {
    width: 250px;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
}

.filter-select {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 13px;
    width: auto;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}
.badge-verified { background: #dcfce7; color: #166534; }
.badge-unverified { background: #fef3c7; color: #92400e; }
.badge-suspended { background: #fee2e2; color: #991b1b; }
.badge-active { background: #dcfce7; color: #166534; }
.badge-inactive { background: #fee2e2; color: #991b1b; }
.badge-mode {
    background: #e0f2fe;
    color: #1d4ed8;
    text-transform: capitalize;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    margin-top: 16px;
}

.page-btn {
    padding: 6px 12px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
}
.page-btn:hover:not(:disabled) { background: #f0f0f0; }
.page-btn.active { background: #007bff; color: white; border-color: #007bff; }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.page-ellipsis { padding: 6px 4px; color: #999; }

/* Detail Info */
.detail-info {
    margin-top: 12px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
    font-size: 13px;
    color: #555;
}
.detail-info p { margin-bottom: 4px; }

/* Utilities */
.hidden { display: none; }
.logout-btn { float: right; }
.loading { text-align: center; padding: 40px; color: #666; }
.center-text { text-align: center; }

.add-admin-btn {
    display: flex;
    align-items: center;
    gap: 5px;
}
.plus-icon { font-size: 18px; font-weight: bold; }

/* Modal Styles */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0; top: 0;
    width: 100%; height: 100%;
    background-color: rgba(0,0,0,0.4);
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
}

.modal-header {
    padding: 16px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #ddd;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.modal-header h4 { margin: 0; color: #333; }

.close { color: #aaa; font-size: 28px; font-weight: bold; cursor: pointer; }
.close:hover { color: #333; }

.modal-body { padding: 20px; }

.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid #ddd;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    background: #f8f9fa;
    border-radius: 0 0 8px 8px;
}

.form-hint { font-size: 12px; color: #666; margin-top: 5px; display: block; }
.form-row { display: flex; gap: 15px; }
.form-group-half { flex: 1; }

/* Chat Viewer */
.chat-viewer {
    max-height: 400px;
    overflow-y: auto;
    padding: 8px 0;
}

.message-row {
    margin-bottom: 12px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.message-row.user {
    background: #e3f2fd;
    border-left: 3px solid #2196f3;
}
.message-row.assistant {
    background: #f5f5f5;
    border-left: 3px solid #4caf50;
}

.message-role {
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    color: #888;
    margin-bottom: 4px;
}

/* Feature Flags */
.feature-flags-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.feature-flags-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.feature-flags-controls input {
    padding: 6px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 4px;
    min-width: 220px;
}

.feature-flags-table { width: 100%; border-collapse: collapse; margin-top: 12px; }
.feature-flags-table th,
.feature-flags-table td {
    text-align: left;
    padding: 8px 12px;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: middle;
    font-size: 13px;
}
.feature-flags-table tbody tr:hover { background: #f8fafc; }
.feature-flags-table td.actions { text-align: right; }
.feature-flag-action { display: flex; align-items: center; gap: 10px; }
.feature-flags-table select { padding: 4px 8px; border-radius: 4px; border: 1px solid #cbd5e1; }
.feature-flags-message { margin-top: 8px; font-size: 14px; color: #334155; }
.feature-flags-message.success { color: #166534; }
.feature-flags-message.error { color: #b91c1c; }
.feature-flags-help { margin-top: 12px; font-size: 13px; color: #64748b; }

.state-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}
.state-badge.on { background: #dcfce7; color: #166534; }
.state-badge.off { background: #fee2e2; color: #991b1b; }
.state-badge.default { background: #e0f2fe; color: #1d4ed8; }

/* Launch Signups */
.signups-stats {
    display: flex;
    gap: 20px;
    margin: 20px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 6px;
    flex-wrap: wrap;
}
.stat-item { text-align: center; flex: 1; min-width: 120px; }
.stat-value { display: block; font-size: 24px; font-weight: bold; color: #007bff; margin-bottom: 5px; }
.stat-desc { font-size: 14px; color: #666; font-weight: 500; }
.signups-note {
    color: #666;
    font-style: italic;
    margin-top: 15px;
    padding: 15px;
    background: #e7f3ff;
    border-radius: 4px;
    border-left: 4px solid #007bff;
}

/* Toast */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 12px 20px;
    border-radius: 6px;
    font-size: 14px;
    color: white;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s;
    max-width: 350px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.toast-visible { opacity: 1; transform: translateX(0); }
.toast-info { background: #2196f3; }
.toast-success { background: #4caf50; }
.toast-error { background: #f44336; }
.toast-warning { background: #ff9800; }
