/* ==========================================================================
   SEO SCORER UTILITY STYLESHEET (/assets/css/seo-scorer-tool.css)
   ========================================================================== */

:root {
    --seo-green: #25D366;
    --seo-orange: #ff9800;
    --seo-red: #ff4444;
    --seo-blue: #3291ff;
}

/* ==========================================================================
   Structural Layout & Sidebar Styles
   ========================================================================== */

.dns-page-wrapper {
    background-color: var(--dark-bg);
    color: var(--text-light);
    padding-bottom: 40px;
    width: 100%;
    overflow-x: hidden;
}

header.dns-header {
    background: var(--card-bg) !important;
    padding: 20px !important;
    font-size: 24px !important;
    font-weight: bold !important;
    border-bottom: 2px solid var(--dropdown-border) !important;
    color: var(--text-dark) !important;
    text-align: center !important;
    width: 100% !important;
    display: block !important;
}

.dns-container {
    display: flex;
    flex-direction: row;
    gap: 30px;
    padding: 30px;
    max-width: 1400px;
    margin: 0 auto;
    min-height: 600px;
    align-items: flex-start;
}

.tool-sidebar-column {
    width: 300px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.tool-sidebar {
    display: flex;
    flex-direction: column;
    gap: 10px !important;
}

.tool-sidebar a,
.tool-sidebar button {
    background: var(--card-bg);
    color: var(--text-light) !important;
    border: 1px solid var(--dropdown-border);
    padding: 12px 15px;
    text-align: left;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: .9rem;
    transition: all .2s ease;
    width: 100%;
    text-decoration: none;
}

.tool-sidebar a i,
.tool-sidebar button i {
    width: 20px !important;
    font-size: 1.1rem;
    color: #25D366 !important;
    text-align: center;
}

.tool-sidebar a:hover,
.tool-sidebar button:hover {
    background: #252525;
    border-color: var(--dropdown-border);
    color: var(--text-dark) !important;
}

.tool-sidebar a.active,
.tool-sidebar button.active {
    background: #25D366 !important;
    color: #000 !important;
    font-weight: bold !important;
    border-color: #25D366 !important;
}

.tool-sidebar a.active i,
.tool-sidebar button.active i {
    color: #000 !important;
}

.diagnostic-main-content {
    flex: 1;
    min-width: 0;
}

/* Sidebar Info Card Styles */
.sidebar-info-card {
    background: var(--card-bg);
    border: 1px solid var(--dropdown-border);
    padding: 15px;
    border-radius: 8px;
    font-size: .8rem;
    line-height: 1.5;
    border-top: 4px solid #ffbb33 !important;
}

.sidebar-info-card i {
    color: #25D366 !important;
    margin-bottom: 10px;
    display: block;
}

/* Diagnostic Wrapper & Buttons */
.pass-container {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 40px;
    border: 1px solid var(--dropdown-border);
    border-top: 4px solid #25D366;
    position: relative;
    min-height: 500px;
}

.input-p-custom {
    margin-bottom: 20px;
    color: var(--text-light);
}

.input-flex-row {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    flex-wrap: wrap;
}

.input-target-custom {
    flex: 3;
    min-width: 200px;
}

.scan-btn-custom {
    flex: 1;
    margin: 0;
    min-width: 120px;
}

input[type=text] {
    width: 100%;
    padding: 15px 20px;
    border: 1px solid var(--dropdown-border);
    background: var(--dark-bg);
    color: var(--text-dark);
    border-radius: 50px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.3s;
}

input[type=text]:focus {
    border-color: var(--brand-green);
}

button.scan {
    padding: 15px 35px;
    background: var(--brand-green) !important;
    border: none;
    color: var(--text-on-brand, #ffffff) !important;
    border-radius: 50px;
    cursor: pointer;
    font-weight: bold;
    transition: transform 0.3s, background-color 0.3s;
}

button.scan:hover {
    background: #158006 !important;
    transform: translateY(-2px);
}

/* ==========================================================================
   Results Main Wrapper
   ========================================================================== */
.seo-results-output {
    background: var(--card-bg);
    border: 1px solid var(--dropdown-border);
    border-radius: 12px;
    padding: 30px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    animation: fadeIn 0.4s ease-out;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Score Header Section */
.seo-dashboard {
    display: flex;
    align-items: center;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 30px;
    padding-bottom: 30px;
    border-bottom: 1px solid var(--dropdown-border);
    margin-bottom: 30px;
}

/* Score Radial/Circular Gauge */
.score-circle-wrapper {
    position: relative;
    width: 150px;
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 0, 0, 0.2) 60%, rgba(255, 255, 255, 0.05) 100%);
    box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.6);
}

.score-circle-wrapper.score-high {
    border: 8px solid var(--seo-green);
    box-shadow: 0 0 25px rgba(37, 211, 102, 0.25), inset 0 0 15px rgba(0, 0, 0, 0.6);
}

.score-circle-wrapper.score-mid {
    border: 8px solid var(--seo-orange);
    box-shadow: 0 0 25px rgba(255, 152, 0, 0.25), inset 0 0 15px rgba(0, 0, 0, 0.6);
}

.score-circle-wrapper.score-low {
    border: 8px solid var(--seo-red);
    box-shadow: 0 0 25px rgba(255, 68, 68, 0.25), inset 0 0 15px rgba(0, 0, 0, 0.6);
}

.score-text-inner {
    text-align: center;
}

.score-number {
    font-size: 3.2rem;
    font-weight: 800;
    line-height: 1;
    color: var(--text-dark);
}

.score-percent-sign {
    font-size: 1.5rem;
    font-weight: 500;
}

.score-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-light);
    margin-top: 5px;
    font-weight: 600;
}

/* Overview Cards */
.seo-overview-text {
    flex: 1;
    min-width: 100px;
    /* Reduced from 250px to allow flex squeezing on tiny screens */
    word-break: break-word;
    overflow-wrap: break-word;
}

.seo-overview-text h3 {
    margin: 0 0 10px;
    font-size: 1.6rem;
    color: var(--text-dark);
}

.seo-overview-text p {
    color: var(--text-light);
    line-height: 1.5;
    margin: 5px 0;
}

.seo-meta-tag {
    display: inline-block;
    background: rgba(255, 255, 255, 0.06);
    padding: 6px 12px;
    border-radius: 6px;
    font-family: monospace;
    font-size: 0.9rem;
    color: var(--seo-blue);
    border: 1px solid var(--dropdown-border);
    margin-top: 10px;
    word-break: break-all;
}

/* Audited Rules Grid */
.seo-rules-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.seo-rule-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--dropdown-border);
    border-radius: 8px;
    padding: 20px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.seo-rule-card:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.04);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

/* Content on Left */
.rule-info {
    flex: 1;
    min-width: 0;
    /* CRITICAL FIX: Allows flex container to shrink past intrinsic text width on mobile */
    max-width: 100%;
    word-break: break-word;
    overflow-wrap: break-word;
}

.rule-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.rule-icon {
    font-size: 1.1rem;
}

.rule-card-good .rule-icon,
.rule-card-good h4 {
    color: var(--seo-green);
}

.rule-card-warning .rule-icon,
.rule-card-warning h4 {
    color: var(--seo-orange);
}

.rule-card-bad .rule-icon,
.rule-card-bad h4 {
    color: var(--seo-red);
}

.rule-header h4 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
}

.rule-message {
    font-size: 0.92rem;
    color: var(--text-light);
    line-height: 1.4;
    margin: 0 0 10px;
}

.rule-value-box {
    display: inline-block;
    font-family: Consolas, Monaco, monospace;
    font-size: 0.82rem;
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    border: 1px solid var(--dropdown-border);
    color: var(--text-dark);
    max-width: 100%;
    word-break: break-all;
}

/* Badges on Right */
.rule-badge-container {
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    min-width: 100px;
}

.status-badge {
    padding: 6px 12px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-radius: 20px;
    display: inline-block;
}

.rule-card-good .status-badge {
    background: rgba(37, 211, 102, 0.15);
    color: var(--seo-green);
    border: 1px solid rgba(37, 211, 102, 0.3);
}

.rule-card-warning .status-badge {
    background: rgba(255, 152, 0, 0.15);
    color: var(--seo-orange);
    border: 1px solid rgba(255, 152, 0, 0.3);
}

.rule-card-bad .status-badge {
    background: rgba(255, 68, 68, 0.15);
    color: var(--seo-red);
    border: 1px solid rgba(255, 68, 68, 0.3);
}

.impact-text {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: 8px;
}

.impact-text span {
    font-weight: 700;
}

.rule-card-bad .impact-text span {
    color: var(--seo-red);
}

.rule-card-warning .impact-text span {
    color: var(--seo-orange);
}

/* Responsive CSS changes */
@media (max-width: 992px) {
    .dns-container {
        flex-direction: column;
        padding: 15px;
    }

    .tool-sidebar-column {
        display: none;
        /* Hide sidebar completely on mobile/tablet */
    }

    .pass-container {
        padding: 15px;
        width: 100%;
        box-sizing: border-box;
        overflow: hidden;
    }

    .seo-results-output {
        padding: 15px;
        word-break: break-word;
        /* Prevents long URLs from causing horizontal scrolling */
        overflow-wrap: break-word;
    }
}

@media (max-width: 768px) {
    .input-flex-row {
        flex-direction: column;
    }

    .scan-btn-custom {
        width: 100%;
    }

    .seo-dashboard {
        flex-direction: column;
        text-align: center;
    }

    .seo-rule-card {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
        gap: 15px;
        padding: 15px;
    }

    .rule-badge-container {
        align-items: flex-start;
        text-align: left;
        border-top: 1px solid var(--dropdown-border);
        padding-top: 12px;
        width: 100%;
    }
}

/* ==========================================================================
   MOBILE OVERFLOW NUKE
   ========================================================================== */
@media (max-width: 768px) {

    html,
    body {
        overflow-x: hidden !important;
        width: 100% !important;
    }

    .dns-page-wrapper,
    .dns-container,
    .diagnostic-main-content,
    .pass-container,
    .seo-results-output,
    .seo-dashboard,
    .seo-rule-card,
    .rule-info {
        max-width: 100vw !important;
        box-sizing: border-box !important;
    }

    pre,
    code,
    .rule-value-box,
    .seo-meta-tag,
    .seo-overview-text,
    .how-to-fix-panel,
    p,
    a {
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        word-break: break-word !important;
        white-space: pre-wrap !important;
        max-width: 100% !important;
    }

    .input-target-custom,
    .scan-btn-custom {
        min-width: 0 !important;
    }
}

/* Light Theme Variables Adaptation */
[data-theme="light"] .seo-rule-card {
    background: rgba(0, 0, 0, 0.015);
}

[data-theme="light"] .seo-rule-card:hover {
    background: rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .rule-value-box {
    background: #f0f0f0;
}

/* ==========================================================================
   Fix Instructions Panels
   ========================================================================== */

.fix-toggle-btn {
    background: none !important;
    border: none !important;
    color: var(--brand-green) !important;
    font-size: 0.85rem !important;
    padding: 0 !important;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 700;
    margin-top: 15px;
    transition: color 0.2s;
}

.fix-toggle-btn:hover {
    color: #20ba5a !important;
    text-decoration: underline !important;
}

.fix-toggle-btn.active {
    color: var(--seo-red) !important;
}

.how-to-fix-panel {
    display: none;
    margin-top: 12px;
    padding: 15px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 8px;
    border: 1px solid var(--dropdown-border);
    border-left: 4px solid var(--seo-orange);
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text-light);
    animation: slideDown 0.25s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.how-to-fix-panel p {
    margin: 0 0 8px;
}

.how-to-fix-panel p:last-child {
    margin-bottom: 0;
}

.how-to-fix-panel pre {
    margin: 10px 0 0;
    background: #000 !important;
    padding: 12px !important;
    border-radius: 6px;
    font-family: Consolas, Monaco, monospace !important;
    font-size: 0.8rem !important;
    color: #eee !important;
    overflow-x: auto;
    border: 1px solid var(--dropdown-border) !important;
    line-height: 1.4 !important;
}

[data-theme="light"] .how-to-fix-panel {
    background: #f5f5f5;
    color: #333;
}

[data-theme="light"] .how-to-fix-panel pre {
    background: #eef2f7 !important;
    color: #333 !important;
}