* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #f5f7fa;
    color: #333;
    line-height: 1.6;
}

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

header {
    text-align: center;
    margin-bottom: 2.5rem;
}

header h1 {
    font-size: 2.5rem;
    color: #1a1a2e;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: #666;
    font-size: 1.1rem;
}

.cache-status {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.75rem;
    padding: 0.5rem 1rem;
    background: #f0f4ff;
    border-radius: 8px;
    font-size: 0.85rem;
    color: #444;
}

.btn-cache-clear {
    background: #f72585;
    color: white;
    border: none;
    padding: 0.35rem 0.75rem;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-cache-clear:hover {
    background: #d61f74;
}

.analysis-form {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
    display: flex;
    gap: 1.5rem;
    align-items: flex-end;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}

.form-group {
    flex: 1;
    min-width: 250px;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #444;
}

.form-group input {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 2px solid #e1e5eb;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: #4361ee;
    box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.15);
}

.btn-primary {
    background: #4361ee;
    color: white;
    border: none;
    padding: 0.875rem 2rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    white-space: nowrap;
}

.btn-primary:hover {
    background: #3a56d4;
}

.btn-primary:active {
    transform: scale(0.98);
}

.loading {
    text-align: center;
    padding: 3rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e1e5eb;
    border-top-color: #4361ee;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

.loading p {
    color: #666;
    font-size: 1rem;
}

.results {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.card {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
}

.card h3 {
    font-size: 1rem;
    color: #666;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.domain-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1a1a2e;
    margin-bottom: 1rem;
    word-break: break-all;
}

.metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.metric {
    text-align: center;
}

.metric-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: #4361ee;
}

.metric-label {
    font-size: 0.8rem;
    color: #888;
    text-transform: uppercase;
}

.card.highlight {
    background: linear-gradient(135deg, #4361ee 0%, #3a0ca3 100%);
    color: white;
}

.card.highlight h3 {
    color: rgba(255, 255, 255, 0.8);
}

.gap-number {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 0.25rem;
}

.gap-description {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.95rem;
}

.comparison-bar {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
    margin-bottom: 2rem;
}

.bar-label {
    font-weight: 600;
    margin-bottom: 1rem;
    color: #444;
}

.bar-container {
    display: flex;
    height: 40px;
    border-radius: 8px;
    overflow: hidden;
    background: #e1e5eb;
}

.bar-segment {
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.85rem;
    transition: width 0.5s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 0.5rem;
}

.bar-segment.your-site {
    background: #4361ee;
}

.bar-segment.competitor {
    background: #f72585;
}

.report-actions {
    text-align: center;
    margin-bottom: 2rem;
}

.btn-report {
    display: inline-block;
    background: linear-gradient(135deg, #4361ee 0%, #3a0ca3 100%);
    color: white;
    text-decoration: none;
    padding: 0.875rem 2rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-report:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(67, 97, 238, 0.3);
}

.section {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
    margin-bottom: 2rem;
}

.section h2 {
    font-size: 1.5rem;
    color: #1a1a2e;
    margin-bottom: 0.5rem;
}

.section-desc {
    color: #666;
    margin-bottom: 1.5rem;
}

.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #e1e5eb;
}

th {
    background: #f8f9fa;
    font-weight: 600;
    color: #444;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

tr:hover {
    background: #f8f9fa;
}

.link-btn {
    display: inline-block;
    padding: 0.4rem 0.8rem;
    background: #4361ee;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.85rem;
    transition: background 0.2s;
}

.link-btn:hover {
    background: #3a56d4;
}

.error {
    background: #fee2e2;
    color: #dc2626;
    padding: 1.5rem;
    border-radius: 12px;
    border-left: 4px solid #dc2626;
}

.no-data {
    text-align: center;
    padding: 2rem;
    color: #888;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.table-info {
    color: #666;
    font-size: 0.9rem;
}

.per-page {
    padding: 0.5rem 0.75rem;
    border: 2px solid #e1e5eb;
    border-radius: 6px;
    font-size: 0.9rem;
    background: white;
    cursor: pointer;
}

.per-page:focus {
    outline: none;
    border-color: #4361ee;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.35rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
}

.page-btn {
    padding: 0.5rem 0.85rem;
    border: 2px solid #e1e5eb;
    border-radius: 6px;
    background: white;
    color: #444;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.15s;
    min-width: 40px;
    text-align: center;
}

.page-btn:hover:not(.disabled):not(.active) {
    border-color: #4361ee;
    color: #4361ee;
}

.page-btn.active {
    background: #4361ee;
    border-color: #4361ee;
    color: white;
}

.page-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.page-ellipsis {
    padding: 0.5rem 0.5rem;
    color: #888;
}

@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    header h1 {
        font-size: 1.75rem;
    }

    .analysis-form {
        flex-direction: column;
    }

    .form-group {
        min-width: 100%;
    }

    .btn-primary {
        width: 100%;
    }

    .metrics {
        grid-template-columns: 1fr;
    }

    .bar-segment {
        font-size: 0.7rem;
    }

    .table-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .page-btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
        min-width: 34px;
    }
}

.email-gate {
    margin-top: 1.5rem;
    padding: 2rem;
    border-radius: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    text-align: center;
}
.email-gate h3 {
    margin: 0 0 0.5rem;
    font-size: 1.4rem;
}
.email-gate p {
    margin: 0 0 1.25rem;
    opacity: 0.95;
}
.email-gate-form {
    display: flex;
    gap: 0.5rem;
    max-width: 480px;
    margin: 0 auto;
    flex-wrap: wrap;
    justify-content: center;
}
.email-gate-form input[type="email"] {
    flex: 1 1 240px;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
}
.email-gate-form .btn-primary {
    padding: 0.75rem 1.5rem;
    background: #fff;
    color: #5a4ba0;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
}
.email-gate-form .btn-primary:hover {
    background: #f3f0ff;
}
.email-gate-error {
    margin-top: 0.75rem;
    color: #ffd9d9;
    font-size: 0.9rem;
}

.email-gate-sub {
    margin-top: -0.5rem !important;
    opacity: 0.85;
    font-size: 0.95rem;
}
.email-gate-success {
    margin-top: 0.75rem;
    color: #d6ffe0;
    font-size: 0.95rem;
}

.results-toolbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    margin: 0 0 1.25rem;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
}
.btn-back {
    background: #f3f4f6;
    border: none;
    padding: 0.5rem 0.9rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    color: #374151;
    font-weight: 500;
}
.btn-back:hover { background: #e5e7eb; }
.results-domains {
    color: #6b7280;
    font-size: 0.95rem;
    font-weight: 500;
}
.results-domains .vs {
    color: #9ca3af;
    margin: 0 0.25rem;
}

.section-cta {
    margin: -0.5rem 0 1rem;
    color: #374151;
    font-size: 0.95rem;
    font-weight: 500;
}

.value-props {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin: 0 0 1.5rem;
}
.value-prop {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.25rem 1.25rem;
}
.value-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    margin-bottom: 0.75rem;
}
.value-prop h3 {
    margin: 0 0 0.4rem;
    font-size: 1rem;
    color: #1f2937;
}
.value-prop p {
    margin: 0;
    color: #6b7280;
    font-size: 0.9rem;
    line-height: 1.5;
}

.how-it-works {
    margin: 2rem 0 0;
    padding: 1.75rem 1.5rem;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
}
.how-it-works h2 {
    margin: 0 0 1.25rem;
    font-size: 1.25rem;
    color: #1f2937;
    text-align: center;
}
.steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
}
.step {
    text-align: left;
}
.step-num {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #5a4ba0;
    color: #fff;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.6rem;
    font-size: 0.95rem;
}
.step h3 {
    margin: 0 0 0.35rem;
    font-size: 0.98rem;
    color: #1f2937;
}
.step p {
    margin: 0;
    color: #6b7280;
    font-size: 0.9rem;
    line-height: 1.5;
}

@media (max-width: 700px) {
    .value-props, .steps { grid-template-columns: 1fr; }
}

.how-it-works-top {
    margin: 0 0 1.5rem;
}

.check-email {
    margin-top: 1.5rem;
    padding: 1.75rem 2rem;
    border-radius: 12px;
    background: linear-gradient(135deg, #e8f5e9 0%, #f0f9f1 100%);
    border: 1px solid #b9e2bd;
    text-align: center;
}
.check-email-icon {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    margin: 0 auto 0.75rem;
    background: #2f9e44;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}
.check-email h3 {
    margin: 0 0 0.75rem;
    color: #1b5e20;
    font-size: 1.4rem;
}
.check-email p {
    margin: 0.5rem auto;
    color: #2d3a2e;
    font-size: 0.98rem;
    max-width: 560px;
    line-height: 1.55;
}
.check-email-note {
    color: #4a5d4c !important;
    font-size: 0.92rem !important;
}
.check-email-note em {
    font-style: normal;
    color: #1b5e20;
    font-weight: 500;
}

.faq {
    margin-top: 2rem;
    padding: 1.75rem 2rem;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
}
.faq h2 {
    margin: 0 0 1.25rem;
    font-size: 1.3rem;
    color: #1f2937;
}
.faq details {
    border-bottom: 1px solid #e5e7eb;
    padding: 0.75rem 0;
}
.faq details:last-child {
    border-bottom: none;
}
.faq summary {
    cursor: pointer;
    font-weight: 600;
    color: #1f2937;
    font-size: 1rem;
    padding: 0.25rem 0;
    list-style: none;
    position: relative;
    padding-right: 1.5rem;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
    content: "+";
    position: absolute;
    right: 0.25rem;
    top: 0.1rem;
    color: #5a4ba0;
    font-size: 1.25rem;
    font-weight: 400;
    transition: transform 0.15s ease;
}
.faq details[open] summary::after {
    content: "−";
}
.faq details[open] summary {
    color: #5a4ba0;
}
.faq details p {
    margin: 0.6rem 0 0.25rem;
    color: #4b5563;
    line-height: 1.6;
    font-size: 0.95rem;
}
.faq details p a {
    color: #5a4ba0;
    font-weight: 600;
}

.report-style .num-cell, .report-style th.num-cell { text-align: right; }
.report-style .date-cell, .report-style th.date-cell { color: #6b7280; font-size: 0.9rem; }

.tier-badge {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.3px;
}
.tier-high { background: #dcfce7; color: #166534; }
.tier-mid  { background: #fef3c7; color: #92400e; }
.tier-low  { background: #fee2e2; color: #991b1b; }
.tier-min  { background: #f3f4f6; color: #6b7280; }

.more-opps {
    text-align: center;
    margin: 1rem 0 0;
    padding: 0.85rem;
    color: #5a4ba0;
    font-weight: 600;
    font-size: 0.95rem;
    background: #f5f3ff;
    border: 1px dashed #c4b5fd;
    border-radius: 8px;
}

.how-it-works-grid {
    margin: 0 0 1.5rem;
}
.how-it-works-heading {
    margin: 0 0 1rem;
    font-size: 1.25rem;
    color: #1f2937;
    text-align: center;
}
.how-it-works-grid .steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}
.step-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 1.5rem 1.25rem;
}
.step-card .step-num {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #5a4ba0;
    color: #fff;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
}
.step-card h3 {
    margin: 0 0 0.4rem;
    font-size: 1rem;
    color: #1f2937;
}
.step-card p {
    margin: 0;
    color: #6b7280;
    font-size: 0.92rem;
    line-height: 1.5;
}

@media (max-width: 700px) {
    .how-it-works-grid .steps { grid-template-columns: 1fr; }
}

.btn-primary {
    position: relative;
}
.btn-primary .btn-spinner {
    display: none;
    width: 1.1em;
    height: 1.1em;
    margin-left: 0.5rem;
    border: 2px solid rgba(255,255,255,0.35);
    border-top-color: #ffffff;
    border-radius: 50%;
    vertical-align: middle;
    animation: btn-spin 0.7s linear infinite;
}
.btn-primary.is-loading {
    cursor: progress;
    opacity: 0.85;
}
.btn-primary.is-loading .btn-spinner {
    display: inline-block;
}
.btn-primary:disabled {
    cursor: progress;
}
.email-gate-form .btn-primary.is-loading {
    color: #5a4ba0;
}
.email-gate-form .btn-primary .btn-spinner {
    border: 2px solid rgba(90, 75, 160, 0.25);
    border-top-color: #5a4ba0;
}
@keyframes btn-spin {
    to { transform: rotate(360deg); }
}

.results-toolbar .results-domains {
    margin-right: auto;
}
.btn-toolbar-cta {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    padding: 0.55rem 1.1rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.92rem;
    letter-spacing: 0.2px;
    box-shadow: 0 1px 2px rgba(90, 75, 160, 0.15);
}
.btn-toolbar-cta:hover {
    filter: brightness(1.05);
    box-shadow: 0 2px 6px rgba(90, 75, 160, 0.25);
}
