/* UDaily AdminApp Styles */

/* Main layout — left sidebar nav */
.main-layout {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.layout-body {
    flex: 1;
    display: flex;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background-color: #2c3e50;
    color: #ecf0f1;
    padding: 1rem 0;
    flex-shrink: 0;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
}

.nav-section {
    display: flex;
    flex-direction: column;
}

.sidebar-nav a,
.sidebar-nav .nav-link {
    color: #bdc3c7;
    text-decoration: none;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-nav a:hover,
.sidebar-nav .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.sidebar-nav a.active,
.sidebar-nav .nav-link.active {
    background-color: rgba(255, 255, 255, 0.15);
    color: #fff;
    border-left: 3px solid #3498db;
}

.nav-divider {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin: 0.5rem 1rem;
}

.nav-badge {
    background-color: #e74c3c;
    color: #fff;
    border-radius: 10px;
    padding: 0.15rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    min-width: 1.25rem;
    text-align: center;
}

/* Header */
.admin-header {
    background-color: #34495e;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    color: #fff;
}

.admin-header .brand {
    font-size: 1.25rem;
    font-weight: 600;
    color: #fff;
    text-decoration: none;
    flex: 1;
}

.header-user {
    font-size: 0.875rem;
    color: #bdc3c7;
}

.header-logout {
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #bdc3c7;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
}

.header-logout:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.hamburger-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
}

/* Main content */
.main-content {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
}

/* Footer */
.footer {
    text-align: center;
    padding: 1rem;
    color: #6c757d;
    font-size: 0.875rem;
    border-top: 1px solid #dee2e6;
}

/* Mobile nav overlay */
.mobile-nav-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 998;
}

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

.stat-card {
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1.25rem;
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 0.25rem;
}

.stat-card .stat-label {
    font-size: 0.875rem;
    color: #6c757d;
}

.stat-card.stat-warning .stat-value {
    color: #e67e22;
}

.stat-card.stat-danger .stat-value {
    color: #e74c3c;
}

.stat-card.stat-success .stat-value {
    color: #27ae60;
}

/* Admin tables */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    overflow: hidden;
}

.admin-table th {
    background-color: #f8f9fa;
    padding: 0.75rem 1rem;
    text-align: left;
    font-weight: 600;
    color: #495057;
    border-bottom: 2px solid #dee2e6;
    font-size: 0.875rem;
}

.admin-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #dee2e6;
    font-size: 0.875rem;
}

.admin-table tr:hover {
    background-color: #f8f9fa;
}

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

/* Status badges */
.status-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-pending {
    background-color: #fff3cd;
    color: #856404;
}

.status-approved {
    background-color: #d4edda;
    color: #155724;
}

.status-rejected {
    background-color: #f8d7da;
    color: #721c24;
}

.status-suspended {
    background-color: #f8d7da;
    color: #721c24;
}

.status-active {
    background-color: #d4edda;
    color: #155724;
}

.status-closed {
    background-color: #e2e3e5;
    color: #383d41;
}

.status-flagged {
    background-color: #fff3cd;
    color: #856404;
}

.status-moderated {
    background-color: #cce5ff;
    color: #004085;
}

/* Filter bar */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    align-items: center;
}

.filter-bar select,
.filter-bar input {
    padding: 0.4rem 0.75rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-size: 0.875rem;
}

.filter-bar .btn {
    padding: 0.4rem 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
}

/* Buttons */
.btn-primary {
    background-color: #3498db;
    color: #fff;
}

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

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

.btn-success:hover {
    background-color: #219a52;
}

.btn-danger {
    background-color: #e74c3c;
    color: #fff;
}

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

.btn-secondary {
    background-color: #95a5a6;
    color: #fff;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

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

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

/* Action buttons in tables */
.action-buttons {
    display: flex;
    gap: 0.5rem;
}

/* Detail page layout */
.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.detail-header h1 {
    margin: 0;
    font-size: 1.5rem;
}

.detail-section {
    margin-bottom: 2rem;
}

.detail-section h2 {
    font-size: 1.125rem;
    color: #2c3e50;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #dee2e6;
}

/* Thread transcript */
.transcript {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 600px;
    overflow-y: auto;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.transcript-message {
    max-width: 80%;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    white-space: pre-wrap;
    font-size: 0.875rem;
    line-height: 1.5;
}

.transcript-message.role-client {
    align-self: flex-end;
    background-color: #e3f2fd;
    border-radius: 12px 12px 0 12px;
}

.transcript-message.role-boz {
    align-self: flex-start;
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: 12px 12px 12px 0;
}

.transcript-message.role-system {
    align-self: center;
    background-color: #fff3cd;
    border-radius: 8px;
    font-style: italic;
    font-size: 0.8rem;
}

.transcript-role {
    font-size: 0.7rem;
    font-weight: 600;
    color: #6c757d;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
}

.transcript-time {
    font-size: 0.7rem;
    color: #adb5bd;
    margin-top: 0.25rem;
}

/* Backstage reasoning trace */
.section-hint {
    font-size: 0.8rem;
    color: #6c757d;
    margin: -0.5rem 0 0.75rem;
}

.reasoning-trace {
    background-color: #f6f4ef;
    border: 1px solid #e4e0d7;
    border-left: 3px solid #4a5a78;
    border-radius: 6px;
    padding: 0.75rem 1rem;
    font-size: 0.85rem;
    line-height: 1.5;
    color: #495057;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 400px;
    overflow-y: auto;
    margin: 0;
}

/* Admin notes */
.admin-notes {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.admin-note {
    background: #fff;
    border: 1px solid #dee2e6;
    border-left: 3px solid #3498db;
    border-radius: 4px;
    padding: 0.75rem 1rem;
}

.admin-note-header {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: #6c757d;
    margin-bottom: 0.5rem;
}

.admin-note-content {
    font-size: 0.875rem;
}

.note-form {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.note-form textarea {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    resize: vertical;
    min-height: 3rem;
    font-size: 0.875rem;
}

/* Page header with actions */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.page-header h1 {
    margin: 0;
    font-size: 1.5rem;
    color: #2c3e50;
}

.page-subtitle {
    margin: 0;
    font-size: 0.875rem;
    color: #6c757d;
    flex-basis: 100%;
}

.text-muted {
    color: #6c757d;
}

/* Tab navigation */
.tab-nav {
    display: flex;
    border-bottom: 2px solid #dee2e6;
    margin-bottom: 1.5rem;
}

.tab-nav button {
    padding: 0.75rem 1.25rem;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 0.875rem;
    color: #6c757d;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}

.tab-nav button.active {
    color: #3498db;
    border-bottom-color: #3498db;
    font-weight: 600;
}

/* Rejection/suspension reason input */
.reason-input {
    margin-top: 0.5rem;
}

.reason-input textarea {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    resize: vertical;
    min-height: 2.5rem;
    font-size: 0.875rem;
}

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

.pagination button {
    padding: 0.4rem 0.75rem;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    font-size: 0.875rem;
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination .page-info {
    font-size: 0.875rem;
    color: #6c757d;
}

/* Loading spinner */
.loading {
    text-align: center;
    padding: 3rem;
    color: #6c757d;
}

/* Error message */
.error-message {
    background-color: #f8d7da;
    color: #721c24;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: #6c757d;
}

/* Clickable row */
.clickable-row {
    cursor: pointer;
}

/* Cost display */
.cost-value {
    font-family: monospace;
}

/* Mobile responsive */
@media (max-width: 767px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100%;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 999;
    }

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

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

    .admin-table {
        display: block;
        overflow-x: auto;
    }

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

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

    .transcript-message {
        max-width: 95%;
    }
}

@media (min-width: 768px) {
    .hamburger-btn {
        display: none;
    }

    .mobile-nav-overlay {
        display: none;
    }
}

/* Prompt Sets */
.default-badge {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.1rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
    background-color: #198754;
    border-radius: 0.75rem;
    vertical-align: middle;
}

.back-link {
    display: inline-block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: #6c757d;
    text-decoration: none;
}

.back-link:hover {
    text-decoration: underline;
}

.prompt-editor {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.prompt-editor-label {
    margin-top: 0.75rem;
    font-weight: 600;
    font-size: 0.9rem;
}

.prompt-editor-textarea {
    width: 100%;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.85rem;
    line-height: 1.45;
    padding: 0.5rem 0.65rem;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    resize: vertical;
}

.prompt-editor-required {
    min-height: 18rem;
}

.prompt-editor-optional {
    min-height: 10rem;
}

.version-panel {
    margin-top: 2rem;
}

.version-panel h2 {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
}

.version-preview {
    margin-top: 1rem;
    padding: 1rem;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    background-color: #f8f9fa;
}

.version-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.version-preview-header h3 {
    font-size: 1rem;
    margin: 0;
}

.version-preview-content {
    white-space: pre-wrap;
    word-break: break-word;
    font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    font-size: 0.8rem;
    line-height: 1.45;
    padding: 0.5rem 0.65rem;
    margin: 0 0 0.5rem;
    background-color: #fff;
    border: 1px solid #e9ecef;
    border-radius: 0.375rem;
    max-height: 20rem;
    overflow: auto;
}
