/* ==============================================================================
   Freelancer.com AI Bid Proposal Bot - Admin Stylesheet
   Modern, sleek, high-contrast, responsive UI
   ============================================================================== */

:root {
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --sidebar-bg: #0f172a;
    --sidebar-text: #94a3b8;
    --sidebar-active-bg: #1e293b;
    --sidebar-active-text: #38bdf8;
    --border-color: #e2e8f0;
    --text-primary: #0f172a;
    --text-muted: #64748b;
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --success: #10b981;
    --success-hover: #059669;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --warning: #f59e0b;
    --info: #0ea5e9;
    --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

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

body {
    font-family: var(--font-sans);
    background-color: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.5;
    font-size: 14.5px;
    -webkit-font-smoothing: antialiased;
}

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

.admin-sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: transform 0.3s ease;
    z-index: 50;
}

.sidebar-brand {
    padding: 24px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-icon {
    font-size: 24px;
    background: linear-gradient(135deg, #38bdf8, #2563eb);
    padding: 8px;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.brand-text h2 {
    font-size: 17px;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.2;
}

.brand-text small {
    font-size: 11px;
    color: #38bdf8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-nav {
    padding: 16px 12px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.nav-item:hover {
    background-color: rgba(255, 255, 255, 0.05);
    color: #ffffff;
}

.nav-item.active {
    background-color: var(--sidebar-active-bg);
    color: var(--sidebar-active-text);
    font-weight: 600;
}

.nav-icon {
    font-size: 17px;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-pill {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background-color: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
}

.user-info strong {
    display: block;
    font-size: 13px;
    color: #ffffff;
    line-height: 1.2;
}

.user-info small {
    font-size: 11px;
    color: var(--sidebar-text);
}

.btn-logout {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    text-decoration: none;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.btn-logout:hover {
    opacity: 1;
}

/* -----------------------------------------------------------------------------
   Main Area & Header
   ----------------------------------------------------------------------------- */
.admin-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.admin-topbar {
    height: 68px;
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
}

.page-title {
    font-size: 20px;
    font-weight: 700;
}

.admin-container {
    padding: 32px;
    flex: 1;
}

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

.stat-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.icon-purple { background-color: #f3e8ff; }
.icon-blue   { background-color: #e0f2fe; }
.icon-green  { background-color: #dcfce7; }
.icon-amber  { background-color: #fef3c7; }

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

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
}

.stat-value {
    font-size: 26px;
    font-weight: 700;
    line-height: 1.1;
    margin: 4px 0 2px;
}

.stat-desc {
    font-size: 11.5px;
    color: var(--text-muted);
}

/* -----------------------------------------------------------------------------
   System Status Bar
   ----------------------------------------------------------------------------- */
.system-status-bar {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
    font-size: 13px;
    margin-bottom: 24px;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.status-active {
    background-color: var(--success);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

/* -----------------------------------------------------------------------------
   Cards
   ----------------------------------------------------------------------------- */
.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 24px;
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.card-header h3 {
    font-size: 16px;
    font-weight: 700;
}

.card-header p {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}

.card-body {
    padding: 24px;
}

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

.table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.table th {
    background-color: #f8fafc;
    padding: 12px 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
}

.table td {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-color);
    font-size: 13.5px;
    vertical-align: middle;
}

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

.table-sm td, .table-sm th {
    padding: 8px 14px;
    font-size: 12.5px;
}

.row-muted {
    opacity: 0.6;
}

/* -----------------------------------------------------------------------------
   Buttons & Badges
   ----------------------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 18px;
    font-size: 13.5px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-decoration: none;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.btn-primary { background-color: var(--primary); color: #fff; }
.btn-primary:hover { background-color: var(--primary-hover); }

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

.btn-success { background-color: var(--success); color: #fff; }
.btn-success:hover { background-color: var(--success-hover); }

.btn-danger { background-color: var(--danger); color: #fff; }
.btn-danger:hover { background-color: var(--danger-hover); }

.btn-outline { background: transparent; border-color: var(--border-color); color: var(--text-primary); }
.btn-outline:hover { background-color: #f1f5f9; }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-xs { padding: 4px 8px; font-size: 11px; }
.btn-block { width: 100%; }

.badge {
    display: inline-block;
    padding: 3px 8px;
    font-size: 11.5px;
    font-weight: 600;
    border-radius: 4px;
}

.badge-primary { background-color: #e0f2fe; color: #0369a1; }
.badge-success { background-color: #dcfce7; color: #15803d; }
.badge-secondary { background-color: #f1f5f9; color: #475569; }
.badge-info { background-color: #e0e7ff; color: #4338ca; }

.badge-button {
    border: none;
    cursor: pointer;
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px;
}

/* -----------------------------------------------------------------------------
   Forms & Controls
   ----------------------------------------------------------------------------- */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 13px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    background-color: #fff;
    color: var(--text-primary);
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.code-editor {
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.6;
    background-color: #fafafa;
}

.custom-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.form-row {
    display: flex;
    gap: 16px;
    margin-bottom: 18px;
}

.col-md-6 { flex: 1; margin-bottom: 0; }

.alert {
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 20px;
    font-size: 13.5px;
    font-weight: 500;
}

.alert-success { background-color: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-danger { background-color: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-warning { background-color: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

/* -----------------------------------------------------------------------------
   Proposal & Test Outputs
   ----------------------------------------------------------------------------- */
.test-result-box {
    background-color: #f8fafc;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
}

.analysis-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    padding: 14px;
    border-radius: var(--radius-sm);
}

.proposal-text-container {
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 18px;
    font-size: 14.5px;
    line-height: 1.65;
    white-space: pre-wrap;
}

/* -----------------------------------------------------------------------------
   Login Page
   ----------------------------------------------------------------------------- */
.login-body {
    background-color: #0f172a;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.login-card {
    background: #ffffff;
    width: 100%;
    max-width: 420px;
    padding: 36px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.login-header {
    text-align: center;
    margin-bottom: 24px;
}

.login-icon {
    font-size: 32px;
    margin-bottom: 12px;
}

.login-header h1 {
    font-size: 22px;
    font-weight: 700;
}

.login-header p {
    font-size: 13px;
    color: var(--text-muted);
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    color: var(--text-muted);
    font-size: 12px;
}

/* -----------------------------------------------------------------------------
   Modals
   ----------------------------------------------------------------------------- */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(15, 23, 42, 0.6);
    z-index: 100;
    align-items: center;
    justify-content: center;
}

.modal.is-active {
    display: flex;
}

.modal-dialog {
    width: 90%;
    max-width: 600px;
    background: #fff;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.modal-lg {
    max-width: 850px;
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
    text-decoration: none;
}

.modal-body {
    padding: 20px;
    max-height: 75vh;
    overflow-y: auto;
}

.modal-footer {
    padding: 14px 20px;
    border-top: 1px solid var(--border-color);
    text-align: right;
}

/* -----------------------------------------------------------------------------
   Utilities
   ----------------------------------------------------------------------------- */
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-center-start { display: flex; align-items: center; }
.grid-2-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.font-mono { font-family: var(--font-mono); }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.small { font-size: 12px; }
.p-0 { padding: 0 !important; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 14px; }
.mt-4 { margin-top: 24px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 14px; }
.mb-4 { margin-bottom: 24px; }
.d-inline { display: inline-block; }
.clean-pre { background: #f8fafc; padding: 14px; border-radius: var(--radius-sm); border: 1px solid var(--border-color); white-space: pre-wrap; font-family: var(--font-mono); font-size: 12.5px; }
.clean-list { list-style: none; padding-left: 0; }
.clean-list li { margin-bottom: 6px; }

/* -----------------------------------------------------------------------------
   Responsive Breakpoints
   ----------------------------------------------------------------------------- */
@media (max-width: 900px) {
    .grid-2-col { grid-template-columns: 1fr; }
    .form-row { flex-direction: column; gap: 0; }
    .admin-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
    }
    .admin-sidebar.is-open {
        transform: translateX(0);
    }
    .mobile-menu-toggle {
        display: block;
    }
    .admin-topbar { padding: 0 16px; }
    .admin-container { padding: 16px; }
}
