/**
 * RxDxNow - Optimized Main Stylesheet
 * Version: 2.0.0
 */

/* ===== BASE RESET ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #fff;
}

/* ===== NAVIGATION ===== */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid #e5e7eb;
    z-index: 1000;
    padding: 1rem 0;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo a {
    font-size: 1.8rem;
    font-weight: 700;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-decoration: none;
}

.nav-links {
    display: flex;
    list-style: none;
    gap: 2rem;
    align-items: center;
}

.nav-links a {
    color: #333;
    text-decoration: none;
    font-weight: 500;
    position: relative;
    transition: color 0.3s;
}

.nav-links a:hover,
.nav-links a.active {
    color: #2563eb;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    transition: width 0.3s;
}

.nav-links a:hover::after,
.nav-links a.active::after {
    width: 100%;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.welcome-text {
    font-size: 0.9rem;
    color: #64748b;
}

.btn-logout {
    background: transparent;
    color: #64748b !important;
    padding: 0.5rem 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.btn-logout:hover {
    background: #f1f5f9;
    color: #334155 !important;
}

/* ===== BUTTONS ===== */
.btn-primary {
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: white !important;
    padding: 1rem 2rem;
    border: none;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s;
    cursor: pointer;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.3);
}

.btn-secondary {
    background: white;
    color: #2563eb !important;
    padding: 1rem 2rem;
    border: 2px solid #2563eb;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s;
    cursor: pointer;
}

.btn-secondary:hover {
    background: #2563eb;
    color: white !important;
}

.login-button,
.cta-button {
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: white !important;
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 25px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.login-button:hover,
.cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(37, 99, 235, 0.3);
}

/* ===== HERO SECTION ===== */
.hero {
    min-height: 100vh;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-align: center;
    padding: 6rem 2rem;
}

.hero-content {
    max-width: 1200px;
}

.hero-title {
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    font-weight: 700;
    margin-bottom: 1.5rem;
}

.hero-subtitle {
    font-size: clamp(1.1rem, 2.5vw, 1.4rem);
    margin-bottom: 2rem;
    opacity: 0.9;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 3rem;
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
}

.stat-item {
    padding: 2rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: 700;
}

.stat-label {
    font-size: 1rem;
    opacity: 0.8;
}

/* ===== SECTIONS ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 1rem;
    color: #1a202c;
}

.section-subtitle {
    font-size: 1.2rem;
    text-align: center;
    color: #64748b;
    margin-bottom: 4rem;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

.service-overview {
    padding: 6rem 0;
    background: #f8fafc;
}

.service-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 3rem;
}

.service-card {
    background: white;
    padding: 3rem;
    border-radius: 15px;
    border: 1px solid #e2e8f0;
    transition: all 0.3s;
}

.service-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.service-icon {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: white;
    margin-bottom: 1.5rem;
}

.service-title {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #1a202c;
}

.service-description {
    color: #64748b;
    line-height: 1.7;
    margin-bottom: 1.5rem;
}

/* ===== DASHBOARD ===== */
.rxdx-dashboard {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 2rem;
}

.dashboard-hero {
    text-align: center;
    padding: 3rem 2rem;
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    border-radius: 20px;
    color: white;
    margin-bottom: 3rem;
}

.dashboard-hero h1 {
    font-size: 2.5rem;
    color: white;
    margin-bottom: 0.5rem;
}

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin: 3rem 0;
}

.stat-box {
    text-align: center;
    padding: 2rem;
    background: #f8fafc;
    border-radius: 15px;
    border: 1px solid #e2e8f0;
    transition: all 0.3s;
}

.stat-box:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.stat-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.stat-box h3 {
    font-size: 2rem;
    color: #2563eb;
    margin-bottom: 0.5rem;
}

.dashboard-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin: 3rem 0;
}

.reports-section {
    margin-top: 4rem;
    padding: 3rem;
    background: white;
    border-radius: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
}

.reports-section h2 {
    font-size: 2rem;
    color: #1a202c;
    margin-bottom: 2rem;
    text-align: center;
}

.reports-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.report-card {
    background: #f8fafc;
    border-radius: 15px;
    padding: 1.5rem;
    border: 1px solid #e2e8f0;
    transition: all 0.3s;
}

.report-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    border-color: #2563eb;
}

.report-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.report-name {
    font-size: 1rem;
    font-weight: 600;
    color: #1a202c;
    margin-bottom: 1rem;
    word-break: break-word;
}

.report-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: #64748b;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e2e8f0;
}

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

.btn-view,
.btn-download {
    flex: 1;
    padding: 0.6rem;
    border-radius: 8px;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s;
}

.btn-view {
    background: linear-gradient(135deg, #2563eb, #7c3aed);
    color: white !important;
}

.btn-view:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-download {
    background: white;
    color: #2563eb !important;
    border: 1px solid #2563eb;
}

.btn-download:hover {
    background: #2563eb;
    color: white !important;
}

/* ===== PROCESSING SECTION ===== */
.processing-section {
    margin-top: 3rem;
    margin-bottom: 3rem;
    padding: 3rem;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-radius: 20px;
    box-shadow: 0 4px 20px rgba(251, 191, 36, 0.2);
}

.processing-section h2 {
    font-size: 2rem;
    color: #92400e;
    margin-bottom: 2rem;
    text-align: center;
}

.processing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.processing-card {
    background: white;
    border-radius: 15px;
    padding: 1.5rem;
    border: 2px solid #fbbf24;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.processing-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 30px rgba(251, 191, 36, 0.3);
    border-color: #f59e0b;
}

.processing-card.latest-job {
    border: 3px solid #f59e0b;
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    box-shadow: 0 8px 25px rgba(245, 158, 11, 0.3);
    animation: pulse-border 2s infinite;
}

@keyframes pulse-border {
    0%, 100% {
        box-shadow: 0 8px 25px rgba(245, 158, 11, 0.3);
    }
    50% {
        box-shadow: 0 8px 35px rgba(245, 158, 11, 0.5);
    }
}

.processing-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.processing-icon {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #fbbf24;
    border-top-color: #f59e0b;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.badge-latest {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
    animation: badge-glow 2s infinite;
}

@keyframes badge-glow {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(245, 158, 11, 0.4);
    }
    50% {
        box-shadow: 0 4px 16px rgba(245, 158, 11, 0.6);
    }
}

.processing-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1a202c;
    margin-bottom: 1rem;
    line-height: 1.4;
}

.processing-meta {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e2e8f0;
}

.processing-type {
    display: inline-block;
    background: #dbeafe;
    color: #1e40af;
    padding: 0.3rem 0.8rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    width: fit-content;
}

.processing-link a,
.processing-file {
    font-size: 0.85rem;
    color: #64748b;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.processing-link a:hover {
    color: #2563eb;
    text-decoration: underline;
}

.processing-status {
    margin-bottom: 1rem;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
}

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

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #f59e0b;
    animation: pulse-dot 1.5s infinite;
}

@keyframes pulse-dot {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(1.2);
    }
}

.processing-time {
    font-size: 0.8rem;
    color: #64748b;
    margin-bottom: 0.5rem;
}

.processing-description {
    font-size: 0.85rem;
    color: #475569;
    margin-top: 0.5rem;
    line-height: 1.5;
}

/* Latest report highlight */
.report-card.latest-report {
    border: 2px solid #10b981;
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    position: relative;
}

.report-card.latest-report .badge-latest {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: linear-gradient(135deg, #10b981, #059669);
    animation: badge-glow-green 2s infinite;
}

@keyframes badge-glow-green {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
    }
    50% {
        box-shadow: 0 4px 16px rgba(16, 185, 129, 0.6);
    }
}

/* ===== UPLOAD FORM ===== */
.rxdx-upload-form label {
    display: block;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 0.5rem;
}

.rxdx-upload-form input[type="text"],
.rxdx-upload-form input[type="url"],
.rxdx-upload-form select,
.rxdx-upload-form textarea {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    font-family: inherit;
}

.rxdx-upload-form input:focus,
.rxdx-upload-form select:focus,
.rxdx-upload-form textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.rxdx-upload-form small {
    color: #64748b;
    font-size: 0.9rem;
    display: block;
    margin-top: 0.5rem;
}

/* ===== FOOTER ===== */
.footer {
    background: #1a202c;
    color: white;
    padding: 3rem 0 1rem;
    text-align: center;
}

.footer-bottom {
    padding-top: 2rem;
    border-top: 1px solid #334155;
    color: #94a3b8;
    font-size: 0.9rem;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .nav-links {
        display: none;
    }
    
    .service-grid {
        grid-template-columns: 1fr;
    }
    
    .dashboard-stats,
    .stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .dashboard-stats,
    .stats {
        grid-template-columns: 1fr;
    }
}

/* ===== RXDX REPORT CARD COMPONENT ===== */
.rxdx-report-card {
    background: white;
    border: 2px solid #10b981;
    border-radius: 16px;
    padding: 24px;
    position: relative;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.rxdx-report-card:hover {
    box-shadow: 0 8px 16px rgba(16, 185, 129, 0.15);
    transform: translateY(-2px);
}

/* Check Icon */
.card-check-icon {
    margin-bottom: 16px;
}

.card-check-icon svg {
    width: 48px;
    height: 48px;
}

/* Score Title */
.card-score-title {
    font-size: 18px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 16px;
}

/* Document Type Badge */
.card-doc-type {
    display: inline-block;
    background: #dbeafe;
    color: #1e40af;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 12px;
}

/* Source Link */
.card-source-link {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #64748b;
    font-size: 14px;
    margin-bottom: 12px;
}

.card-source-link svg {
    flex-shrink: 0;
}

.card-source-link a {
    color: #64748b;
    text-decoration: none;
    transition: color 0.2s;
}

.card-source-link a:hover {
    color: #2563eb;
}

/* Document Intent Badge */
.card-intent-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.card-intent-badge:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

/* Completed Status */
.card-status-completed {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #d1fae5;
    color: #065f46;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 16px;
}

.card-status-completed .status-dot {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
}

/* Meta Info */
.card-meta-info {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #64748b;
    font-size: 13px;
    margin-bottom: 8px;
}

.card-meta-info svg {
    flex-shrink: 0;
}

/* Action Buttons */
.card-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}

.card-btn-primary {
    flex: 1;
    background: #2563eb;
    color: white;
    text-align: center;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}

.card-btn-primary:hover {
    background: #1d4ed8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.card-btn-secondary {
    flex: 1;
    background: white;
    color: #2563eb;
    text-align: center;
    padding: 12px 20px;
    border-radius: 8px;
    border: 2px solid #2563eb;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}

.card-btn-secondary:hover {
    background: #eff6ff;
    transform: translateY(-2px);
}

/* Reports Grid */
.reports-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    margin-top: 24px;
}

@media (max-width: 768px) {
    .reports-grid {
        grid-template-columns: 1fr;
    }
    
    .card-actions {
        flex-direction: column;
    }
    
    .card-btn-primary,
    .card-btn-secondary {
        width: 100%;
    }
}