/* Omnes Font */
@font-face {
    font-family: 'Omnes';
    src: url('/static/Omnes Thin.ttf') format('truetype');
    font-weight: 300;
    font-style: normal;
}

@font-face {
    font-family: 'Omnes';
    src: url('/static/Omnes Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
}

@font-face {
    font-family: 'Omnes';
    src: url('/static/Omnes Medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
}

/* CSS Variables */
:root {
    --color-red: #FF4342;
    --color-dark-blue: #131429;
    --color-white: #ffffff;
    --color-light-gray: #f5f5f7;
    --color-gray: #e0e0e0;
    --color-text-muted: #666;
    --font-family: 'Omnes', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

body {
    font-family: var(--font-family);
    background-color: var(--color-white);
    color: var(--color-dark-blue);
    line-height: 1.6;
    min-height: 100vh;
}

/* Layout */
.app-container {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: var(--color-white);
    border-bottom: 1px solid var(--color-gray);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.logo {
    height: 40px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-email {
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: 6px;
    font-family: var(--font-family);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

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

.btn-primary:hover {
    background: #e63b3a;
}

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

.btn-secondary:hover {
    background: #1e1f3d;
}

.btn-outline {
    background: transparent;
    color: var(--color-dark-blue);
    border: 1px solid var(--color-gray);
}

.btn-outline:hover {
    background: var(--color-light-gray);
}

.btn-small {
    padding: 0.375rem 0.75rem;
    font-size: 0.8rem;
}

.btn-icon {
    padding: 0.5rem;
    min-width: auto;
}

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

/* Sidebar */
.sidebar {
    width: 240px;
    background: var(--color-dark-blue);
    color: var(--color-white);
    display: flex;
    flex-direction: column;
}

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

.sidebar-logo {
    height: 32px;
    filter: brightness(0) invert(1);
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.5rem;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.sidebar-nav a:hover {
    color: var(--color-white);
    background: rgba(255,255,255,0.05);
}

.sidebar-nav a.active {
    color: var(--color-white);
    background: rgba(255,255,255,0.1);
    border-right: 3px solid var(--color-red);
}

.sidebar-nav svg {
    width: 20px;
    height: 20px;
}

/* Content Area */
.content {
    flex: 1;
    padding: 2rem;
    background: var(--color-light-gray);
}

.page-title {
    font-size: 1.75rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
    color: var(--color-dark-blue);
}

/* Cards */
.card {
    background: var(--color-white);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

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

.card-title {
    font-size: 1.1rem;
    font-weight: 500;
}

.card-body {
    padding: 1.5rem;
}

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

table {
    width: 100%;
    border-collapse: collapse;
}

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

th {
    font-weight: 500;
    color: var(--color-text-muted);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    background: var(--color-light-gray);
}

tr:hover {
    background: var(--color-light-gray);
}

tr.clickable {
    cursor: pointer;
}

/* Status Badges */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 500;
}

.status-pending {
    background: #fef3c7;
    color: #92400e;
}

.status-running {
    background: #dbeafe;
    color: #1e40af;
}

.status-completed {
    background: #d1fae5;
    color: #065f46;
}

.status-failed {
    background: #fee2e2;
    color: #991b1b;
}

.status-cancelled {
    background: #e5e7eb;
    color: #374151;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--color-white);
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(0.95);
    transition: transform 0.2s ease;
}

.modal-overlay.active .modal {
    transform: scale(1);
}

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

.modal-title {
    font-size: 1.25rem;
    font-weight: 500;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--color-text-muted);
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-close:hover {
    color: var(--color-dark-blue);
}

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

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

/* Job Details */
.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.detail-item {
    padding: 0.75rem;
    background: var(--color-light-gray);
    border-radius: 6px;
}

.detail-item.full-width {
    grid-column: span 2;
}

.detail-label {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.025em;
    margin-bottom: 0.25rem;
}

.detail-value {
    font-size: 0.95rem;
    word-break: break-word;
}

.detail-value pre {
    background: var(--color-dark-blue);
    color: var(--color-white);
    padding: 1rem;
    border-radius: 6px;
    font-size: 0.8rem;
    overflow-x: auto;
    margin-top: 0.5rem;
}

/* Login Page */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--color-dark-blue) 0%, #1e1f3d 100%);
}

.login-card {
    background: var(--color-white);
    border-radius: 16px;
    padding: 3rem;
    width: 90%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
}

.login-logo {
    height: 48px;
    margin-bottom: 2rem;
}

.login-title {
    font-size: 1.5rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--color-dark-blue);
}

.login-subtitle {
    color: var(--color-text-muted);
    margin-bottom: 2rem;
}

.login-btn {
    width: 100%;
    padding: 0.875rem;
    font-size: 1rem;
}

.login-divider {
    display: flex;
    align-items: center;
    margin: 1.5rem 0;
    color: var(--color-text-muted);
    font-size: 0.85rem;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--color-gray);
}

.login-divider::before {
    margin-right: 1rem;
}

.login-divider::after {
    margin-left: 1rem;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--color-gray);
}

.pagination-info {
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

.pagination-controls {
    display: flex;
    gap: 0.5rem;
}

/* Loading */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--color-text-muted);
}

.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--color-gray);
    border-top-color: var(--color-red);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 0.75rem;
}

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

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--color-text-muted);
}

.empty-state svg {
    width: 48px;
    height: 48px;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background: var(--color-dark-blue);
    color: var(--color-white);
    padding: 1rem 1.5rem;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    animation: slideIn 0.3s ease;
}

.toast.error {
    background: var(--color-red);
}

.toast.success {
    background: #059669;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Config Cards */
.config-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.config-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--color-light-gray);
    border-radius: 8px;
}

.config-info h4 {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.config-info p {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.config-actions {
    display: flex;
    gap: 0.5rem;
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        left: -240px;
        height: 100vh;
        z-index: 100;
        transition: left 0.3s ease;
    }

    .sidebar.open {
        left: 0;
    }

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

    .detail-item.full-width {
        grid-column: span 1;
    }

    .header {
        padding: 1rem;
    }

    .content {
        padding: 1rem;
    }
}
