/* ============================================ */
/* COMPETITION TRACKER - NOTION STYLE */
/* ============================================ */

/* STEP CARDS - CLEAN WHITE */
.step-card {
    background: white;
    border-radius: 12px;
    padding: 40px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border: 1px solid #e9e9e7;
}

.step-header {
    display: flex;
    align-items: center;
    margin-bottom: 28px;
}

.step-number {
    background: #2383e2;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    margin-right: 16px;
    font-size: 1.2em;
    flex-shrink: 0;
}

.step-title {
    font-size: 1.5em;
    color: #37352f;
    font-weight: 700;
}

/* FORM ELEMENTS */
#step1 .form-group,
#step3 .form-group {
    margin-bottom: 24px;
}

#step1 label,
#step3 label {
    display: block;
    margin-bottom: 8px;
    color: #37352f;
    font-weight: 600;
    font-size: 0.95rem;
}

#step1 input,
#step3 textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #e0dfd7;
    border-radius: 6px;
    font-size: 1rem;
    background: white;
    color: #37352f;
    font-family: inherit;
    transition: all 0.15s ease;
    box-sizing: border-box;
}

#step1 input:focus,
#step3 textarea:focus {
    outline: none;
    border-color: #2383e2;
    box-shadow: 0 0 0 3px rgba(35, 131, 226, 0.1);
}

#step1 small,
#step3 small {
    display: block;
    margin-top: 6px;
    color: #787774;
    font-size: 0.875rem;
}

#step3 textarea {
    min-height: 200px;
    font-family: 'Courier New', monospace;
    line-height: 1.6;
}

/* COMPETITOR LIST */
.competitor-list {
    display: none;
    margin-top: 24px;
}

.competitor-list.active {
    display: block;
}

.competitor-list h3 {
    color: #37352f;
    font-weight: 700;
    margin-bottom: 16px;
    font-size: 1.1em;
}

.competitor-item {
    background: #fef9e7;
    padding: 16px 20px;
    margin-bottom: 12px;
    border-radius: 8px;
    border: 1px solid #f5edd4;
    color: #37352f;
}

.competitor-item strong {
    font-weight: 600;
}

/* MANUAL CHECK SECTION */
.manual-check-section {
    background: #f0f7ff;
    border-left: 3px solid #2383e2;
    padding: 24px;
    margin: 24px 0;
    border-radius: 8px;
}

.manual-check-section h3 {
    color: #37352f;
    margin-bottom: 12px;
    font-weight: 700;
    font-size: 1.1em;
}

.manual-check-section p {
    color: #787774;
    margin-bottom: 16px;
}

.external-link {
    display: inline-block;
    background: #2383e2;
    color: white;
    padding: 10px 20px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.15s ease;
}

.external-link:hover {
    background: #1a6ec7;
}

/* RESULTS SECTION */
.results-section {
    display: none;
    margin-top: 24px;
}

.results-section.active {
    display: block;
}

.result-card {
    background: #f0fdf4;
    border-left: 3px solid #16a34a;
    padding: 28px;
    border-radius: 8px;
    margin-bottom: 24px;
}

.result-card h3 {
    color: #37352f;
    margin-bottom: 16px;
    font-size: 1.4em;
    font-weight: 700;
}

/* ============================================ */
/* TABLE FIX - CONTAINED WITHIN VISIBLE BOX    */
/* ============================================ */
.strategy-table-container {
    background: white;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    /* KEY FIX: contain table within the card */
    overflow-x: auto;
    overflow-y: visible;
    max-width: 100%;
    border: 1px solid #e9e9e7;
    /* Smooth scrollbar */
    -webkit-overflow-scrolling: touch;
}

/* Scrollbar styling for table container */
.strategy-table-container::-webkit-scrollbar {
    height: 6px;
}
.strategy-table-container::-webkit-scrollbar-track {
    background: #f0f4ff;
    border-radius: 4px;
}
.strategy-table-container::-webkit-scrollbar-thumb {
    background: #2383e2;
    border-radius: 4px;
}

.ai-strategy-table {
    /* KEY FIX: table fills container, no min-width overflow */
    width: 100%;
    border-collapse: collapse;
    margin: 0;
    background: white;
    table-layout: fixed; /* KEY FIX: fixed layout respects column widths */
}

.ai-strategy-table th,
.ai-strategy-table td {
    border: 1px solid #e9e9e7;
    padding: 10px 12px;
    text-align: left;
    vertical-align: top;
    /* KEY FIX: force text to wrap, never overflow */
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    white-space: normal;
}

.ai-strategy-table th {
    background-color: #37352f;
    color: white;
    font-weight: 600;
    font-size: 0.85em;
    position: sticky;
    top: 0;
    z-index: 10;
    /* KEY FIX: allow headers to wrap too */
    white-space: normal;
    word-wrap: break-word;
}

/* KEY FIX: percentage-based column widths that add up to 100% */
.ai-strategy-table th:nth-child(1),
.ai-strategy-table td:nth-child(1) {
    width: 18%;
    font-weight: 600;
    font-size: 0.85em;
}

.ai-strategy-table th:nth-child(2),
.ai-strategy-table td:nth-child(2) {
    width: 20%;
}

.ai-strategy-table th:nth-child(3),
.ai-strategy-table td:nth-child(3) {
    width: 20%;
}

.ai-strategy-table th:nth-child(4),
.ai-strategy-table td:nth-child(4) {
    width: 20%;
}

/* KEY FIX: Contact Method column - same width, text wraps */
.ai-strategy-table th:nth-child(5),
.ai-strategy-table td:nth-child(5) {
    width: 22%;
    font-size: 0.82em;
    /* KEY FIX: break long emails at any character */
    word-break: break-all;
}

.ai-strategy-table tbody tr:nth-child(even) {
    background-color: #f9fafb;
}

.ai-strategy-table tbody tr:hover {
    background-color: #f0f4ff;
    transition: background-color 0.15s;
}

.ai-strategy-table td {
    font-size: 0.88em;
    line-height: 1.5;
    color: #37352f;
}

.tier-heading {
    margin-top: 32px;
    margin-bottom: 16px;
    font-size: 1.2em;
    font-weight: 700;
    padding: 12px 18px;
    background: #2383e2;
    color: white;
    border-radius: 6px;
}

.strategy-section-heading {
    color: #37352f;
    margin-top: 24px;
    margin-bottom: 12px;
    font-size: 1.1em;
    font-weight: 700;
    border-bottom: 1px solid #e9e9e7;
    padding-bottom: 8px;
}

.strategy-text {
    margin: 12px 0;
    line-height: 1.7;
    color: #37352f;
}

.backlink-count {
    text-align: center;
    font-size: 1.3em;
    color: #16a34a;
    margin: 20px 0;
    font-weight: 700;
}

/* INDUSTRY FALLBACK */
.industry-fallback {
    background: #fef9e7;
    padding: 24px;
    margin-top: 24px;
    border-radius: 8px;
    border-left: 3px solid #f59e0b;
    display: none;
}

.industry-fallback.active {
    display: block;
}

.industry-fallback h4 {
    color: #37352f;
    margin-bottom: 12px;
    font-weight: 700;
    font-size: 1.05em;
}

.industry-fallback p {
    color: #787774;
    margin-bottom: 16px;
}

.industry-fallback input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #e0dfd7;
    border-radius: 6px;
    margin-bottom: 12px;
    background: white;
    color: #37352f;
    box-sizing: border-box;
}

.industry-fallback input:focus {
    outline: none;
    border-color: #2383e2;
    box-shadow: 0 0 0 3px rgba(35, 131, 226, 0.1);
}

.btn-warning {
    background: #f59e0b;
    color: white;
    width: 100%;
    padding: 12px 20px;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
}

.btn-warning:hover {
    background: #d97706;
}

/* EXAMPLE BOX */
.example-box {
    background: #f7f6f3;
    padding: 16px;
    border-radius: 6px;
    margin-top: 12px;
    font-family: 'Courier New', monospace;
    font-size: 0.85em;
    border: 1px solid #e9e9e7;
    color: #37352f;
    white-space: pre-wrap;
    word-break: break-word;
}

.example-box strong {
    font-weight: 700;
    display: block;
    margin-bottom: 8px;
}

.email-template {
    background: #f0f7ff;
    padding: 18px;
    border-radius: 6px;
    border-left: 3px solid #2383e2;
    margin: 20px 0;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    line-height: 1.6;
    word-break: break-word;
}

.quick-wins-heading {
    background: #fef9e7;
    padding: 14px;
    border-radius: 6px;
    border-left: 3px solid #f59e0b;
    margin: 20px 0;
    font-size: 1.05em;
    color: #37352f;
}

/* RESPONSIVE */
@media (max-width: 768px) {
    .step-card {
        padding: 20px;
    }
    
    .step-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .step-number {
        margin-bottom: 12px;
    }
    
    .step-title {
        font-size: 1.3em;
    }
    
    .ai-strategy-table th,
    .ai-strategy-table td {
        padding: 8px 6px;
        font-size: 0.8em;
    }

    .ai-strategy-table th:nth-child(5),
    .ai-strategy-table td:nth-child(5) {
        font-size: 0.75em;
    }
}

@media (max-width: 480px) {
    .step-card {
        padding: 16px;
    }
    
    .manual-check-section,
    .industry-fallback {
        padding: 16px;
    }
    
    .result-card {
        padding: 16px;
    }
    
    #step3 textarea {
        min-height: 150px;
    }

    .ai-strategy-table {
        font-size: 0.78em;
    }
}