/* Custom Design System - FastAPI MarkItDown */

/* ===============================================
   CSS VARIABLES
   =============================================== */
:root {
    --slate-grey: #2F4F4F;
    --accent-red: #D6242D;
    --off-white: #FCF9F5;
    --white: #FFFFFF;
    --border-color: #ddd;
    --text-primary: #333;
    --text-muted: #6c757d;
    --success: #198754;
    --danger: #D6242D;
    --warning: #ffc107;
    --info: #0dcaf0;
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
}

/* ===============================================
   RESET & BASE STYLES
   =============================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    border-radius: 0 !important;
}

html, body {
    height: 100%;
    overflow-x: hidden;
}

body {
    font-family: var(--font-family);
    background-color: var(--off-white);
    color: var(--text-primary);
    line-height: 1.5;
}

/* ===============================================
   LAYOUT
   =============================================== */
#app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: calc(100vh - 60px); /* Subtract header height */
    align-items: stretch;
}

#nav-component {
    display: flex;
    flex-direction: column;
    background-color: var(--white);
}

main {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
    overflow-x: hidden;
    max-width: 100%;
}

/* ===============================================
   HEADER / NAVBAR
   =============================================== */
.navbar {
    background-color: #FCF9F5;
    border-bottom: 2px solid var(--accent-red);
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--slate-grey);
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
}

.navbar-brand img {
    height: 60px;
    width: auto;
    object-fit: contain;
}

.navbar-menu {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.dropdown {
    position: relative;
}

.dropdown-toggle {
    background: transparent;
    border: none;
    color: var(--slate-grey);
    cursor: pointer;
    padding: 0.5rem 1rem;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.dropdown-toggle:hover {
    background-color: rgba(47, 79, 79, 0.1);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--white);
    border: 1px solid var(--border-color);
    min-width: 200px;
    margin-top: 0.5rem;
    display: none;
    z-index: 1001;
}

.dropdown.active .dropdown-menu {
    display: block;
}

.dropdown-item {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    text-decoration: none;
    cursor: pointer;
}

.dropdown-item:hover {
    background-color: rgba(47, 79, 79, 0.05);
}

.dropdown-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 0.5rem 0;
}

/* ===============================================
   SIDEBAR NAVIGATION
   =============================================== */
.sidebar {
    width: 250px;
    background-color: var(--white);
    border-right: 1px solid var(--border-color);
    padding: 1.5rem 0;
    overflow-y: auto;
    flex-shrink: 0;
    height: 100%;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
}

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

.sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    color: var(--text-primary);
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: all 0.2s;
}

.sidebar .nav-link.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.sidebar .nav-link:hover {
    background-color: rgba(47, 79, 79, 0.03);
}

.sidebar .nav-link.active {
    background-color: rgba(47, 79, 79, 0.05);
    border-left-color: var(--accent-red);
    font-weight: 600;
    color: var(--slate-grey);
}

.sidebar .nav-link i {
    font-size: 1.1rem;
    width: 1.2rem;
    text-align: center;
}

.sidebar-heading {
    padding: 1rem 1.5rem 0.5rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* ===============================================
   BREADCRUMBS
   =============================================== */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0 0 1rem 0;
    list-style: none;
}

.breadcrumb-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.breadcrumb-item a {
    color: var(--slate-grey);
    text-decoration: none;
}

.breadcrumb-item a:hover {
    color: var(--accent-red);
}

.breadcrumb-item.active {
    color: var(--text-muted);
    font-weight: 600;
}

.breadcrumb-item + .breadcrumb-item::before {
    content: '/';
    color: var(--text-muted);
}

/* ===============================================
   CARDS
   =============================================== */
.card {
    background: var(--white);
    border: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.card-header {
    background-color: var(--slate-grey);
    color: var(--off-white);
    border-bottom: 2px solid var(--accent-red);
    padding: 1rem 1.25rem;
    font-weight: 600;
}

.card-body {
    padding: 1.25rem;
}

/* ===============================================
   BUTTONS
   =============================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 1rem;
    font-weight: 500;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    background: transparent;
}

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

.btn-primary {
    background-color: var(--slate-grey);
    color: var(--off-white);
    border-color: var(--slate-grey);
}

.btn-primary:hover:not(:disabled) {
    background-color: #1a2f2f;
    border-color: #1a2f2f;
}

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

.btn-danger:hover:not(:disabled) {
    background-color: #b01d25;
    border-color: #b01d25;
}

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

.btn-secondary {
    background-color: var(--text-muted);
    color: var(--white);
    border-color: var(--text-muted);
}

.btn-outline {
    background-color: transparent;
    color: var(--slate-grey);
    border-color: var(--slate-grey);
}

.btn-outline:hover:not(:disabled) {
    background-color: var(--slate-grey);
    color: var(--off-white);
}

.btn-sm {
    padding: 0.35rem 0.75rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1.125rem;
}

.btn-block {
    width: 100%;
}

.btn-group {
    display: inline-flex;
    gap: 0.5rem;
}

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

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.form-control,
.form-select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 1rem;
    border: 1px solid var(--border-color);
    background-color: var(--white);
    transition: border-color 0.2s;
}

.form-control:focus,
.form-select:focus {
    outline: none;
    border-color: var(--slate-grey);
    box-shadow: 0 0 0 3px rgba(47, 79, 79, 0.1);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-text {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.input-group {
    display: flex;
}

.input-group .form-control {
    flex: 1;
}

.input-group .btn {
    border-left: none;
}

/* ===============================================
   TABLES
   =============================================== */
.table-responsive {
    overflow-x: auto;
    width: 100%;
}

.table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--white);
}

.table thead {
    background-color: var(--slate-grey);
    color: var(--off-white);
}

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

.table th {
    font-weight: 600;
}

.table tbody tr:hover {
    background-color: rgba(47, 79, 79, 0.03);
}

/* ===============================================
   BADGES
   =============================================== */
.badge {
    display: inline-block;
    padding: 0.35em 0.65em;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1;
}

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

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

.badge-warning {
    background-color: var(--warning);
    color: var(--text-primary);
}

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

.badge-secondary {
    background-color: var(--text-muted);
    color: var(--white);
}

/* ===============================================
   ALERTS
   =============================================== */
.alert {
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
}

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

.alert-danger {
    background-color: #f8d7da;
    border-color: var(--accent-red);
    color: #721c24;
}

.alert-warning {
    background-color: #fff3cd;
    border-color: #ffc107;
    color: #856404;
}

.alert-info {
    background-color: #d1ecf1;
    border-color: #bee5eb;
    color: #0c5460;
}

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

.modal.active {
    display: flex;
}

.modal-dialog {
    background: var(--white);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
}

.modal-close {
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
}

/* ===============================================
   LOGIN PAGE
   =============================================== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--slate-grey);
    padding: 1rem;
}

.login-card {
    background-color: var(--off-white);
    border: 3px solid var(--accent-red);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.3);
    padding: 3rem 2.5rem;
    max-width: 400px;
    width: 100%;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    width: 80px;
    height: 80px;
    max-width: 80px;
    max-height: 80px;
    object-fit: contain;
    margin-bottom: 1rem;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.login-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.login-subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* ===============================================
   GRID SYSTEM
   =============================================== */
.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -0.75rem;
}

.col,
.col-1, .col-2, .col-3, .col-4, .col-5, .col-6,
.col-7, .col-8, .col-9, .col-10, .col-11, .col-12 {
    padding: 0 0.75rem;
    margin-bottom: 1.5rem;
}

.col { flex: 1; }
.col-1 { flex: 0 0 8.333333%; max-width: 8.333333%; }
.col-2 { flex: 0 0 16.666667%; max-width: 16.666667%; }
.col-3 { flex: 0 0 25%; max-width: 25%; }
.col-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
.col-5 { flex: 0 0 41.666667%; max-width: 41.666667%; }
.col-6 { flex: 0 0 50%; max-width: 50%; }
.col-7 { flex: 0 0 58.333333%; max-width: 58.333333%; }
.col-8 { flex: 0 0 66.666667%; max-width: 66.666667%; }
.col-9 { flex: 0 0 75%; max-width: 75%; }
.col-10 { flex: 0 0 83.333333%; max-width: 83.333333%; }
.col-11 { flex: 0 0 91.666667%; max-width: 91.666667%; }
.col-12 { flex: 0 0 100%; max-width: 100%; }

/* ===============================================
   UTILITY CLASSES
   =============================================== */
.hidden {
    display: none !important;
}

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-muted {
    color: var(--text-muted);
}

.text-primary {
    color: var(--slate-grey);
}

.text-danger {
    color: var(--danger);
}

.text-success {
    color: var(--success);
}

.font-monospace {
    font-family: 'Courier New', monospace;
}

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.flex {
    display: flex;
}

.flex-justify-between {
    justify-content: space-between;
}

.flex-align-center {
    align-items: center;
}

.flex-gap {
    gap: 1rem;
}

/* ===============================================
   SPINNER / LOADING
   =============================================== */
.spinner {
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-top-color: var(--slate-grey);
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    display: inline-block;
    border-radius: 50% !important;
}

.spinner-sm {
    width: 16px;
    height: 16px;
    border-width: 2px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.spinner-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
}

/* ===============================================
   EMPTY STATE
   =============================================== */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

/* ===============================================
   RESPONSIVE
   =============================================== */
@media (max-width: 768px) {
    .sidebar {
        display: none;
    }
    
    main {
        padding: 1rem;
    }
    
    .navbar {
        padding: 0.5rem 1rem;
    }
    
    .col-1, .col-2, .col-3, .col-4, .col-5, .col-6,
    .col-7, .col-8, .col-9, .col-10, .col-11, .col-12 {
        flex: 0 0 100%;
        max-width: 100%;
    }
}

/* ===============================================
   PAGE SPECIFIC STYLES
   =============================================== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color);
}

.page-title {
    font-size: 1.75rem;
    font-weight: 600;
    margin: 0;
}

.stat-card {
    background: var(--white);
    border: 1px solid var(--border-color);
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-card-content h3 {
    font-size: 2rem;
    margin: 0;
    font-weight: 700;
}

.stat-card-content p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.stat-card-icon {
    font-size: 2.5rem;
    color: var(--slate-grey);
}

/* ===============================================
   JOB ITEMS
   =============================================== */
.jobs-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.job-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border: 1px solid var(--border-color);
    background-color: var(--white);
    transition: background-color 0.2s;
}

.job-item:hover {
    background-color: rgba(47, 79, 79, 0.03);
}

.job-item-info {
    flex: 1;
    min-width: 0;
}

.job-item-details h4 {
    margin: 0 0 0.25rem 0;
    font-size: 1rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.job-item-details p {
    margin: 0;
    font-size: 0.875rem;
}

.job-item-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.job-links {
    display: flex;
    gap: 0.5rem;
}

.job-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid var(--slate-grey);
    color: var(--slate-grey);
    text-decoration: none;
    transition: all 0.2s;
}

.job-link:hover {
    background-color: var(--slate-grey);
    color: var(--off-white);
}

.job-link i {
    font-size: 1.1rem;
}

