/* =============================================
   SEO Agency Scorecard - Wild Creek Web Studio
   Brand colours: primary #4a9c1f | dark #2d6e0f | accent #d4b800
   ============================================= */

/* ----- CSS Variables ----- */
.sas-wrap {
    --wc-primary: #4a9c1f;
    --wc-dark:    #2d6e0f;
    --wc-accent:  #d4b800;
    --wc-primary-light: rgba(74,156,31,0.1);

    font-family: Arial, sans-serif;
    max-width: 900px;
    margin: 0 auto;
    color: #1a202c;
    line-height: 1.5;
}

/* ----- Header ----- */
.sas-header {
    background: var(--wc-primary);
    border-radius: 10px;
    padding: 28px 32px;
    margin-bottom: 16px;
    color: #fff;
}

.sas-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin: 0 0 6px 0;
    color: #fff;
}

.sas-subtitle {
    font-size: 0.9rem;
    color: rgba(255,255,255,0.9);
    margin: 0 0 20px 0;
}

.sas-meta-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.sas-meta-field label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(255,255,255,0.85);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.sas-optional {
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    opacity: 0.7;
}

.sas-text-input {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid rgba(255,255,255,0.4);
    border-radius: 6px;
    background: rgba(255,255,255,0.2);
    color: #fff;
    font-size: 0.9rem;
    box-sizing: border-box;
}

.sas-text-input::placeholder { color: rgba(255,255,255,0.55); }
.sas-text-input:focus {
    outline: none;
    border-color: rgba(255,255,255,0.8);
    background: rgba(255,255,255,0.25);
}

/* ----- Legend ----- */
.sas-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px 16px;
    margin-bottom: 20px;
    font-size: 0.82rem;
}

.sas-legend-label {
    font-weight: 700;
    color: #374151;
    margin-right: 4px;
}

.sas-legend-item {
    padding: 3px 10px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.78rem;
}

.sas-score-1 { background: #fee2e2; color: #991b1b; }
.sas-score-2 { background: #fed7aa; color: #9a3412; }
.sas-score-3 { background: #fef9c3; color: #713f12; }
.sas-score-4 { background: #d1fae5; color: #065f46; }
.sas-score-5 { background: #dcfce7; color: #14532d; }
.sas-score-na { background: #f1f5f9; color: #64748b; }

/* ----- Category block ----- */
.sas-category {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    margin-bottom: 20px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}

.sas-cat-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 24px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.sas-cat-title-group {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.sas-cat-number {
    background: var(--wc-primary);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 700;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
}

.sas-cat-title {
    font-size: 1rem;
    font-weight: 700;
    color: #1a202c;
    margin: 0 0 3px 0;
}

.sas-cat-desc {
    font-size: 0.83rem;
    color: #64748b;
    margin: 0;
}

.sas-weight-group {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    font-size: 0.82rem;
    color: #64748b;
}

.sas-weight-group label {
    font-weight: 600;
    white-space: nowrap;
}

.sas-weight-input {
    width: 52px;
    padding: 5px 8px;
    border: 1px solid #d1d5db;
    border-radius: 5px;
    font-size: 0.9rem;
    text-align: center;
    color: #1a202c;
    -moz-appearance: textfield;
}

.sas-weight-input::-webkit-outer-spin-button,
.sas-weight-input::-webkit-inner-spin-button { -webkit-appearance: none; }

.sas-weight-note { color: #94a3b8; }

/* ----- Criteria ----- */
.sas-criteria {
    padding: 8px 0;
}

.sas-criterion {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 24px;
    border-bottom: 1px solid #f1f5f9;
}

.sas-criterion:last-child { border-bottom: none; }

.sas-criterion-info {
    flex: 1;
    min-width: 0;
}

.sas-criterion-label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: #1a202c;
    margin-bottom: 3px;
}

.sas-criterion-desc {
    display: block;
    font-size: 0.8rem;
    color: #64748b;
    line-height: 1.4;
}

/* ----- Score buttons ----- */
.sas-score-group {
    display: flex;
    gap: 5px;
    flex-shrink: 0;
}

.sas-score-option {
    cursor: pointer;
}

.sas-score-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.sas-score-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    border: 2px solid #e2e8f0;
    background: #f8fafc;
    color: #64748b;
    transition: all 0.12s;
    user-select: none;
}

.sas-score-btn:hover {
    border-color: #94a3b8;
    background: #f1f5f9;
}

/* Selected states */
.sas-score-option input:checked + .sas-score-btn-1 { background: #fee2e2; border-color: #ef4444; color: #991b1b; }
.sas-score-option input:checked + .sas-score-btn-2 { background: #fed7aa; border-color: #f97316; color: #9a3412; }
.sas-score-option input:checked + .sas-score-btn-3 { background: #fef9c3; border-color: #eab308; color: #713f12; }
.sas-score-option input:checked + .sas-score-btn-4 { background: #d1fae5; border-color: #10b981; color: #065f46; }
.sas-score-option input:checked + .sas-score-btn-5 { background: #dcfce7; border-color: #16a34a; color: #14532d; }
.sas-score-option input:checked + .sas-score-btn-na { background: #e2e8f0; border-color: #94a3b8; color: #374151; }

/* ----- Category total ----- */
.sas-cat-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    font-size: 0.88rem;
    font-weight: 700;
    color: #374151;
}

.sas-cat-score {
    font-size: 1rem;
    color: var(--wc-primary);
}

/* ----- Notes ----- */
.sas-notes-section {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 20px 24px;
    margin-bottom: 24px;
}

.sas-notes-section label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: #374151;
    margin-bottom: 8px;
}

.sas-notes-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.88rem;
    color: #1a202c;
    font-family: Arial, sans-serif;
    resize: vertical;
    box-sizing: border-box;
}

.sas-notes-input:focus {
    outline: none;
    border-color: var(--wc-primary);
    box-shadow: 0 0 0 3px var(--wc-primary-light);
}

/* ----- Results ----- */
.sas-results {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 28px 32px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.07);
}

.sas-results-header {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 24px;
}

.sas-results-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1a202c;
    margin: 0;
}

.sas-results-agency {
    font-size: 0.9rem;
    color: #64748b;
    font-style: italic;
}

.sas-score-display {
    margin-bottom: 24px;
}

.sas-overall-score-wrap {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 10px;
}

.sas-overall-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-right: 8px;
}

.sas-overall-score {
    font-size: 2.8rem;
    font-weight: 700;
    color: var(--wc-primary);
    line-height: 1;
}

.sas-overall-max {
    font-size: 1rem;
    color: #94a3b8;
}

.sas-score-bar-wrap {
    background: #f1f5f9;
    border-radius: 6px;
    height: 10px;
    overflow: hidden;
}

.sas-score-bar {
    height: 100%;
    border-radius: 6px;
    background: var(--wc-primary);
    transition: width 0.5s ease;
    width: 0%;
}

/* ----- Category breakdown ----- */
.sas-category-breakdown {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-bottom: 24px;
}

.sas-breakdown-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px 10px;
    text-align: center;
}

.sas-breakdown-name {
    display: block;
    font-size: 0.72rem;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 6px;
}

.sas-breakdown-score {
    display: block;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--wc-primary);
}

.sas-breakdown-weight {
    display: block;
    font-size: 0.72rem;
    color: #94a3b8;
    margin-top: 2px;
}

/* ----- Verdict ----- */
.sas-verdict {
    display: flex;
    gap: 16px;
    padding: 20px 22px;
    border-radius: 8px;
    margin-bottom: 20px;
    border: 1px solid #e2e8f0;
}

.sas-verdict-icon { font-size: 1.6rem; flex-shrink: 0; margin-top: 1px; }
.sas-verdict-title { font-size: 1rem; font-weight: 700; margin: 0 0 6px 0; }
.sas-verdict-body { font-size: 0.88rem; color: #4b5563; margin: 0; line-height: 1.6; }

.sas-verdict-shortlist { background: #ecfdf5; border-color: #6ee7b7; }
.sas-verdict-shortlist .sas-verdict-title { color: #065f46; }

.sas-verdict-consider { background: #fefce8; border-color: #fde047; }
.sas-verdict-consider .sas-verdict-title { color: #713f12; }

.sas-verdict-pass { background: #fff1f2; border-color: #fda4af; }
.sas-verdict-pass .sas-verdict-title { color: #9f1239; }

.sas-verdict-pending { background: #f8fafc; border-color: #e2e8f0; }
.sas-verdict-pending .sas-verdict-title { color: #374151; }

/* ----- Print button ----- */
.sas-print-btn {
    display: inline-block;
    padding: 10px 22px;
    background: var(--wc-primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    font-family: Arial, sans-serif;
    transition: background 0.15s;
}

.sas-print-btn:hover { background: var(--wc-dark); }

/* ----- Responsive ----- */
@media (max-width: 760px) {
    .sas-meta-inputs { grid-template-columns: 1fr; }

    .sas-criterion {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .sas-score-group { flex-wrap: wrap; }

    .sas-category-breakdown { grid-template-columns: repeat(3, 1fr); }

    .sas-cat-header { flex-direction: column; gap: 12px; }
}

@media (max-width: 480px) {
    .sas-header { padding: 20px 16px; }
    .sas-category-breakdown { grid-template-columns: repeat(2, 1fr); }
    .sas-score-btn { width: 30px; height: 30px; font-size: 0.75rem; }
}

/* =============================================
   PRINT STYLES
   ============================================= */
@media print {

    /* Hide WordPress chrome and page text - target named elements only */
    header, footer, nav,
    .site-header, .site-footer, .site-branding,
    .main-navigation, .nav-menu,
    .breadcrumb, .breadcrumbs, .breadcrumb-trail,
    .entry-header, .entry-title, .page-title,
    .wp-block-heading, .wp-block-list, .wp-block-paragraph,
    .entry-content > h1, .entry-content > h2,
    .entry-content > h3, .entry-content > p,
    .entry-content > ul, .entry-content > ol,
    #wpadminbar, .admin-bar,
    .back-to-top, .scroll-to-top,
    [class*="back-to-top"], [class*="scroll-top"],
    .sidebar, #sidebar, .widget-area,
    .comments-area, .post-navigation,
    .wp-block-buttons { display: none !important; }

    /* Ensure tool fills the page */
    .sas-wrap {
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Fix right-side cutoff - constrain score buttons */
    .sas-criterion {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
        padding: 10px 12px;
    }

    .sas-score-group { flex-wrap: wrap; gap: 3px; }

    .sas-score-btn {
        width: 28px;
        height: 28px;
        font-size: 0.72rem;
    }

    .sas-cat-header {
        flex-direction: column;
        gap: 8px;
        padding: 12px 16px;
    }

    /* Page breaks */
    .sas-category { break-inside: avoid; page-break-inside: avoid; }
    .sas-results  { break-inside: avoid; page-break-inside: avoid; }
    .sas-criterion { break-inside: avoid; page-break-inside: avoid; }

    /* Preserve colours when printing */
    * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }

    .sas-header {
        background: #4a9c1f !important;
        color: #fff !important;
        border-radius: 6px;
    }

    .sas-cat-number {
        background: #4a9c1f !important;
        color: #fff !important;
    }

    /* Hide print button and notes input in print */
    .sas-print-btn { display: none !important; }

    /* Collapse weight input group for print */
    .sas-weight-group { font-size: 0.75rem; }

    /* Category breakdown 3-col for print to avoid overflow */
    .sas-category-breakdown {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}
