/* ===================================
   PerSeo Insights - Minimal CSS
   Using Tailwind for most styling
   =================================== */

/* CSS Variables - Brand Colors from Logo */
:root {
    --color-primary: #9ba7ce;
    --color-primary-dark: #0b002b;
    --color-accent: #a9deff;
}

/* ===================================
   AUTH PAGES BACKGROUND
   =================================== */

.auth-page {
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: url('/static/images/bkgrnd.png') center center / cover no-repeat fixed, #1a1f3a;
}

.auth-overlay {
    background: linear-gradient(135deg, rgba(147, 51, 234, 0.1) 0%, rgba(124, 58, 237, 0.1) 100%);
}

/* ===================================
   CUSTOM ANIMATIONS
   =================================== */

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

@keyframes magicShine {
    0% { left: -50%; }
    100% { left: 150%; }
}

@keyframes wizardFloat {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    50% {
        transform: translateY(-3px) rotate(5deg);
    }
}

@keyframes wizardFloatFast {
    0%, 100% {
        transform: translateY(0) rotate(-15deg);
    }
    50% {
        transform: translateY(-5px) rotate(-10deg);
    }
}

@keyframes sparkle {
    0%, 100% {
        opacity: 0.3;
        transform: scale(0.8);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

@keyframes sparkleFast {
    0%, 100% {
        opacity: 0.5;
        transform: scale(0.9) rotate(0deg);
    }
    50% {
        opacity: 1;
        transform: scale(1.1) rotate(180deg);
    }
}

@keyframes progressShine {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

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

/* ===================================
   HEADER ANIMATIONS
   =================================== */

.header-logo {
    animation: fadeInDown 0.6s ease-out;
}

.header-logo img {
    max-width: 120px;
    height: auto;
}

.header h1 {
    animation: fadeInDown 0.6s ease-out 0.1s both;
}

.header-tagline {
    animation: fadeInDown 0.6s ease-out 0.2s both;
}

.header-subtitle {
    animation: fadeInDown 0.6s ease-out 0.3s both;
}

/* ===================================
   MAGIC BUTTON & TITLE
   =================================== */

.magic-button {
    background: linear-gradient(135deg, #9ba7ce 0%, #0b002b 100%);
    box-shadow: 0 4px 15px rgba(155, 167, 206, 0.4), 0 0 20px rgba(169, 222, 255, 0.2);
    position: relative;
    overflow: hidden;
}

.magic-button::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(169, 222, 255, 0.2), transparent);
    transform: rotate(45deg);
    animation: magicShine 3s infinite;
}

.magic-button .wizard-hat {
    animation: wizardFloat 2s ease-in-out infinite;
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.5));
}

.magic-button .sparkle-1 {
    animation: sparkle 1.5s ease-in-out infinite;
}

.magic-button .sparkle-2 {
    animation: sparkle 1.5s ease-in-out infinite 0.75s;
}

.magic-button:hover {
    background: linear-gradient(135deg, #a9deff 0%, #9ba7ce 100%);
    box-shadow: 0 6px 20px rgba(169, 222, 255, 0.5), 0 0 30px rgba(155, 167, 206, 0.3);
    transform: translateY(-3px) scale(1.02);
}

.magic-button:hover .wizard-hat {
    animation: wizardFloatFast 1s ease-in-out infinite;
    transform: rotate(-15deg);
}

.magic-button:hover .sparkle-1,
.magic-button:hover .sparkle-2 {
    animation: sparkleFast 0.8s ease-in-out infinite;
}

/* Magic Title Effect */
.magic-title {
    position: relative;
    display: inline-block;
    background: linear-gradient(135deg, #ffffff 0%, #a9deff 50%, #ffffff 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: magicTitleShine 4s ease-in-out infinite;
    text-shadow: 0 0 30px rgba(169, 222, 255, 0.5);
}

.magic-title::before {
    content: '';
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    background: radial-gradient(circle, rgba(169, 222, 255, 0.3) 0%, transparent 70%);
    animation: magicGlow 3s ease-in-out infinite;
    z-index: -1;
    border-radius: 20px;
}

@keyframes magicTitleShine {
    0%, 100% {
        background-position: 0% center;
    }
    50% {
        background-position: 200% center;
    }
}

@keyframes magicGlow {
    0%, 100% {
        opacity: 0.3;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(1.05);
    }
}

/* ===================================
   PROGRESS BAR
   =================================== */

.progress-bar {
    background: linear-gradient(90deg, #9ba7ce, #a9deff, #9ba7ce);
    background-size: 200% 100%;
    animation: progressShine 2s ease-in-out infinite;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(155, 167, 206, 0.4);
}

/* ===================================
   RESULTS SECTIONS
   =================================== */

.error-section,
.warning-section {
    margin-top: 20px;
}

.error-section h4,
.warning-section h4 {
    color: #333;
    margin-bottom: 10px;
    font-size: 1.125rem;
    font-weight: 600;
}

/* Page Preview/Screenshot */
.page-preview {
    margin-top: 20px;
    padding: 15px;
    background: #f8fafc;
    border-radius: 10px;
    border: 1px solid #e0e0e0;
}

.page-preview-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--color-primary);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.page-preview-image {
    width: 100%;
    max-width: 800px;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    border: 1px solid #e0e0e0;
    display: block;
    margin: 0 auto;
    transition: transform 0.3s ease;
}

.page-preview-image:hover {
    transform: scale(1.02);
}

.page-preview-thumbnail {
    width: 100%;
    height: auto;
    object-fit: cover;
    border-radius: 5px;
    display: block;
    margin: 0 auto;
}

.page-preview-loading {
    text-align: center;
    padding: 30px;
    color: #555;
}

.page-preview-error {
    text-align: center;
    padding: 15px;
    color: #c33;
    background: #fee;
    border-radius: 5px;
    border: 1px solid #f44;
}

.preview-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-top: 15px;
}

.preview-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.preview-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-primary-dark);
    margin-bottom: 10px;
}

.preview-description {
    color: #555;
    font-size: 0.875rem;
    margin-bottom: 20px;
    font-style: italic;
    text-align: center;
    padding: 10px;
    background: #e8f4fd;
    border-radius: 5px;
    border: 1px solid #bfdbfe;
}

.preview-item .page-preview-thumbnail {
    max-width: 100%;
    width: auto;
    max-height: 300px;
}

@media (max-width: 768px) {
    .page-preview-image,
    .page-preview-thumbnail {
        max-height: 300px;
    }

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

#summary h3,
#pageResults h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-primary-dark);
    margin-bottom: 1.5rem;
}

/* Page Result */
.page-result {
    margin-bottom: 30px;
    padding: 20px;
    background: white;
    border-radius: 10px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.page-url {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--color-primary-dark);
    margin-bottom: 20px;
    padding: 15px 20px;
    background: white;
    border-radius: 10px;
    border: 2px solid var(--color-primary);
    word-break: break-all;
    box-shadow: 0 2px 8px rgba(155, 167, 206, 0.1);
}

.agent-title {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--color-primary-dark);
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 3px solid var(--color-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ===================================
   SEO SCORE
   =================================== */

.seo-score-container {
    display: flex;
    align-items: center;
    gap: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 15px;
    margin-bottom: 20px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.seo-score-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 8px solid;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: white;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1), 0 4px 12px rgba(0,0,0,0.15);
    flex-shrink: 0;
    animation: scoreCircleAppear 0.6s ease-out backwards;
    transform-origin: center;
}

@keyframes scoreCircleAppear {
    from {
        transform: scale(0) rotate(-180deg);
        opacity: 0;
    }
    to {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

.seo-score-value {
    font-size: 36px;
    font-weight: 700;
    line-height: 1;
    animation: scoreValueCount 1s ease 0.3s backwards;
}

@keyframes scoreValueCount {
    from {
        transform: scale(0.5);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.seo-score-label {
    font-size: 12px;
    color: #555;
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.seo-score-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.seo-score-grade {
    display: inline-block;
    padding: 8px 16px;
    color: white;
    font-weight: 700;
    border-radius: 10px;
    font-size: 1.125rem;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.seo-score-text {
    font-size: 1.125rem;
    color: #333;
    line-height: 1.5;
}

@media (max-width: 768px) {
    .seo-score-container {
        flex-direction: column;
        text-align: center;
        gap: 15px;
    }

    .seo-score-circle {
        width: 100px;
        height: 100px;
        border-width: 6px;
    }

    .seo-score-value {
        font-size: 28px;
    }
}

/* ===================================
   INFO ITEMS
   =================================== */

.info-grid {
    display: grid;
    grid-template-columns: repeat(1, 1fr);  /* Mobile: 1 column */
    gap: 16px;
    margin-bottom: 16px;
}

/* Tablet: 2 columns */
@media (min-width: 768px) {
    .info-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Desktop: 3 columns */
@media (min-width: 1024px) {
    .info-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Override for specific grids that need 4 columns on desktop */
.info-grid.grid-cols-4 {
    grid-template-columns: repeat(1, 1fr);
}

@media (min-width: 768px) {
    .info-grid.grid-cols-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .info-grid.grid-cols-4 {
        grid-template-columns: repeat(4, 1fr);
    }
}

.info-item {
    position: relative;
    z-index: 1;
    transition: all 0.3s ease;
    padding: 16px;  /* Uniform padding */
    border-radius: 8px;
    background: white;
    border: 1px solid #e0e0e0;
    min-height: 100px;  /* Ensure uniform height */
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.info-label {
    font-size: 0.875rem;
    font-weight: 400;
    color: #6b7280; /* Tailwind gray-500 */
    margin-bottom: 5px;
}

.info-value {
    font-weight: 400;
    color: #000000; /* Black */
    font-size: 1rem;
    word-break: break-word;
    overflow-wrap: break-word;
    overflow: hidden;
    max-width: 100%;
}

.info-item.clickable {
    cursor: pointer;
}

/* Info icon wrapper for hover detection */
.info-icon {
    position: relative;
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: help;
    z-index: 10;
}

/* When info-icon is inside info-item, position it absolutely */
.info-item > .info-icon {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 100;
}

/* When hovering icon, elevate the entire parent info-item */
.info-item:has(> .info-icon:hover) {
    z-index: 9999997;
}

/* Auto-show info icon for info-items with title attribute */
.info-item[title]::after {
    content: '\f05a';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 14px;
    position: absolute;
    top: 12px;
    right: 12px;
    opacity: 0.4;
    color: #6366f1;
    cursor: help;
    transition: opacity 0.3s ease;
    z-index: 10;
}

.info-item[title]:hover::after {
    opacity: 0.8;
}

/* Tooltip for info-items with title - styled like homepage */
/* Positioned near the icon on the right */
.info-item[title]::before {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 8px);
    right: -10px;
    background: #0b002b;
    color: white;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 0.8rem;
    line-height: 1.5;
    white-space: normal;
    max-width: min(280px, calc(100vw - 40px));
    min-width: 150px;
    width: max-content;
    text-align: left;
    z-index: 999999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease 0.2s, transform 0.3s ease 0.2s;
    box-shadow: 0 6px 16px rgba(11, 0, 43, 0.4);
    word-wrap: break-word;
    overflow-wrap: break-word;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

/* Only show tooltip when hovering the icon area (right 50px of the item) */
.info-item[title]:hover::before {
    opacity: 1;
    transform: translateY(-4px);
    transition-delay: 0.3s;
}

/* Don't show tooltip immediately - requires hovering near icon */
.info-item[title]::before {
    pointer-events: none;
}

/* FontAwesome icon for info */
.info-icon::before {
    content: '\f05a';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    font-size: 14px;
    opacity: 0.6;
    transition: opacity 0.3s ease;
    color: var(--color-primary);
    position: relative;
    z-index: 1;
}

.info-icon:hover::before {
    opacity: 1;
}

/* Tooltip styling - smart positioning to avoid screen edges */
.info-icon[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    background: var(--color-primary-dark);
    color: white;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 0.8rem;
    line-height: 1.5;
    white-space: normal;
    max-width: min(300px, calc(100vw - 40px));
    min-width: 100px;
    width: max-content;
    text-align: left;
    z-index: 9999999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    box-shadow: 0 6px 16px rgba(11, 0, 43, 0.4);
    word-wrap: break-word;
    overflow-wrap: break-word;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
    /* Position below the icon */
    bottom: auto;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
}

.info-icon[data-tooltip]:hover::after {
    opacity: 1;
}

/* Smart tooltip positioning classes */
.info-icon.tooltip-left[data-tooltip]::after {
    left: 0;
    transform: translateX(0);
}

.info-icon.tooltip-right[data-tooltip]::after {
    left: auto;
    right: 0;
    transform: translateX(0);
}

.info-icon.tooltip-center[data-tooltip]::after {
    left: 50%;
    transform: translateX(-50%);
}

@media (max-width: 768px) {
    .info-icon[data-tooltip]::after {
        max-width: calc(100vw - 20px);
        font-size: 0.75rem;
    }
}

.info-item.clickable:hover {
    box-shadow: 0 4px 12px rgba(155, 167, 206, 0.2);
}

/* Color coding for info-items based on status */
.info-item.good {
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.15);
    border: 1px solid #6ee7b7;
}

.info-item.warning {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.15);
    border: 1px solid #fbbf24;
}

.info-item.error {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.15);
    border: 1px solid #f87171;
}

.info-item.poor {
    background: linear-gradient(135deg, #fef2f2 0%, #fecaca 100%);
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.15);
}

/* Detail Cards - Now placed after info-grid, no more wrappers */
.detail-card {
    grid-column: 1 / -1;
    background: white;
    border-radius: 8px;
    border: 2px solid transparent;
    box-shadow: none;
    overflow: hidden;
    margin-top: 0;
    margin-bottom: 0;
    padding: 0;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.4s ease, opacity 0.3s ease, padding 0.4s ease, margin 0.4s ease;
}

.detail-card.active {
    max-height: 500px;
    opacity: 1;
    padding: 20px;
    margin-top: 16px;
    margin-bottom: 8px;
    border-color: var(--color-primary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    overflow-y: auto;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-15px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.detail-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e5e7eb;
}

.detail-card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--color-primary-dark);
}

.detail-card-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #9ca3af;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.detail-card-close:hover {
    color: #ef4444;
}

.detail-card-body {
    max-height: 400px;
    overflow-y: auto;
}

.detail-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.detail-list-item {
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    background: white;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    color: #374151;
    border: 1px solid #bfdbfe;
}

.detail-list-item strong {
    margin-right: 0.5rem;
}

/* Error, Warning, Success Items */
.error-item {
    padding: 8px 12px;
    background: #fee;
    margin-bottom: 5px;
    border-radius: 3px;
    color: #c33;
    font-size: 1rem;
}

.warning-item {
    padding: 8px 12px;
    background: #fffbeb;
    margin-bottom: 5px;
    border-radius: 3px;
    color: #856404;
    font-size: 1rem;
}

.success-item {
    padding: 8px 12px;
    background: #efe;
    margin-bottom: 5px;
    border-radius: 3px;
    color: #363;
    font-size: 1rem;
}

/* ===================================
   BACK TO TOP BUTTON
   =================================== */

.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #9ba7ce 0%, #0b002b 100%);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(155, 167, 206, 0.4);
    transition: all 0.25s ease-in-out;
    z-index: 1000;
    line-height: 1;
    padding: 0;
}

.back-to-top.show {
    display: flex;
}

.back-to-top:hover {
    background: linear-gradient(135deg, #a9deff 0%, #9ba7ce 100%);
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 8px 20px rgba(169, 222, 255, 0.5);
}

/* ===================================
   SPINNER
   =================================== */

.spinner {
    border: 3px solid rgba(155, 167, 206, 0.1);
    border-top: 3px solid #9ba7ce;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

/* ===================================
   CORE WEB VITALS
   =================================== */

.cwv-container {
    background: #f8fafc;
    padding: 20px;
    border-radius: 10px;
    margin-top: 10px;
}

.cwv-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.cwv-header h4 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--color-primary-dark);
}

.cwv-tabs {
    display: flex;
    gap: 5px;
    background: #e5e7eb;
    padding: 4px;
    border-radius: 5px;
}

.cwv-tab {
    padding: 8px 16px;
    border: none;
    background: transparent;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    color: #555;
    transition: all 0.25s ease-in-out;
    display: flex;
    align-items: center;
    gap: 6px;
}

.cwv-tab:hover {
    background: rgba(155, 167, 206, 0.1);
    color: var(--color-primary);
}

.cwv-tab.active {
    background: var(--color-primary);
    color: white;
    box-shadow: 0 2px 4px rgba(155, 167, 206, 0.3);
}

.cwv-tab i {
    font-size: 14px;
}

.cwv-load-btn {
    background: var(--color-primary);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: block;
    margin: 15px auto;
}

.cwv-load-btn:hover {
    background: var(--color-primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.cwv-load-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.cwv-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    color: #555;
}

.cwv-loading p {
    margin: 0;
    font-size: 0.875rem;
}

.cwv-result {
    margin-top: 15px;
}

.cwv-score {
    text-align: center;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 15px;
    border: 3px solid;
}

.cwv-score.good {
    background: #ecfdf5;
    border-color: #10b981;
}

.cwv-score.warning {
    background: #fff3cd;
    border-color: #ffc107;
}

.cwv-score.poor {
    background: #fee;
    border-color: #f44;
}

.cwv-score-value {
    font-size: 48px;
    font-weight: 700;
    line-height: 1;
}

.cwv-score-label {
    position: relative;
    font-size: 1.125rem;
    color: #555;
    margin-top: 5px;
    padding-right: 25px;  /* Space for icon */
}

.cwv-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.cwv-metric {
    padding: 15px;
    border-radius: 5px;
    text-align: center;
}

.cwv-metric.good {
    background: #ecfdf5;
}

.cwv-metric.warning {
    background: #fff3cd;
}

.cwv-metric.poor {
    background: #fee;
}

.cwv-metric-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #333;
}

.cwv-metric-label {
    position: relative;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--color-primary);
    margin-top: 5px;
    padding-right: 25px;  /* Space for icon */
}

.cwv-metric-desc {
    font-size: 0.875rem;
    color: #555;
    margin-top: 5px;
}

.cwv-strategy {
    text-align: center;
    padding: 10px;
    background: white;
    border-radius: 5px;
    margin-bottom: 15px;
    font-size: 0.875rem;
    color: #555;
}

@media (max-width: 768px) {
    .cwv-metrics {
        grid-template-columns: 1fr;
    }
}

/* ===================================
   SITEMAP DATATABLE STYLES
   =================================== */

.sitemap-report {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    animation: fadeInUp 0.5s ease-out;
}

.report-header {
    margin-bottom: 30px;
    text-align: center;
}

.report-header h2 {
    color: var(--color-primary);
    font-size: 2rem;
    margin-bottom: 10px;
}

.report-subtitle {
    color: #555;
    font-size: 1.125rem;
}

.datatable-container {
    width: 100%;
}

.datatable-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 15px;
    flex-wrap: wrap;
}

.table-search {
    flex: 1;
    max-width: 400px;
    min-width: 200px;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.table-search:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(155, 167, 206, 0.1);
}

.table-info {
    color: #555;
    font-size: 0.875rem;
    font-weight: 500;
}

.table-info span {
    font-weight: 700;
    color: var(--color-primary);
    font-size: 1.125rem;
}

.table-responsive {
    overflow-x: auto;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border: 1px solid #e0e0e0;
}

.sitemap-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    font-size: 1rem;
    min-width: 900px;
}

.sitemap-table thead {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
    color: white;
}

.sitemap-table th {
    padding: 16px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--color-accent);
    white-space: nowrap;
}

.sitemap-table th.sortable {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease;
}

.sitemap-table th.sortable:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.sitemap-table th.sortable.active {
    background-color: rgba(255, 255, 255, 0.15);
}

.sort-icon {
    margin-left: 6px;
    font-size: 12px;
    opacity: 0.7;
}

.sitemap-table th.sortable.active .sort-icon {
    opacity: 1;
}

.sitemap-table tbody tr {
    border-bottom: 1px solid #e0e0e0;
    transition: background-color 0.2s ease;
}

.sitemap-table tbody tr:hover {
    background-color: #f8f9fa;
}

.sitemap-table tbody tr:last-child {
    border-bottom: none;
}

.sitemap-table td {
    padding: 14px 12px;
    vertical-align: middle;
}

/* Expand Cell & Icon */
.expand-cell {
    width: 30px;
    text-align: center;
    padding: 14px 8px !important;
}

.expand-icon {
    display: inline-block;
    font-size: 12px;
    color: var(--color-primary);
    transition: transform 0.3s ease;
    cursor: pointer;
}

.sitemap-row.expanded .expand-icon {
    transform: rotate(90deg);
}

/* Detail Row */
.sitemap-detail-row {
    background: #f8fafc;
    transition: all 0.3s ease;
}

.detail-content {
    padding: 0 !important;
}

.detail-inner {
    padding: 20px 40px;
}

.detail-section {
    margin-bottom: 15px;
}

.detail-section:last-child {
    margin-bottom: 0;
}

.detail-section h5 {
    margin: 0 0 10px 0;
    font-size: 14px;
    font-weight: 600;
}

.issue-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.issue-list li {
    padding: 8px 12px;
    margin: 4px 0;
    background: white;
    border: 1px solid #bfdbfe;
    border-radius: 4px;
    font-size: 13px;
}

/* URL Cell */
.url-cell {
    max-width: 400px;
}

.url-cell a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color 0.2s ease;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.url-cell a:hover {
    color: var(--color-primary-dark);
    text-decoration: underline;
}

/* Metric Cells */
.metric-cell {
    font-weight: 600;
    text-align: center;
}

.metric-cell.fast {
    color: #10b981;
}

.metric-cell.medium {
    color: #f59e0b;
}

.metric-cell.slow {
    color: #ef4444;
}

.metric-cell.small {
    color: #10b981;
}

.metric-cell.large {
    color: #ef4444;
}

/* Score Badge */
.score-cell {
    text-align: center;
}

.score-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 20px;
    color: white;
    font-weight: 700;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}

.score-value {
    font-size: 18px;
}

.score-grade {
    font-size: 14px;
    opacity: 0.9;
}

/* Count Cells */
.count-cell {
    text-align: center;
    font-weight: 600;
    color: #555;
}

.count-cell.has-warnings {
    color: #f59e0b;
    font-weight: 700;
}

.count-cell.has-errors {
    color: #ef4444;
    font-weight: 700;
}

/* Responsive Table */
@media (max-width: 768px) {
    .datatable-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .table-search {
        max-width: 100%;
    }

    .table-info {
        text-align: center;
    }

    .sitemap-table {
        font-size: 12px;
    }

    .sitemap-table th,
    .sitemap-table td {
        padding: 10px 8px;
    }

    .score-badge {
        padding: 6px 12px;
    }

    .score-value {
        font-size: 16px;
    }
}

/* ===================================
   DATATABLE OVERRIDES
   =================================== */

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
    background: var(--color-primary) !important;
    border-color: var(--color-primary) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
    background: var(--color-primary-dark) !important;
    border-color: var(--color-primary-dark) !important;
}

/* ===================================
   SEO CATEGORIES
   =================================== */

/* Key Metrics Grid */
.key-metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin: 20px 0 30px 0;
}

.seo-categories-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 24px;
}

.seo-category {
    background: white;
    border-radius: 12px;
    overflow: visible;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}


.seo-category-header {
    background: linear-gradient(135deg, var(--color-primary-dark) 0%, var(--color-primary) 100%);
    padding: 16px 20px;
    cursor: pointer;
    user-select: none;
    transition: all 0.3s ease;
    border-radius: 12px 12px 0 0;
}

.seo-category-header.collapsed {
    border-radius: 12px;
}


.seo-category-title {
    color: white;
    font-size: 16px;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.category-issues {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    margin-right: 8px;
    font-size: 12px;
    font-weight: 600;
}

.issue-count {
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.error-count {
    background: rgba(239, 68, 68, 0.9);
}

.warning-count {
    background: rgba(245, 158, 11, 0.9);
}

.seo-category-toggle {
    transition: transform 0.3s ease;
    font-size: 12px;
    flex-shrink: 0;
}

.seo-category-header.collapsed .seo-category-toggle {
    transform: rotate(-90deg);
}

.seo-category-body {
    padding: 20px;
    background: white;
    transition: all 0.3s ease;
}

.seo-category-body.collapsed {
    display: none !important;
}

/* ===================================
   COPY TO CLIPBOARD BUTTONS
   =================================== */

.copy-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    padding: 0;
    margin-left: 8px;
    background: transparent;
    color: var(--color-primary);
    border: 1px solid var(--color-primary);
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.copy-btn:hover {
    background: var(--color-primary);
    color: white;
    transform: scale(1.1);
}

.copy-btn:active {
    transform: scale(0.9);
}

.copy-btn.copied {
    background: #10b981;
    border-color: #10b981;
    color: white;
}

/* ===================================
   LANGUAGE SELECTOR
   =================================== */

.lang-selector-dropdown {
    position: relative;
    z-index: 1000;
}

.lang-selector-current {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.875rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.75rem;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-height: 2.5rem;
    line-height: 1.25rem;
}

.lang-selector-current:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.lang-selector-current svg {
    width: 1rem;
    height: 1rem;
    border-radius: 0.25rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.lang-selector-current i {
    font-size: 0.625rem;
    opacity: 0.7;
    transition: transform 0.3s ease;
}

.lang-selector-dropdown.open .lang-selector-current i {
    transform: rotate(180deg);
}

/* Language Dropdown Menu */
.lang-selector-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    min-width: 160px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(155, 167, 206, 0.2);
    border-radius: 0.75rem;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.12), 0 4px 16px rgba(0, 0, 0, 0.08);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
    overflow: hidden;
}

.lang-selector-dropdown.open .lang-selector-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.lang-selector-menu-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.75rem 0.875rem;
    color: #374151;
    text-decoration: none;
    border: none;
    background: transparent;
    width: 100%;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.lang-selector-menu-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(135deg, #9ba7ce, #0b002b);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.lang-selector-menu-item:hover {
    background: rgba(155, 167, 206, 0.08);
    color: #0b002b;
}

.lang-selector-menu-item:hover::before {
    transform: scaleX(1);
}

.lang-selector-menu-item svg {
    width: 1.25rem;
    height: 1.25rem;
    border-radius: 0.25rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.lang-selector-menu-item span {
    font-size: 0.75rem;
    font-weight: 600;
    flex: 1;
}

.lang-selector-menu-item.active {
    background: linear-gradient(135deg, rgba(155, 167, 206, 0.12), rgba(11, 0, 43, 0.08));
    color: #0b002b;
    font-weight: 700;
}

.lang-selector-menu-item.active::before {
    transform: scaleX(1);
}

/* ===================================
   TAB NAVIGATION SYSTEM
   =================================== */

.tab-button {
    position: relative;
    cursor: pointer;
    white-space: nowrap;
    outline: none;
}

.tab-button:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
    border-radius: 4px;
}

.tab-button.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary) !important;
}

.tab-button:not(.active):hover {
    color: #4b5563;
    border-bottom-color: #d1d5db;
}

.tab-panel {
    animation: fadeIn 0.3s ease-in-out;
}

.tab-panel.hidden {
    display: none;
}

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

/* Mobile responsive tabs */
@media (max-width: 640px) {
    #tabNavigation {
        flex-direction: column;
    }

    .tab-button {
        width: 100%;
        justify-content: center;
        border-bottom: none;
        padding-left: 12px;
    }

    .tab-button.active {
        border-bottom: none !important;
    }

    /* Stack grids on mobile */

    .key-metrics-grid,
    .info-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

/* Tablet responsive */

@media (max-width: 1024px) and (min-width: 641px) {
    .key-metrics-grid,
    .info-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ===================================
   CTA BUTTON (formerly magic-button)
   =================================== */

.cta-button {
    background: linear-gradient(135deg, #9ba7ce 0%, #0b002b 100%);
    box-shadow: 0 4px 15px rgba(155, 167, 206, 0.4), 0 0 20px rgba(169, 222, 255, 0.2);
    position: relative;
    overflow: hidden;
}

.cta-button::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(169, 222, 255, 0.2), transparent);
    transform: rotate(45deg);
    animation: magicShine 3s infinite;
}

.cta-button:hover {
    background: linear-gradient(135deg, #a9deff 0%, #9ba7ce 100%);
    box-shadow: 0 6px 20px rgba(169, 222, 255, 0.5), 0 0 30px rgba(155, 167, 206, 0.3);
    transform: translateY(-3px) scale(1.02);
}

/* ===================================
   AUTH PANEL BUTTONS
   =================================== */

.auth-panel {
    display: flex;
    align-items: center;
}

.auth-container {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.auth-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.875rem;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    cursor: pointer;
    position: relative;
    min-height: 2.5rem;
    line-height: 1.25rem;
}

.auth-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.auth-btn:active {
    transform: translateY(0px) scale(0.98);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    background: rgba(255, 255, 255, 0.2);
}

.auth-btn.primary {
    background: linear-gradient(135deg, #a9deff 0%, #9ba7ce 100%);
    color: #0b002b;
    font-weight: 700;
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(169, 222, 255, 0.3);
}

.auth-btn.primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(169, 222, 255, 0.4);
}

.auth-btn.primary:active {
    transform: translateY(0px) scale(0.98);
    box-shadow: 0 2px 6px rgba(169, 222, 255, 0.3);
}

.auth-btn.logout:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.3);
    color: #f87171;
}

.auth-btn.logout:active {
    transform: translateY(0px) scale(0.98);
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.3);
}

/* Username display in auth panel - clickable to profile */
.auth-username {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.875rem;
    color: rgba(255, 255, 255, 0.95);
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 0.75rem;
    border: 1px solid rgba(169, 222, 255, 0.3);
    background: rgba(169, 222, 255, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    cursor: pointer;
    min-height: 2.5rem;
    line-height: 1.25rem;
}

.auth-username:hover {
    background: rgba(169, 222, 255, 0.2);
    border-color: rgba(169, 222, 255, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(169, 222, 255, 0.25);
}

.auth-username:active {
    transform: translateY(0px) scale(0.98);
    box-shadow: 0 2px 6px rgba(169, 222, 255, 0.2);
    background: rgba(169, 222, 255, 0.25);
}

.auth-username i {
    color: rgba(169, 222, 255, 0.9);
}

@media (max-width: 640px) {
    .auth-btn span,
    .auth-username span {
        display: none;
    }
    .auth-btn,
    .auth-username {
        padding: 0.5rem;
    }
    .auth-container {
        gap: 0.25rem;
    }
}

/* ===================================
   SCAN DETAILS PAGE STYLES
   =================================== */

.section-card {
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    min-height: 280px;
}

.data-grid {
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: 1rem;
}

@media (min-width: 768px) {
    .data-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.data-item {
    background: #f9fafb;
    border-radius: 0.5rem;
    padding: 1rem;
    border: 1px solid #e5e7eb;
}

.data-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: #6b7280;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}

.data-value {
    font-size: 0.875rem;
    color: #111827;
    line-height: 1.5;
    word-wrap: break-word;
}

/* ===================================
   GAUGE CHARTS
   =================================== */

.metric-gauge {
    position: relative;
    width: 160px;
    height: 160px;
    margin: 0 auto;
}

.metric-gauge svg {
    transform: rotate(-90deg);
    width: 100%;
    height: 100%;
}

.gauge-bg {
    fill: none;
    stroke: #e5e7eb;
    stroke-width: 12;
    stroke-linecap: round;
}

.gauge-fill {
    fill: none;
    stroke-width: 12;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.6s ease-in-out;
}

.metric-value {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2.5rem;
    font-weight: 700;
    text-align: center;
}


/* ===================================
   RESPONSIVE FIXES FOR ISSUE-COUNT & CATEGORY-ISSUES
   =================================== */

/* Mobile: Stack issue counts vertically */
@media (max-width: 767px) {
    .category-issues {
        flex-wrap: wrap;
        gap: 4px;
    }

    .issue-count {
        font-size: 10px;
        padding: 2px 6px;
        white-space: nowrap;
    }
}

/* Ensure issue-count badges don't overflow */
.issue-count {
    display: inline-block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 150px;
}

/* Tablet and up: better spacing */
@media (min-width: 768px) {
    .category-issues {
        gap: 8px;
    }
}
