/* percentile-checker.css - Sleek Final Version */

:root {
    --site-primary: #0066FF;
    --site-blue-light: #f0f7ff;
    --card-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.dark-theme {
    --site-blue-light: rgba(0, 102, 255, 0.1);
}

/* Base Utility - Remove Number Arrows */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* Page Layout */
html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    overflow-x: hidden;
}

body {
    overflow-x: hidden;
    width: 100%;
}

.percentile-page-hero {
    min-height: 100vh;
    padding: 20px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: var(--bg-primary);
    box-sizing: border-box;
}

/* Main Container */
.percentile-tool-container {
    width: 100%;
    max-width: 1200px;
    background: var(--bg-secondary);
    border-radius: 16px;
    padding: 24px;
    border: 1px solid var(--border-color);
    box-shadow: var(--card-shadow);
    text-align: center;
    margin-top: 20px;
    box-sizing: border-box;
}

.percentile-tool-container.chart-section {
    margin-top: 30px;
    padding: 25px;
}

.percentile-tool-container.technical-section {
    margin-top: 30px;
    text-align: left;
    padding: 40px;
}


.tool-header h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.tool-header p {
    font-size: 13px;
    color: var(--text-tertiary);
    margin-bottom: 24px;
}

/* Standardized Global Header */
.lb-global-header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 24px;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.auth-nav-brand {
    text-decoration: none !important;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-picture {
    display: inline-flex;
    align-items: center;
}

.logo-picture img {
    border-radius: 6px;
    flex-shrink: 0;
}

.nav-brand-name {
    font-family: 'Inter', sans-serif;
    font-style: italic;
    font-weight: 700;
    font-size: 1.3rem;
    line-height: 1;
    color: var(--brand-navy, #1a202c);
}

.nav-brand-name span {
    font-style: normal;
    color: #3b82f6;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Nav Link Buttons */
.nav-link-btn {
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 8px 12px;
    border-radius: 8px;
    transition: all 0.2s;
    white-space: nowrap;
}

.nav-link-btn:hover {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.nav-link-btn.login-btn {
    border: 1px solid var(--border-color);
}

/* Auth awareness */
html.auth-user-hint #header-login-btn {
    display: none !important;
}

/* Input Area */
.input-wrapper {
    position: relative;
    max-width: 200px;
    margin: 0 auto 30px;
}

.wpm-input {
    width: 100%;
    padding: 12px;
    font-size: 32px;
    font-weight: 700;
    text-align: center;
    border-radius: 12px;
    border: 2px solid var(--border-light);
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.wpm-input:focus {
    border-color: var(--site-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 102, 255, 0.1);
}

.input-label {
    position: absolute;
    bottom: -20px;
    left: 0;
    right: 0;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-tertiary);
}

/* Results Section */
.results-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.4s ease;
}

.results-grid.visible {
    opacity: 1;
    transform: translateY(0);
}

.result-card {
    background: var(--bg-primary);
    padding: 16px;
    border-radius: 12px;
    border: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.result-value {
    font-size: 24px;
    font-weight: 800;
    color: var(--site-primary);
    line-height: 1;
    margin-bottom: 4px;
}

.result-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
}

.percentile-visual {
    width: 100%;
    height: 6px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    margin-top: 12px;
    overflow: hidden;
}

.percentile-bar {
    height: 100%;
    width: 0%;
    background: var(--site-primary);
    transition: width 0.8s ease-out;
}

.result-desc {
    font-size: 10px;
    color: var(--text-tertiary);
    margin-top: 8px;
    line-height: 1.3;
}

/* Horizontal Mode Refinements */
.percentile-tool-container.horizontal-mode {
    padding: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    box-shadow: 0 12px 40px var(--shadow-dark);
    /* Stronger uplifted effect */
    border-radius: 20px;
    width: 100%;
    max-width: 600px;
    margin: 30px auto 0;
    /* Centered */
}

.horizontal-mode .tool-header h2 {
    font-size: 1.2rem;
    margin-bottom: 12px;
    color: var(--text-primary);
    letter-spacing: -0.5px;
    font-weight: 800;
}

.horizontal-mode .tool-header p {
    display: none;
}

.side-by-side-content {
    display: flex;
    align-items: center;
    justify-content: center;
    /* Spread content */
    gap: 15px;
    margin-bottom: 12px;
    width: 100%;
}

.horizontal-mode .input-wrapper {
    margin: 0;
    flex: 0 0 85px;
    /* Stay compact for 3 digits */
}

.horizontal-mode .wpm-input {
    font-size: 1.3rem;
    height: 48px;
    padding: 10px;
    background: var(--bg-primary);
    border-radius: 12px;
}

.horizontal-mode .input-label {
    top: -20px;
    bottom: auto;
    font-size: 9px;
    font-weight: 800;
    text-align: center;
    color: var(--text-tertiary);
}

.horizontal-mode .results-grid {
    display: block !important;
    margin: 0;
    flex: 1;
    /* Take remaining space */
    max-width: 180px;
    opacity: 1 !important;
    /* Persistent visibility */
    transform: none !important;
}

.horizontal-mode .result-card {
    background: transparent;
    border: none;
    padding: 0;
    box-shadow: none;
    align-items: center;
}

.horizontal-mode .result-value {
    font-size: 1.8rem;
    color: var(--site-primary);
    font-weight: 900;
    line-height: 1;
    margin-bottom: 4px;
}

.horizontal-mode .result-label {
    font-size: 9px;
    font-weight: 800;
    margin-bottom: 4px;
}

.horizontal-mode .percentile-visual {
    height: 6px;
    margin-top: 6px;
}

.horizontal-mode .footer-link {
    margin-top: 12px;
}

.horizontal-mode .footer-link a {
    font-size: 11px;
    color: var(--site-primary);
    text-decoration: none;
    font-weight: 600;
}

/* Mobile Optimizations */
@media (max-width: 600px) {
    .percentile-page-hero {
        padding: 15px 10px;
    }

    .percentile-tool-container,
    .percentile-tool-container.chart-section,
    .percentile-tool-container.technical-section {
        padding: 20px 12px;
        /* Reduced side padding */
        margin-top: 15px;
        text-align: center;
    }


    .tool-header h2 {
        font-size: 18px;
    }


    .tool-header p {
        font-size: 12px;
        margin-bottom: 20px;
    }

    .wpm-input {
        font-size: 28px;
        padding: 10px;
    }

    .results-grid {
        grid-template-columns: 1fr;
        /* Stack results on small screens */
        gap: 12px;
    }

    .result-card {
        padding: 16px;
    }

    .rank-metrics-container {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .metric-card {
        padding: 20px;
    }

    .metric-title {
        font-size: 16px;
    }

    .metric-desc {
        font-size: 13px;
    }

    .clarification-insight {
        padding: 15px;
        margin-top: 24px;
        text-align: center;
    }

    .custom-auth-footer {
        padding: 20px 0;
        margin-top: 24px;
    }
}


@media (max-width: 380px) {
    .lb-global-header {
        padding: 8px 10px;
    }

    .header-actions {
        gap: 6px;
    }

    .nav-brand-name {
        font-size: 1rem;
    }

    .auth-nav-brand {
        gap: 4px;
    }

    .logo-picture img {
        width: 24px;
        height: 24px;
    }

    .percentile-tool-container {
        padding: 15px 12px;
        border-radius: 12px;
    }

    .wpm-input {
        font-size: 24px;
    }
}


/* Rank Metrics Section */
.rank-metrics-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
    margin-top: 32px;
}

.metric-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 28px;
    text-align: left;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.metric-card:hover {
    border-color: var(--site-primary);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
}

.metric-icon-wrap {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: var(--site-blue-light);
    color: var(--site-primary);
    margin-bottom: 20px;
}

.metric-title {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.metric-subtitle {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 16px;
    display: block;
}

.metric-desc {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-secondary);
}

.comparison-table {
    width: 100%;
    margin-top: 40px;
    background: var(--bg-secondary);
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.comp-header {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    background: var(--bg-tertiary);
    padding: 16px 24px;
    border-bottom: 1px solid var(--border-color);
}

.comp-header span {
    font-size: 11px;
    font-weight: 800;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.comp-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    align-items: center;
    transition: background 0.2s ease;
}

.comp-row:last-child {
    border-bottom: none;
}

.comp-row:hover {
    background: rgba(0, 102, 255, 0.02);
}

.comp-label {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}

.comp-label small {
    display: block;
    font-size: 12px;
    font-weight: 400;
    color: var(--text-tertiary);
    margin-top: 2px;
}

.comp-val {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
}

.comp-val.highlight {
    color: var(--site-primary);
    font-weight: 700;
}

/* Table Responsive Fixes */
@media (max-width: 500px) {

    .comp-header,
    .comp-row {
        grid-template-columns: 1fr 1fr 1fr;
        padding: 12px 8px;
        gap: 8px;
    }

    .comp-header span,
    .comp-val {
        font-size: 10px;
    }

    .comp-label {
        font-size: 11px;
    }

    .comp-label small {
        font-size: 9px;
    }

    .comp-val {
        text-align: center;
    }

    .rank-metrics-container {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .metric-card {
        padding: 18px;
    }

    .nav-link-btn {
        padding: 6px 10px;
        font-size: 11px;
    }
}


.clarification-insight {
    margin-top: 32px;
    padding: 20px;
    background: var(--site-blue-light);
    border-left: 4px solid var(--site-primary);
    border-radius: 4px 12px 12px 4px;
    text-align: left;
}

.custom-auth-footer {
    padding: 30px 0;
    border-top: 1px solid var(--border-color);
    width: 100%;
    background: var(--bg-secondary);
    margin-top: 40px;
}