/* UXCam Design Language System Tokens */
:root {
    --uxcam-sky: #5d97ff;
    --uxcam-sky-hover: #4a87ff;
    --uxcam-sky-light: #7dacff;
    --uxcam-sky-lighter: #dfeaff;
    --uxcam-sky-lightest: #eff5ff;
    --uxcam-midnight: #161e35;
    --surface-bg: #f7faff;
    --text-primary: #161e35;
    --text-body: #454b5d;
    --text-secondary: #737886;
    --text-disabled: #d0d2d7;
    --border-default: #e8e8eb;
    --border-strong: #d0d2d7;
    --success: #32bf8a;
    --shadow-card: 0 4px 10px rgba(190, 190, 190, 0.16);
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 16px;
    --font-primary: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-display: 'Poppins', sans-serif;
}

/* Landing page and error page styles */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font-primary);
    background: var(--surface-bg);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}

.landing-container {
    max-width: 1100px;
    width: 100%;
}

.landing-split {
    display: flex;
    align-items: center;
    gap: 56px;
}

.landing-card {
    flex: 0 0 420px;
    background: #fff;
    border-radius: var(--radius-xl);
    padding: 40px 32px;
    box-shadow: var(--shadow-card);
}

.landing-badge {
    display: inline-block;
    background: var(--uxcam-sky-lightest);
    color: var(--uxcam-sky);
    font-size: 12px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.landing-card h1 {
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.landing-subtitle {
    font-size: 15px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.5;
}

.landing-social-proof {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-body);
    margin-bottom: 28px;
}

.trust-line {
    text-align: center;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 10px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-body);
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-default);
    border-radius: var(--radius-lg);
    font-size: 15px;
    transition: border-color 0.2s;
    outline: none;
}

.form-group input:focus {
    border-color: var(--uxcam-sky);
}

.form-group input::placeholder {
    color: var(--text-disabled);
}

.submit-btn {
    width: 100%;
    padding: 14px 24px;
    background: var(--uxcam-sky);
    color: #fff;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 8px;
}

.submit-btn:hover {
    background: var(--uxcam-sky-hover);
}

.submit-btn:disabled {
    cursor: not-allowed;
}

.btn-loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.what-you-get {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--border-default);
}

.what-you-get h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-body);
    margin-bottom: 12px;
}

.what-you-get ul {
    list-style: none;
    padding: 0;
}

.what-you-get li {
    font-size: 14px;
    color: var(--text-secondary);
    padding: 4px 0 4px 20px;
    position: relative;
}

.what-you-get li::before {
    content: '\2713';
    position: absolute;
    left: 0;
    color: var(--success);
    font-weight: 700;
}

.landing-footer {
    text-align: center;
    padding: 20px;
    font-size: 12px;
    color: var(--text-secondary);
}

.landing-footer a {
    color: var(--uxcam-sky);
    text-decoration: none;
}

/* Error page */
.error-icon {
    width: 48px;
    height: 48px;
    background: #fce4ec;
    color: #c62828;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 16px;
}

.error-message {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.5;
}

@media (max-width: 900px) {
    .landing-split {
        flex-direction: column;
        gap: 32px;
    }
    .landing-card {
        flex: none;
        width: 100%;
        max-width: 480px;
    }
    .report-preview {
        max-width: 480px;
        width: 100%;
        max-height: 400px;
    }
}

@media (max-width: 500px) {
    .landing-card {
        padding: 28px 20px;
    }
    .landing-card h1 {
        font-size: 22px;
    }
    .report-preview {
        display: none;
    }
}

/* ============================================
   Report Preview (Landing Page)
   ============================================ */

.report-preview {
    flex: 1;
    min-width: 0;
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-xl);
    background: #fff;
    box-shadow: var(--shadow-card);
    max-height: 560px;
}

.preview-content {
    padding: 24px 20px;
}

/* Blurred sections */
.preview-blurred {
    filter: blur(4px);
    user-select: none;
    pointer-events: none;
    opacity: 0.7;
}

/* Sharp section — no blur */
.preview-sharp {
    position: relative;
    z-index: 1;
}

/* Bottom fade overlay */
.preview-fade {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 140px;
    background: linear-gradient(to bottom, rgba(255,255,255,0), #fff);
    pointer-events: none;
    z-index: 2;
}

/* Preview header bar */
.preview-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-default);
}

.preview-app-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, #1db954 0%, #1ed760 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.preview-app-icon svg {
    width: 22px;
    height: 22px;
}

.preview-header-text h3 {
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1px;
}

.preview-header-text span {
    font-size: 11px;
    color: var(--text-secondary);
}

/* Score section */
.preview-score-row {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-bottom: 16px;
}

.preview-score-circle {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    border: 5px solid var(--uxcam-sky);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.preview-score-circle span {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 800;
    color: var(--uxcam-sky);
}

.preview-score-info {
    flex: 1;
}

.preview-score-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.preview-score-summary {
    font-size: 12px;
    color: var(--text-body);
    line-height: 1.5;
}

/* Sentiment bar */
.preview-sentiment-bar {
    display: flex;
    height: 24px;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 6px;
}

.preview-sentiment-bar .seg-positive { background: var(--success); }
.preview-sentiment-bar .seg-neutral { background: #ffc107; }
.preview-sentiment-bar .seg-negative { background: #ef5350; }

.preview-sentiment-labels {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.preview-sentiment-labels span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.preview-sentiment-labels .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

.dot-pos { background: var(--success); }
.dot-neu { background: #ffc107; }
.dot-neg { background: #ef5350; }

/* Section labels */
.preview-section-label {
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
}

/* Issue cards mockup */
.preview-issue-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    margin-bottom: 8px;
}

.preview-severity {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 4px;
    letter-spacing: 0.3px;
    flex-shrink: 0;
    margin-top: 2px;
}

.preview-severity.critical { background: #fce4ec; color: #c62828; }
.preview-severity.high { background: #fff3e0; color: #e65100; }
.preview-severity.medium { background: #fff8e1; color: #f9a825; }

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

.preview-issue-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.preview-issue-meta {
    font-size: 10px;
    color: var(--text-secondary);
}

/* Priority matrix mockup */
.preview-matrix {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin-top: 10px;
}

.preview-matrix-cell {
    padding: 10px 8px;
    border-radius: var(--radius-md);
    font-size: 9px;
    color: var(--text-secondary);
    text-align: center;
}

.preview-matrix-cell.qw { background: #e8f5e9; }
.preview-matrix-cell.mp { background: #e3f2fd; }
.preview-matrix-cell.fi { background: #f3e5f5; }
.preview-matrix-cell.av { background: #fafafa; }

.preview-matrix-item {
    display: block;
    font-size: 10px;
    font-weight: 500;
    color: var(--text-body);
    margin-top: 4px;
}

/* ============================================
   Autocomplete
   ============================================ */

.autocomplete-wrapper {
    position: relative;
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-disabled);
    pointer-events: none;
    z-index: 1;
}

.autocomplete-wrapper input {
    padding-left: 38px;
}

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: #fff;
    border: 1px solid var(--border-default);
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.12);
    list-style: none;
    padding: 6px;
    z-index: 100;
    max-height: 320px;
    overflow-y: auto;
}

.autocomplete-dropdown li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: background 0.15s;
}

.autocomplete-dropdown li:hover,
.autocomplete-dropdown li.active {
    background: var(--uxcam-sky-lightest);
}

.autocomplete-dropdown li img {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-lg);
    flex-shrink: 0;
}

.autocomplete-dropdown .app-suggestion-info {
    flex: 1;
    min-width: 0;
}

.autocomplete-dropdown .app-suggestion-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.autocomplete-dropdown .app-suggestion-developer {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.autocomplete-dropdown .no-results {
    padding: 16px 12px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
    cursor: default;
}

.autocomplete-dropdown .no-results:hover {
    background: transparent;
}

.autocomplete-spinner {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-default);
    border-top-color: var(--uxcam-sky);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.selected-app {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--uxcam-sky-lightest);
    border: 2px solid var(--uxcam-sky);
    border-radius: var(--radius-lg);
}

.selected-app-icon {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-md);
}

.selected-app-name {
    flex: 1;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.selected-app-clear {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.15s;
}

.selected-app-clear:hover {
    color: var(--text-body);
}

/* ============================================
   Loading Overlay
   ============================================ */

#loadingOverlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: linear-gradient(135deg, var(--uxcam-midnight) 0%, #0d1526 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.loading-container {
    text-align: center;
    padding: 40px 32px;
    max-width: 440px;
    width: 100%;
}

.loading-app-icon {
    width: 64px;
    height: 64px;
    border-radius: 14px;
    margin-bottom: 16px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
}

.loading-app-name {
    color: #fff;
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
}

.loading-subtitle {
    color: rgba(255,255,255,0.5);
    font-size: 14px;
    margin-bottom: 32px;
}

.loading-progress-track {
    width: 100%;
    height: 4px;
    background: rgba(255,255,255,0.1);
    border-radius: 2px;
    margin-bottom: 32px;
    overflow: hidden;
}

.loading-progress-bar {
    height: 100%;
    width: 0%;
    background: var(--uxcam-sky);
    border-radius: 2px;
    transition: width 0.5s ease;
}

.loading-steps {
    text-align: left;
}

.loading-step {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 0;
    opacity: 0.3;
    transform: translateY(8px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.loading-step.active,
.loading-step.completed {
    opacity: 1;
    transform: translateY(0);
}

.loading-step.completed .step-text {
    color: rgba(255,255,255,0.5);
}

.step-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.step-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.2);
    border-top-color: var(--uxcam-sky);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: block;
}

.step-text {
    font-size: 15px;
    color: #fff;
    font-weight: 500;
}

.loading-footer {
    margin-top: 32px;
    font-size: 12px;
    color: rgba(255,255,255,0.3);
}

/* Loading error state */
.loading-error {
    text-align: center;
}

.loading-error-icon {
    width: 48px;
    height: 48px;
    background: rgba(239, 83, 80, 0.2);
    color: #ef5350;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 16px;
}

.loading-error h2 {
    color: #fff;
    font-size: 20px;
    margin-bottom: 8px;
}

.loading-error p {
    color: rgba(255,255,255,0.6);
    font-size: 15px;
    margin-bottom: 24px;
    line-height: 1.5;
}

.loading-error-btn {
    display: inline-block;
    background: var(--uxcam-sky);
    color: #fff;
    text-decoration: none;
    padding: 12px 28px;
    border-radius: var(--radius-lg);
    font-weight: 600;
    font-size: 15px;
    transition: background 0.2s;
}

.loading-error-btn:hover {
    background: var(--uxcam-sky-hover);
}
