/**
 * AR-CICD Platform - Screen Styles
 * ================================
 * Specific styles for each application screen
 */

/* ==========================================================================
   Login Screen - Immersive Design
   ========================================================================== */

.login-page {
    display: flex;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--primary) 0%, #7C3AED 100%);
}

.login-hero {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: var(--space-8);
    color: white;
    position: relative;
    overflow: hidden;
}

.hero-content {
    text-align: center;
    z-index: 1;
    max-width: 500px;
}

.hero-logo {
    font-size: 5rem;
    margin-bottom: var(--space-4);
    animation: float 3s ease-in-out infinite;
}

/* Minimal SVG icons inherit sizing from whatever font-size the emoji they replaced used */
.input-icon svg, .stage-icon svg, .check-icon svg, .upload-zone-icon svg,
.hero-logo svg, .feature-icon svg, .icon-btn svg, .toggle-password svg,
.stat-icon svg, .activity-icon svg, .status-badge svg, .btn svg,
h2 svg, h3 svg, h4 svg {
    width: 1em;
    height: 1em;
    vertical-align: -0.125em;
    display: inline-block;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.login-hero h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: var(--space-2);
    color: white;
}

.hero-tagline {
    font-size: 1.125rem;
    opacity: 0.9;
    margin-bottom: var(--space-8);
}

.hero-features {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    text-align: left;
}

.feature-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: 1rem;
}

.feature-icon {
    width: 24px;
    height: 24px;
    background: rgba(255,255,255,0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
}

.hero-wave {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    pointer-events: none;
}

.hero-wave svg {
    width: 100%;
    height: auto;
}

/* Shown only on mobile, below the sign-in card - see mobile media query */
.hero-tagline-mobile {
    display: none;
}

.login-form-container {
    flex: 0 0 480px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-8);
    background: var(--gray-50);
}

[data-theme="dark"] .login-form-container {
    background: var(--gray-100);
}

.login-box {
    width: 100%;
    max-width: 400px;
}

.login-header {
    text-align: center;
    margin-bottom: var(--space-8);
}

.login-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: var(--space-2);
}

[data-theme="dark"] .login-header h1 {
    color: var(--gray-900);
}

.login-header p {
    color: var(--gray-500);
    font-size: 0.875rem;
}

[data-theme="dark"] .login-header p {
    color: var(--gray-600);
}

/* Input Groups */
.login-form .input-group {
    margin-bottom: var(--space-5);
}

.login-form .input-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: var(--space-2);
}

[data-theme="dark"] .login-form .input-group label {
    color: var(--gray-600);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: var(--space-4);
    font-size: 1rem;
    pointer-events: none;
}

.input-wrapper input,
.input-wrapper select {
    width: 100%;
    padding: var(--space-4);
    padding-left: calc(var(--space-4) + 2rem);
    padding-right: calc(var(--space-4) + 2.5rem);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-lg);
    font-size: 1rem;
    transition: all var(--transition);
    background: var(--surface);
    color: var(--gray-900);
}

[data-theme="dark"] .input-wrapper input,
[data-theme="dark"] .input-wrapper select {
    background: var(--gray-200);
    border-color: var(--gray-300);
    color: var(--gray-900);
}

.input-wrapper input:focus,
.input-wrapper select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

.input-wrapper input::placeholder {
    color: var(--gray-400);
}

.toggle-password {
    position: absolute;
    right: var(--space-3);
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: var(--space-1);
    color: var(--gray-500);
}

.toggle-password:hover {
    color: var(--gray-700);
}

.input-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
}

/* Password Strength */
.password-strength {
    margin-top: var(--space-3);
}

.strength-bar {
    height: 4px;
    background: var(--gray-200);
    border-radius: 2px;
    overflow: hidden;
}

[data-theme="dark"] .strength-bar {
    background: var(--gray-300);
}

.strength-fill {
    height: 100%;
    width: 0;
    transition: all var(--transition);
    border-radius: 2px;
}

.strength-fill.weak { width: 25%; background: var(--error); }
.strength-fill.fair { width: 50%; background: var(--warning); }
.strength-fill.good { width: 75%; background: #10B981; }
.strength-fill.strong { width: 100%; background: var(--success); }

.strength-text {
    font-size: 0.75rem;
    margin-top: var(--space-1);
    color: var(--gray-500);
}

.password-rules {
    margin-top: var(--space-3);
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.rule {
    font-size: 0.75rem;
    color: var(--gray-500);
    display: flex;
    align-items: center;
    gap: var(--space-1);
}

.rule.valid {
    color: var(--success);
}

.rule.valid::before {
    content: '✓';
}

.rule:not(.valid)::before {
    content: '✗';
}

.signup-link {
    text-align: center;
    margin-top: var(--space-6);
    color: var(--gray-600);
    font-size: 0.875rem;
}

.signup-link a {
    color: var(--primary);
    font-weight: 500;
    text-decoration: none;
}

.signup-link.legal-links {
    margin-top: var(--space-3);
    font-size: 0.75rem;
}

.signup-link.legal-links a {
    color: var(--gray-500);
    font-weight: 400;
}

.signup-link a:hover {
    text-decoration: underline;
}

.btn-lg {
    padding: var(--space-4) var(--space-6);
    font-size: 1rem;
    font-weight: 600;
}

/* Demo accounts section (if needed) */
.demo-accounts h4 {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-bottom: var(--space-3);
}

.account-grid {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.demo-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-3);
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition);
}

.demo-btn:hover {
    background: var(--gray-100);
    border-color: var(--gray-300);
}

.demo-btn small {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-top: var(--space-1);
}

.demo-note {
    margin-top: var(--space-4);
    font-size: 0.75rem;
    color: var(--gray-500);
}

.demo-note code {
    background: var(--gray-100);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
}

/* ==========================================================================
   Dashboard Screen
   ========================================================================== */

.welcome-banner {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.welcome-banner h2 {
    font-size: 1.5rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-8);
}

.stat-card {
    background: var(--surface);
    padding: var(--space-6);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border-top: 3px solid transparent;
    transition: transform var(--transition), box-shadow var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-card .stat-icon {
    margin-bottom: var(--space-3);
}

.stat-icon-badge {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-lg);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.stat-icon-badge svg { width: 1.1em; height: 1.1em; }

.stat-icon-badge.blue { background: var(--info-light); color: var(--info); }
.stat-icon-badge.purple { background: var(--researcher-light); color: var(--researcher); }
.stat-icon-badge.amber { background: var(--warning-light); color: var(--warning); }
.stat-icon-badge.green { background: var(--success-light); color: var(--success); }
.stat-icon-badge.red { background: var(--error-light); color: var(--error); }

.stat-card.accent-blue { border-top-color: var(--info); }
.stat-card.accent-purple { border-top-color: var(--researcher); }
.stat-card.accent-amber { border-top-color: var(--warning); }
.stat-card.accent-green { border-top-color: var(--success); }
.stat-card.accent-red { border-top-color: var(--error); }

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--gray-900);
}

.stat-card .stat-label {
    font-size: 0.875rem;
    color: var(--gray-500);
}

/* Pipeline */
.pipeline-section {
    background: var(--surface);
    padding: var(--space-6);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: var(--space-6);
}

.pipeline-section h3 {
    margin-bottom: var(--space-4);
}

.pipeline-track {
    display: flex;
    align-items: center;
    padding: var(--space-4);
    background: var(--gray-50);
    border-radius: var(--radius);
    flex-wrap: wrap;
    row-gap: var(--space-3);
}

.pipeline-stage {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius);
    cursor: default;
}

.stage-marker {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid var(--gray-300);
    color: #fff;
    flex-shrink: 0;
    transition: background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.stage-marker svg {
    width: 11px;
    height: 11px;
    display: none;
}

.stage-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--gray-400);
    white-space: nowrap;
    transition: color 0.25s ease;
}

.pipeline-connector {
    flex: 1;
    min-width: 20px;
    height: 2px;
    margin: 0 var(--space-1);
    background: var(--gray-200);
    transition: background 0.3s ease;
}

.pipeline-connector.completed {
    background: var(--success);
}

.pipeline-stage.completed .stage-marker {
    background: var(--success);
    border-color: var(--success);
}

.pipeline-stage.completed .stage-marker svg {
    display: block;
}

.pipeline-stage.completed .stage-name {
    color: var(--success);
}

.pipeline-stage.active .stage-marker {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
    animation: pipeline-pulse 2s ease-in-out infinite;
}

.pipeline-stage.active .stage-name {
    color: var(--primary);
    font-weight: 700;
}

@keyframes pipeline-pulse {
    0%, 100% { box-shadow: 0 0 0 4px var(--primary-light); }
    50% { box-shadow: 0 0 0 6px var(--primary-light); }
}

.stage-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-6px);
    background: var(--gray-900);
    color: #fff;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius);
    font-size: 0.75rem;
    font-weight: 400;
    white-space: normal;
    width: max-content;
    max-width: 220px;
    text-align: center;
    line-height: 1.4;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
    z-index: 5;
    box-shadow: var(--shadow-lg);
    margin-bottom: var(--space-1);
}

.stage-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: var(--gray-900);
}

.pipeline-stage:hover .stage-tooltip,
.pipeline-stage:focus-visible .stage-tooltip {
    opacity: 1;
    transform: translateX(-50%) translateY(-2px);
}

/* Activity */
.recent-activity {
    background: var(--surface);
    padding: var(--space-6);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-3);
    border-radius: var(--radius);
    background: var(--gray-50);
}

.activity-icon {
    font-size: 1.25rem;
}

.activity-content {
    flex: 1;
}

.activity-text {
    font-size: 0.875rem;
}

.activity-time {
    font-size: 0.75rem;
    color: var(--gray-400);
}

/* ==========================================================================
   Projects Screen
   ========================================================================== */

.screen-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-6);
}

.project-list {
    display: grid;
    gap: var(--space-4);
}

.project-card {
    background: var(--surface);
    padding: var(--space-6);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all var(--transition);
}

.project-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.project-card h3 {
    margin-bottom: var(--space-2);
}

.project-meta {
    display: flex;
    gap: var(--space-4);
    margin-top: var(--space-3);
    font-size: 0.875rem;
    color: var(--gray-500);
}

/* ==========================================================================
   Validation & Review
   ========================================================================== */

.validation-checks {
    display: grid;
    gap: var(--space-4);
}

.check-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4);
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.check-icon {
    font-size: 1.5rem;
}

.check-icon.passed { color: var(--success); }
.check-icon.failed { color: var(--error); }
.check-icon.pending { color: var(--gray-400); }

.check-details {
    flex: 1;
}

.check-name {
    font-weight: 500;
}

.check-desc {
    font-size: 0.75rem;
    color: var(--gray-500);
}

.annotation-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.annotation-item {
    background: var(--surface);
    padding: var(--space-4);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.annotation-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--space-2);
}

.annotation-author {
    font-weight: 500;
    font-size: 0.875rem;
}

.annotation-status {
    font-size: 0.75rem;
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
}

.annotation-quote {
    padding: var(--space-3);
    background: var(--warning-light);
    border-left: 3px solid var(--warning);
    font-style: italic;
    margin-bottom: var(--space-3);
    font-size: 0.875rem;
}

.annotation-body {
    font-size: 0.875rem;
}

.replies-section {
    margin-top: var(--space-3);
    padding-top: var(--space-3);
    border-top: 1px solid var(--gray-200);
}

.reply-item {
    padding: var(--space-2) 0;
    font-size: 0.875rem;
}

/* ==========================================================================
   Chat
   ========================================================================== */

.chat-container {
    display: flex;
    height: calc(100vh - 150px);
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.chat-sidebar {
    width: 300px;
    flex-shrink: 0;
    border-right: 1px solid var(--gray-200);
    overflow-y: auto;
    background: var(--surface);
}

.chat-conversation {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3);
    border-bottom: 1px solid var(--gray-100);
    cursor: pointer;
    transition: background-color var(--transition);
}

.chat-conversation:hover {
    background-color: var(--gray-50);
}

.chat-conversation.active {
    background-color: var(--primary-light);
}

.chat-avatar-wrap {
    position: relative;
    flex-shrink: 0;
}

.chat-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--primary);
    overflow: hidden;
    flex-shrink: 0;
}

.chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.online-dot {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: var(--gray-300);
    border: 2px solid white;
}

.online-dot.online {
    background: var(--success, #22c55e);
}

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

.chat-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--gray-900);
}

.chat-role {
    font-size: 0.6875rem;
    color: var(--gray-500);
    margin-bottom: 2px;
}

.chat-preview {
    font-size: 0.8125rem;
    color: var(--gray-500);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-unread-badge {
    flex-shrink: 0;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: var(--radius-full);
    background: var(--primary);
    color: white;
    font-size: 0.6875rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.chat-header {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--gray-200);
    background: var(--surface);
}

.chat-header-name {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--gray-900);
}

.chat-header-status {
    font-size: 0.75rem;
    color: var(--gray-500);
}

.chat-header-status.online {
    color: var(--success, #22c55e);
}

.chat-messages {
    flex: 1;
    padding: var(--space-4);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    background:
        radial-gradient(circle at 10% 10%, rgba(79, 70, 229, 0.04) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(124, 58, 237, 0.04) 0%, transparent 40%),
        var(--gray-50);
}

[data-theme="dark"] .chat-messages {
    background: var(--gray-50);
}

.chat-message {
    max-width: 65%;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-lg);
    font-size: 0.875rem;
    box-shadow: 0 1px 1px rgba(0, 0, 0, 0.06);
    position: relative;
}

.chat-message.sent {
    align-self: flex-end;
    background: var(--primary);
    color: white;
    border-bottom-right-radius: var(--radius-sm);
}

.chat-message.received {
    align-self: flex-start;
    background: var(--surface);
    border-bottom-left-radius: var(--radius-sm);
}

.chat-message .sender {
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: var(--space-1);
    color: var(--primary);
}

.chat-message .text {
    white-space: pre-wrap;
    word-break: break-word;
}

.msg-meta {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
}

.msg-time {
    font-size: 0.6875rem;
    opacity: 0.7;
}

.msg-ticks {
    font-size: 0.75rem;
    letter-spacing: -2px;
    opacity: 0.7;
}

.msg-ticks.read {
    opacity: 1;
    color: #93c5fd;
}

.chat-input {
    display: flex;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    border-top: 1px solid var(--gray-200);
    background: var(--surface);
}

.chat-input input {
    flex: 1;
    border-radius: var(--radius-full);
    padding: var(--space-2) var(--space-4);
}

.chat-input .btn {
    border-radius: var(--radius-full);
}

/* ==========================================================================
   Modals
   ========================================================================== */

.modal-container {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}

.modal {
    position: relative;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    background: var(--surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-6);
    border-bottom: 1px solid var(--gray-200);
}

.modal-close {
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    border-radius: var(--radius);
}

.modal-close:hover {
    background: var(--gray-100);
}

.modal-content {
    padding: var(--space-6);
    overflow-y: auto;
}

/* ==========================================================================
   Toasts
   ========================================================================== */

.toast-container {
    position: fixed;
    bottom: var(--space-6);
    right: var(--space-6);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.toast {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-4);
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    animation: slideIn var(--transition);
}

.toast.success {
    border-left: 4px solid var(--success);
}

.toast.error {
    border-left: 4px solid var(--error);
}

.toast.warning {
    border-left: 4px solid var(--warning);
}

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

/* ==========================================================================
   File Upload
   ========================================================================== */

.upload-zone {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-lg);
    padding: var(--space-8);
    text-align: center;
    cursor: pointer;
    transition: all var(--transition);
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.upload-zone-icon {
    font-size: 3rem;
    margin-bottom: var(--space-4);
}

.upload-zone h3 {
    margin-bottom: var(--space-2);
}

.upload-zone p {
    font-size: 0.875rem;
    color: var(--gray-500);
}

/* ==========================================================================
   Table Styles
   ========================================================================== */

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.data-table th,
.data-table td {
    padding: var(--space-3) var(--space-4);
    text-align: left;
    border-bottom: 1px solid var(--gray-200);
}

.data-table th {
    background: var(--gray-50);
    font-weight: 600;
    font-size: 0.875rem;
}

.data-table tr:hover td {
    background: var(--gray-50);
}

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

/* ==========================================================================
   Admin Tabs
   ========================================================================== */

.admin-tabs {
    display: flex;
    gap: var(--space-2);
    margin-bottom: var(--space-6);
    border-bottom: 1px solid var(--gray-200);
}

.tab-btn {
    padding: var(--space-3) var(--space-4);
    background: none;
    border: none;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-500);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.tab-btn:hover {
    color: var(--gray-700);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.admin-tab-content {
    background: var(--surface);
    padding: var(--space-6);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

/* ==========================================================================
   Validation & Preprocessing Screen
   ========================================================================== */

.validation-checks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-4);
    margin-top: var(--space-4);
}

.check-card {
    background: var(--gray-50);
    padding: var(--space-5);
    border-radius: var(--radius-lg);
    border: 2px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
}

.check-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.check-icon {
    font-size: 2.5rem;
    margin-bottom: var(--space-3);
}

.check-card h4 {
    font-size: 1rem;
    margin-bottom: var(--space-2);
}

.check-card p {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin: 0;
}

/* Reference Tools */
.reference-tools {
    margin-top: var(--space-4);
}

.tool-section h4 {
    margin-bottom: var(--space-2);
}

.tool-section p {
    font-size: 0.875rem;
    color: var(--gray-500);
    margin-bottom: var(--space-3);
}

.doi-checker {
    display: flex;
    gap: var(--space-2);
}

.doi-checker input {
    flex: 1;
}

/* Recency Score */
.recency-info {
    margin-top: var(--space-4);
}

.recency-bar-container {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.recency-bar {
    flex: 1;
    height: 24px;
    background: var(--gray-200);
    border-radius: 12px;
    overflow: hidden;
}

.recency-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--error) 0%, var(--warning) 50%, var(--success) 100%);
    border-radius: 12px;
    transition: width 0.5s ease;
}

.recency-percentage {
    font-size: 1.25rem;
    font-weight: 700;
    min-width: 60px;
    text-align: right;
}

/* Score details */
.score-details {
    font-size: 0.7rem;
    color: var(--gray-500);
    margin-top: var(--space-1);
    text-align: center;
}

/* ==========================================================================
   Collaborators Screen
   ========================================================================== */

.invitations-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.invitation-card {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: var(--space-4);
    background: var(--gray-50);
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-200);
}

.invitation-info {
    flex: 1;
}

.invitation-info strong {
    color: var(--gray-900);
}

.invitation-message {
    margin: var(--space-2) 0;
    font-style: italic;
    color: var(--gray-600);
}

.invitation-actions {
    display: flex;
    gap: var(--space-2);
}

.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-badge.pending {
    background: var(--warning-light);
    color: var(--warning);
}

.status-badge.accepted {
    background: var(--success-light);
    color: var(--success);
}

.status-badge.rejected,
.status-badge.expired,
.status-badge.cancelled {
    background: var(--gray-100);
    color: var(--gray-500);
}

.empty-state {
    text-align: center;
    padding: var(--space-6);
}

/* Dark mode for collaborators */
[data-theme="dark"] .invitation-card {
    background: var(--gray-200);
    border-color: var(--gray-300);
}

[data-theme="dark"] .status-badge.pending {
    background: rgba(245, 158, 11, 0.2);
    color: #F59E0B;
}

.doi-result {
    margin-top: var(--space-3);
}

.doi-success, .doi-error {
    padding: var(--space-4);
    border-radius: var(--radius);
}

.doi-success {
    background: var(--success-light);
    border: 1px solid var(--success);
}

.doi-error {
    background: var(--error-light);
    border: 1px solid var(--error);
}

.doi-success h4, .doi-error h4 {
    margin-bottom: var(--space-2);
}

.doi-success p, .doi-error p {
    margin: var(--space-1) 0;
    font-size: 0.875rem;
}

.style-converter {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.style-selectors {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.style-selectors select {
    flex: 1;
}

.style-selectors span {
    font-weight: 600;
    color: var(--gray-500);
}

.converted-result {
    margin-top: var(--space-4);
}

.conversion-result {
    background: var(--gray-50);
    padding: var(--space-4);
    border-radius: var(--radius);
}

.conversion-result h4 {
    font-size: 0.875rem;
    margin-bottom: var(--space-2);
}

.original-ref, .converted-ref {
    padding: var(--space-3);
    background: var(--surface);
    border-radius: var(--radius);
    font-size: 0.875rem;
    margin-bottom: var(--space-3);
}

/* Validation Results */
.validation-results {
    min-width: 400px;
}

.result-header {
    padding: var(--space-4);
    border-radius: var(--radius);
    text-align: center;
    font-weight: 600;
    margin-bottom: var(--space-4);
}

.result-header.success {
    background: var(--success-light);
    color: var(--success);
}

.result-header.warning {
    background: var(--warning-light);
    color: var(--warning);
}

.scores-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-4);
}

.score-card {
    background: var(--gray-50);
    padding: var(--space-4);
    border-radius: var(--radius);
}

.score-label {
    font-size: 0.75rem;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.score-value {
    font-size: 1.5rem;
    font-weight: 700;
    margin: var(--space-2) 0;
}

.score-bar {
    height: 4px;
    background: var(--gray-200);
    border-radius: 2px;
    overflow: hidden;
}

/* Responsive adjustments for small screens */
@media (max-width: 1024px) {
    .login-hero { max-width: 45%; }
    .chat-container { height: calc(100vh - 120px); }
}

@media (max-width: 768px) {
    /* Stack login hero and form vertically, compact enough to limit scrolling */
    .login-page {
        flex-direction: column;
        min-height: auto;
    }

    .login-hero {
        flex: none;
        padding: var(--space-5) var(--space-5) var(--space-3);
        text-align: center;
        max-width: 100%;
    }

    .hero-logo { font-size: 2.25rem; margin-bottom: var(--space-2); animation: none; }
    .hero-content { max-width: none; }

    .login-hero h1 { font-size: 1.5rem; margin-bottom: var(--space-1); }

    /* Tagline moves below the sign-in card on mobile; hide the hero copy */
    .login-hero .hero-tagline { display: none; }

    .hero-features {
        gap: var(--space-2);
    }

    .feature-item { font-size: 0.8125rem; gap: var(--space-2); }
    .feature-icon { width: 18px; height: 18px; font-size: 0.7rem; }

    /* Decorative wave just eats vertical space on small screens */
    .hero-wave { display: none; }

    .login-form-container {
        flex: 1 1 auto;
        padding: var(--space-4);
        background: transparent;
    }

    .login-box {
        max-width: none;
        background: var(--gray-50);
        border-radius: var(--radius-lg);
        padding: var(--space-5);
        box-shadow: var(--shadow-md);
    }

    .login-header { margin-bottom: var(--space-4); }
    .login-form .input-group { margin-bottom: var(--space-3); }

    .hero-tagline-mobile {
        display: block;
        text-align: center;
        color: white;
        opacity: 0.9;
        font-size: 0.9375rem;
        padding: 0 var(--space-5) var(--space-5);
        margin: 0;
    }

    [data-theme="dark"] .login-box {
        background: var(--gray-100);
    }

    .input-row { grid-template-columns: 1fr; }

    /* Pipeline: tighten the breadcrumb so it wraps cleanly on narrow screens */
    .pipeline-track { padding: var(--space-3); }
    .pipeline-connector { min-width: 12px; }
    .stage-name { font-size: 0.8rem; }

    /* Chat stacks */
    .chat-container { flex-direction: column; height: auto; }
    .chat-sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--gray-200); }
    .chat-main { width: 100%; }

    /* Modals and content adapt */
    .modal { width: 95%; max-width: 95%; }

    /* Welcome banner stacks */
    .welcome-banner { flex-direction: column; align-items: flex-start; }
}

.score-fill {
    height: 100%;
    transition: width var(--transition);
}

.issues-list {
    max-height: 200px;
    overflow-y: auto;
}

.issue-item {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    padding: var(--space-3);
    border-radius: var(--radius);
    margin-bottom: var(--space-2);
    font-size: 0.875rem;
}

.issue-item.error {
    background: var(--error-light);
    border-left: 3px solid var(--error);
}

.issue-item.warning {
    background: var(--warning-light);
    border-left: 3px solid var(--warning);
}

.issue-item.info {
    background: var(--info-light);
    border-left: 3px solid var(--info);
}

.issue-type {
    font-weight: 600;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(0,0,0,0.1);
}

.issue-message {
    flex: 1;
}

.issue-suggestion {
    width: 100%;
    font-style: italic;
    color: var(--gray-500);
    margin-top: var(--space-1);
}

.btn-sm {
    padding: var(--space-2) var(--space-3);
    font-size: 0.875rem;
}

/* Dark mode adjustments for validation */
[data-theme="dark"] .validation-checks-grid .check-card {
    background: var(--gray-200);
}

[data-theme="dark"] .score-card {
    background: var(--gray-200);
}

[data-theme="dark"] .conversion-result {
    background: var(--gray-200);
}

[data-theme="dark"] .original-ref,
[data-theme="dark"] .converted-ref {
    background: var(--gray-100);
}
