/* Convertra App - Dark Theme matching landing page */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg: #0a0a0c;
    --surface: #111116;
    --surface-hover: #16161c;
    --border: #1e1e26;
    --border-light: #2a2a35;
    --text: #e8e6e3;
    --text-dim: #8a8690;
    --text-muted: #5a5660;
    --accent: #f0a050;
    --accent-dim: rgba(240, 160, 80, 0.15);
    --accent-glow: rgba(240, 160, 80, 0.2);
    --warm: #e8c4a0;
    --green: #4ade80;
    --green-dim: rgba(74, 222, 128, 0.15);
    --red: #f87171;
    --red-dim: rgba(248, 113, 113, 0.15);
    --yellow: #fbbf24;
    --yellow-dim: rgba(251, 191, 36, 0.15);
    --blue: #60a5fa;
    --blue-dim: rgba(96, 165, 250, 0.15);
}

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

h1, h2, h3, h4 { font-family: 'Space Grotesk', sans-serif; }

/* App Layout */
.app-nav {
    padding: 20px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    position: sticky;
    top: 0;
    z-index: 100;
}

.app-nav .logo {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: -0.5px;
    color: var(--text);
    text-decoration: none;
}
.app-nav .logo span { color: var(--accent); }

.nav-links {
    display: flex;
    gap: 4px;
}

.nav-link {
    font-size: 0.85rem;
    color: var(--text-dim);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.15s;
    cursor: pointer;
}
.nav-link:hover { color: var(--text); background: var(--surface-hover); }
.nav-link.active { color: var(--accent); background: var(--accent-dim); }

.nav-user {
    display: flex;
    align-items: center;
    gap: 12px;
}
.nav-email {
    font-size: 0.8rem;
    color: var(--text-dim);
}
.nav-logout {
    font-size: 0.8rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: none;
    transition: all 0.15s;
}
.nav-logout:hover { color: var(--red); border-color: var(--red); }

/* Page Container */
.page {
    max-width: 960px;
    margin: 0 auto;
    padding: 40px 32px;
}

/* Login Page */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 32px;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 40px;
}

.login-card .logo {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 1.5rem;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
}
.login-card .logo span { color: var(--accent); }

.login-subtitle {
    font-size: 0.9rem;
    color: var(--text-dim);
    margin-bottom: 32px;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.15s;
}
.form-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}
.form-input::placeholder { color: var(--text-muted); }

.form-select {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-family: 'DM Sans', sans-serif;
    font-size: 0.95rem;
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238a8690' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    cursor: pointer;
}
.form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.form-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 6px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 12px 24px;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
}

.btn-primary {
    background: var(--accent);
    color: var(--bg);
    box-shadow: 0 0 20px var(--accent-glow);
}
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 30px rgba(240, 160, 80, 0.3);
}
.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-secondary:hover {
    background: var(--surface-hover);
    border-color: var(--border-light);
}

.btn-outline {
    background: transparent;
    color: var(--accent);
    border: 1px solid rgba(240, 160, 80, 0.3);
}
.btn-outline:hover {
    background: var(--accent-dim);
    border-color: var(--accent);
}

.btn-full { width: 100%; }
.btn-sm { padding: 8px 16px; font-size: 0.8rem; }

/* Cards */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    transition: border-color 0.15s;
}
.card:hover { border-color: var(--border-light); }

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: -0.3px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px;
    text-align: center;
}

.stat-value {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent);
    line-height: 1;
    margin-bottom: 6px;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-dim);
}

/* Section Headers */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-title {
    font-size: 1.2rem;
    font-weight: 600;
    letter-spacing: -0.3px;
}

/* Store Cards */
.store-list {
    display: grid;
    gap: 12px;
    margin-bottom: 32px;
}

.store-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: border-color 0.15s;
}
.store-card:hover { border-color: var(--border-light); }

.store-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.store-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: var(--accent-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.store-name {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 2px;
}

.store-url {
    font-size: 0.8rem;
    color: var(--text-dim);
}

.store-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.store-score {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    padding: 4px 12px;
    border-radius: 8px;
}

/* Audit Cards */
.audit-list {
    display: grid;
    gap: 12px;
}

.audit-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.15s;
}
.audit-card:hover {
    border-color: var(--border-light);
    background: var(--surface-hover);
}

.audit-info { flex: 1; }
.audit-store-name { font-weight: 600; font-size: 0.95rem; }
.audit-date { font-size: 0.8rem; color: var(--text-dim); margin-top: 2px; }

.audit-status {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 100px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.audit-status.completed { background: var(--green-dim); color: var(--green); }
.audit-status.running { background: var(--yellow-dim); color: var(--yellow); }
.audit-status.pending { background: var(--blue-dim); color: var(--blue); }
.audit-status.failed { background: var(--red-dim); color: var(--red); }

/* Score Circle */
.score-circle {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    position: relative;
}
.score-circle::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 4px solid var(--border);
}
.score-circle::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 4px solid transparent;
    border-top-color: var(--accent);
    border-right-color: var(--accent);
}
.score-number {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 2.8rem;
    font-weight: 700;
    line-height: 1;
}
.score-label {
    font-size: 0.75rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 4px;
}

/* Audit Results */
.audit-summary {
    font-size: 1rem;
    color: var(--text-dim);
    line-height: 1.7;
    margin-bottom: 32px;
    text-align: center;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.category-section {
    margin-bottom: 32px;
}

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}

.category-name {
    font-size: 1rem;
    font-weight: 600;
}

.category-score {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 1rem;
    padding: 4px 12px;
    border-radius: 8px;
}

.finding-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 10px;
}

.finding-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
    gap: 12px;
}

.finding-title {
    font-size: 0.9rem;
    font-weight: 600;
}

.finding-impact {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 100px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}
.finding-impact.critical { background: var(--red-dim); color: var(--red); }
.finding-impact.high { background: var(--yellow-dim); color: var(--yellow); }
.finding-impact.medium { background: var(--blue-dim); color: var(--blue); }
.finding-impact.low { background: var(--green-dim); color: var(--green); }

.finding-desc {
    font-size: 0.85rem;
    color: var(--text-dim);
    margin-bottom: 12px;
    line-height: 1.5;
}

.finding-rec {
    font-size: 0.85rem;
    color: var(--warm);
    padding: 12px 16px;
    background: rgba(240, 160, 80, 0.05);
    border-left: 3px solid var(--accent);
    border-radius: 0 8px 8px 0;
    line-height: 1.5;
}

.finding-score {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    margin-top: 10px;
}

/* Score colors */
.score-good { color: var(--green); }
.score-ok { color: var(--yellow); }
.score-bad { color: var(--red); }
.bg-good { background: var(--green-dim); color: var(--green); }
.bg-ok { background: var(--yellow-dim); color: var(--yellow); }
.bg-bad { background: var(--red-dim); color: var(--red); }

/* Empty States */
.empty-state {
    text-align: center;
    padding: 60px 32px;
    color: var(--text-dim);
}
.empty-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}
.empty-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 8px;
}
.empty-desc {
    font-size: 0.9rem;
    max-width: 400px;
    margin: 0 auto 24px;
}

/* Connect Store Page */
.connect-page {
    max-width: 560px;
    margin: 0 auto;
}

.connect-title {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.5px;
    margin-bottom: 8px;
}
.connect-subtitle {
    color: var(--text-dim);
    margin-bottom: 32px;
    font-size: 0.95rem;
}

.platform-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 24px;
}

.platform-option {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.15s;
}
.platform-option:hover { border-color: var(--border-light); }
.platform-option.selected { border-color: var(--accent); background: var(--accent-dim); }

.platform-icon {
    font-size: 2rem;
    margin-bottom: 8px;
}
.platform-name {
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
}

/* Loading Spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    gap: 16px;
}
.loading-page .spinner {
    width: 32px;
    height: 32px;
    border-width: 3px;
}
.loading-text {
    font-size: 0.9rem;
    color: var(--text-dim);
}

/* Alert */
.alert {
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 0.85rem;
    margin-bottom: 20px;
}
.alert-error {
    background: var(--red-dim);
    color: var(--red);
    border: 1px solid rgba(248, 113, 113, 0.2);
}
.alert-success {
    background: var(--green-dim);
    color: var(--green);
    border: 1px solid rgba(74, 222, 128, 0.2);
}

/* Back link */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    color: var(--text-dim);
    text-decoration: none;
    margin-bottom: 24px;
    cursor: pointer;
}
.back-link:hover { color: var(--accent); }

/* Running Audit Animation */
.audit-running {
    text-align: center;
    padding: 60px 32px;
}
.audit-running-icon {
    font-size: 3rem;
    margin-bottom: 20px;
    animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.1); }
}
.audit-running-title {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 8px;
}
.audit-running-desc {
    font-size: 0.9rem;
    color: var(--text-dim);
}

/* Responsive */
@media (max-width: 640px) {
    .app-nav { padding: 16px 20px; }
    .nav-links { display: none; }
    .page { padding: 24px 20px; }
    .stats-grid { grid-template-columns: 1fr; }
    .platform-selector { grid-template-columns: 1fr; }
    .store-card { flex-direction: column; gap: 12px; align-items: flex-start; }
    .store-actions { width: 100%; justify-content: flex-end; }
    .audit-card { flex-direction: column; align-items: flex-start; gap: 8px; }
    .finding-header { flex-direction: column; }
}
