/* ============================================================================
   Biotech Company Deep Profiler - Web Interface Styles
   Modern facelift - polished visuals, same structure & class names
   ============================================================================ */

:root {
    --primary: #0066cc;
    --primary-dark: #003d7a;
    --primary-light: #e6f0ff;
    --success: #16a34a;
    --success-light: #dcfce7;
    --warn: #d97706;
    --warn-light: #fef3c7;
    --error: #dc2626;
    --error-light: #fee2e2;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-900: #111827;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.12), 0 4px 10px rgba(0, 0, 0, 0.08);
    --transition-fast: 0.15s ease;
    --transition: 0.25s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--gray-50);
    background-image:
        radial-gradient(ellipse at 20% 0%, rgba(0, 102, 204, 0.04) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 100%, rgba(0, 61, 122, 0.03) 0%, transparent 60%);
    background-attachment: fixed;
    color: var(--gray-900);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ---- Navbar ---- */
.navbar {
    background: linear-gradient(135deg, var(--primary-dark) 0%, #004e9a 100%);
    color: white;
    padding: 0 1.5rem;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 12px rgba(0, 61, 122, 0.3);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.nav-brand {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.nav-links {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.nav-links a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
    transition: all var(--transition-fast);
    position: relative;
}

.nav-links a:hover {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    transform: translateY(-1px);
}

.nav-links a:active {
    transform: translateY(0);
}

.btn-logout {
    border: 1px solid rgba(255, 255, 255, 0.25) !important;
    backdrop-filter: blur(4px);
    transition: all var(--transition-fast) !important;
}

.btn-logout:hover {
    border-color: rgba(255, 255, 255, 0.45) !important;
    background: rgba(255, 255, 255, 0.12) !important;
}

/* ---- Container ---- */
.container {
    max-width: 920px;
    margin: 1.75rem auto;
    padding: 0 1.25rem;
    animation: fade-up 0.35s ease forwards;
}

/* ---- Cards ---- */
.card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid rgba(0, 0, 0, 0.05);
    padding: 1.5rem;
    margin-bottom: 1.25rem;
    transition: box-shadow var(--transition), transform var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card h2 {
    font-size: 1.1rem;
    font-weight: 650;
    margin-bottom: 1rem;
    color: var(--gray-700);
    letter-spacing: -0.01em;
}

/* ---- Alerts ---- */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 1rem;
    transition: opacity var(--transition);
}

.alert-warn {
    background: var(--warn-light);
    color: #92400e;
    border-left: 4px solid var(--warn);
}

.alert-error {
    background: var(--error-light);
    color: #991b1b;
    border-left: 4px solid var(--error);
}

.alert-success {
    background: var(--success-light);
    color: #166534;
    border-left: 4px solid var(--success);
}

/* ---- Forms ---- */
.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
    color: var(--gray-700);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

input[type="text"],
input[type="password"] {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1.5px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 0.95rem;
    background: white;
    color: var(--gray-900);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

input[type="text"]::placeholder,
input[type="password"]::placeholder {
    color: var(--gray-500);
    opacity: 0.7;
    font-weight: 400;
}

input[type="text"]:hover,
input[type="password"]:hover {
    border-color: var(--gray-500);
}

input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.15);
    background: white;
}

.form-row {
    display: flex;
    gap: 0.75rem;
    align-items: stretch;
}

.form-row input {
    flex: 1;
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.575rem 1.25rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: center;
    position: relative;
    user-select: none;
}

.btn:active:not(:disabled) {
    transform: translateY(1px);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: linear-gradient(180deg, var(--primary) 0%, #005bb5 100%);
    color: white;
    box-shadow: 0 1px 3px rgba(0, 102, 204, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(180deg, #0073e6 0%, var(--primary) 100%);
    box-shadow: 0 2px 8px rgba(0, 102, 204, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
    background: linear-gradient(180deg, #005bb5 0%, var(--primary-dark) 100%);
    box-shadow: 0 1px 2px rgba(0, 102, 204, 0.3), inset 0 1px 3px rgba(0, 0, 0, 0.1);
    transform: translateY(0);
}

.btn-success {
    background: linear-gradient(180deg, var(--success) 0%, #15803d 100%);
    color: white;
    box-shadow: 0 1px 3px rgba(22, 163, 74, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.btn-success:hover {
    background: linear-gradient(180deg, #1db954 0%, var(--success) 100%);
    box-shadow: 0 2px 8px rgba(22, 163, 74, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.15);
    transform: translateY(-1px);
}

.btn-success:active {
    transform: translateY(0);
}

.btn-outline {
    background: white;
    border: 1.5px solid var(--gray-300);
    color: var(--gray-700);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.btn-outline:hover {
    background: var(--gray-50);
    border-color: var(--gray-500);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.06);
    transform: translateY(-1px);
}

.btn-outline:active {
    background: var(--gray-100);
    transform: translateY(0);
}

.btn-sm {
    padding: 0.3rem 0.8rem;
    font-size: 0.8rem;
    border-radius: 7px;
}

.btn-full {
    width: 100%;
}

/* ---- Badge ---- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.175rem 0.65rem;
    border-radius: 99px;
    font-size: 0.7rem;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: all var(--transition);
}

.badge.idle {
    background: var(--gray-200);
    color: var(--gray-700);
}

.badge.pending {
    background: var(--gray-200);
    color: var(--gray-700);
}

.badge.running {
    background: var(--primary-light);
    color: var(--primary);
    animation: pulse-glow 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
    box-shadow: 0 0 0 0 rgba(0, 102, 204, 0.2);
}

.badge.complete {
    background: var(--success-light);
    color: var(--success);
}

.badge.failed {
    background: var(--error-light);
    color: var(--error);
}

@keyframes pulse-glow {
    0%, 100% {
        opacity: 1;
        box-shadow: 0 0 0 0 rgba(0, 102, 204, 0.25);
    }
    50% {
        opacity: 0.75;
        box-shadow: 0 0 0 6px rgba(0, 102, 204, 0);
    }
}

/* ---- Log area ---- */
.log-area {
    background: linear-gradient(180deg, #0d1117 0%, #161b22 100%);
    color: #c9d1d9;
    font-family: "SF Mono", "Cascadia Code", "Consolas", "Source Code Pro", "Fira Code", monospace;
    font-size: 0.8rem;
    line-height: 1.6;
    padding: 1rem 1.25rem;
    border-radius: var(--radius);
    border: 1px solid rgba(255, 255, 255, 0.06);
    max-height: 400px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
    margin-bottom: 1rem;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Custom scrollbar for log area */
.log-area::-webkit-scrollbar {
    width: 8px;
}

.log-area::-webkit-scrollbar-track {
    background: transparent;
}

.log-area::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

.log-area::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* ---- Tables ---- */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

thead th {
    text-align: left;
    padding: 0.7rem 0.85rem;
    border-bottom: 2px solid var(--gray-200);
    font-size: 0.75rem;
    font-weight: 650;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--gray-50);
}

thead th:first-child {
    border-top-left-radius: 8px;
}

thead th:last-child {
    border-top-right-radius: 8px;
}

tbody td {
    padding: 0.7rem 0.85rem;
    border-bottom: 1px solid var(--gray-100);
    transition: background var(--transition-fast);
}

tbody tr:nth-child(even) {
    background: rgba(249, 250, 251, 0.5);
}

tbody tr {
    transition: background var(--transition-fast);
}

tbody tr:hover {
    background: var(--primary-light);
}

tbody tr:last-child td {
    border-bottom: none;
}

.actions {
    display: flex;
    gap: 0.5rem;
}

/* ---- Detail page ---- */
.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.detail-header h2 {
    margin-bottom: 0.25rem;
}

.back-link {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--primary);
    text-decoration: none;
    margin-bottom: 0.5rem;
    padding: 0.15rem 0;
    transition: color var(--transition-fast);
}

.back-link:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* ---- File icons ---- */
.file-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.125rem 0.45rem;
    border-radius: 4px;
    font-size: 0.6rem;
    font-weight: 700;
    margin-right: 0.5rem;
    background: var(--gray-200);
    color: var(--gray-700);
    letter-spacing: 0.03em;
    transition: transform var(--transition-fast);
}

.file-icon.pdf {
    background: #fecaca;
    color: #991b1b;
}

.file-icon.md {
    background: #dbeafe;
    color: #1e40af;
}

tr:hover .file-icon {
    transform: scale(1.05);
}

/* ---- Login page ---- */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background:
        radial-gradient(ellipse at 30% 20%, rgba(0, 102, 204, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 80%, rgba(0, 61, 122, 0.1) 0%, transparent 50%),
        linear-gradient(135deg, var(--primary-dark) 0%, #004e9a 50%, var(--primary) 100%);
    overflow: hidden;
}

.login-body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 100px,
            rgba(255, 255, 255, 0.015) 100px,
            rgba(255, 255, 255, 0.015) 101px
        ),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 100px,
            rgba(255, 255, 255, 0.015) 100px,
            rgba(255, 255, 255, 0.015) 101px
        );
    pointer-events: none;
    z-index: 0;
}

.login-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 14px;
    box-shadow:
        0 20px 60px rgba(0, 0, 0, 0.25),
        0 0 0 1px rgba(255, 255, 255, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    padding: 2.5rem;
    width: 100%;
    max-width: 400px;
    margin: 1rem;
    position: relative;
    z-index: 1;
    animation: card-enter 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes card-enter {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.login-card h1 {
    font-size: 1.6rem;
    font-weight: 750;
    color: var(--primary-dark);
    margin-bottom: 0.2rem;
    letter-spacing: -0.025em;
}

.login-card .subtitle {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-bottom: 1.75rem;
    font-weight: 400;
}

.login-card .btn-primary {
    margin-top: 0.5rem;
    padding: 0.7rem 1.25rem;
    font-size: 0.95rem;
}

/* ---- Helpers ---- */
.text-muted {
    color: var(--gray-500);
    font-size: 0.85rem;
}

.text-muted a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--transition-fast);
}

.text-muted a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

.job-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.job-header h2 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

/* ---- Page load animation ---- */
@keyframes fade-up {
    0% {
        opacity: 0;
        transform: translateY(8px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---- Selection styling ---- */
::selection {
    background: rgba(0, 102, 204, 0.2);
    color: inherit;
}

/* ---- Mobile responsive ---- */
@media (max-width: 768px) {
    .navbar {
        padding: 0 1rem;
        height: 50px;
    }

    .nav-brand {
        font-size: 0.95rem;
    }

    .nav-links {
        gap: 0.35rem;
    }

    .nav-links a {
        font-size: 0.8rem;
        padding: 0.25rem 0.5rem;
    }

    .container {
        margin: 1rem auto;
        padding: 0 0.75rem;
    }

    .card {
        padding: 1.125rem;
        border-radius: 8px;
    }

    .form-row {
        flex-direction: column;
    }

    .form-row .btn {
        width: 100%;
    }

    .log-area {
        max-height: 300px;
        font-size: 0.7rem;
        padding: 0.75rem 1rem;
    }

    .detail-header {
        flex-direction: column;
    }

    .actions {
        flex-direction: column;
    }

    table {
        font-size: 0.8rem;
    }

    thead th, tbody td {
        padding: 0.45rem 0.55rem;
    }
}

@media (max-width: 480px) {
    .login-card {
        padding: 1.75rem;
        border-radius: 12px;
        margin: 0.75rem;
    }

    .login-card h1 {
        font-size: 1.35rem;
    }

    .log-area {
        max-height: 250px;
        font-size: 0.65rem;
    }
}
