/**
 * Aira — Plugin styles.
 *
 * Extends Tailwind with plugin-specific overrides.
 *
 * @package AI_Geo_Audit
 * @since   1.0.0
 */

/* Alpine cloak */
[x-cloak] {
    display: none !important;
}

/*
 * Reserve the mobile audit workspace while Alpine initializes. Without this,
 * the root x-cloak collapses the whole application and moves the footer by
 * roughly one viewport when the UI is hydrated.
 */
@media (max-width: 639px) {
    #ai-geo-audit-app[x-cloak] {
        display: block !important;
        visibility: hidden;
        height: 1110px;
        overflow: hidden;
    }
}

/* Audit container */
.ai-geo-audit {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    max-width: 100%;
}

/* Score text colors */
.text-accent {
    color: #10B981;
}

.text-warning {
    color: #F59E0B;
}

.text-danger {
    color: #EF4444;
}

.text-primary {
    color: #2563EB;
}

/* Score backgrounds */
.bg-accent {
    background-color: #10B981;
}

.bg-warning {
    background-color: #F59E0B;
}

.bg-danger {
    background-color: #EF4444;
}

.bg-primary {
    background-color: #2563EB;
}

.score-bg-green {
    background-color: #ECFDF5;
}

.score-bg-yellow {
    background-color: #FFFBEB;
}

.score-bg-red {
    background-color: #FEF2F2;
}

.score-green {
    color: #10B981;
}

.score-yellow {
    color: #F59E0B;
}

.score-red {
    color: #EF4444;
}

/* Cards */
.aira-card {
    background: #ffffff;
    border: 1px solid #F3F4F6;
    border-radius: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04), 0 1px 2px rgba(0, 0, 0, 0.02);
    padding: 1.5rem;
    transition: box-shadow 0.2s ease;
}

.aira-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

/* Progress bar */
.aira-progress {
    height: 6px;
    border-radius: 3px;
    background: #F3F4F6;
    overflow: hidden;
}

.aira-progress-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s ease;
}

.aira-progress-native {
    --aira-progress-color: #2563EB;
    display: block;
    width: 100%;
    height: 6px;
    overflow: hidden;
    appearance: none;
    -webkit-appearance: none;
    border: 0;
    border-radius: 3px;
    background: transparent;
}

.aira-progress-native--thin {
    height: 4px;
}

.aira-progress-native::-webkit-progress-bar {
    border-radius: 3px;
    background: #F3F4F6;
}

.aira-progress-native::-webkit-progress-value {
    border-radius: 3px;
    background: var(--aira-progress-color);
    transition: width 0.6s ease;
}

.aira-progress-native::-moz-progress-bar {
    border-radius: 3px;
    background: var(--aira-progress-color);
    transition: width 0.6s ease;
}

.aira-progress-native.bg-gray-200 {
    --aira-progress-color: #E5E7EB;
}

.aira-progress-native.bg-accent {
    --aira-progress-color: #10B981;
}

.aira-progress-native.bg-warning {
    --aira-progress-color: #F59E0B;
}

.aira-progress-native.bg-danger {
    --aira-progress-color: #EF4444;
}

.aira-progress-native.bg-primary {
    --aira-progress-color: #2563EB;
}

.aira-delay-100 {
    transition-delay: 100ms;
}

.aira-delay-200 {
    transition-delay: 200ms;
}

/* Spinner */
.aira-spinner {
    width: 2rem;
    height: 2rem;
    border: 3px solid #E5E7EB;
    border-top-color: #2563EB;
    border-radius: 50%;
    animation: aira-spin 0.6s linear infinite;
    display: inline-block;
}

@keyframes aira-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Score comparison arrows */
.score-up::before {
    content: '▲';
    color: #10B981;
    margin-right: 0.25rem;
    font-size: 0.75rem;
}

.score-down::before {
    content: '▼';
    color: #EF4444;
    margin-right: 0.25rem;
    font-size: 0.75rem;
}

/* Page Selector */
.page-selector {
    background: #F9FAFB;
    border: 1px solid #E5E7EB;
    border-radius: 1rem;
    padding: 1.25rem;
    margin-top: 1rem;
}

.page-selector-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.page-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    transition: background 0.15s ease;
    cursor: pointer;
}

.page-item:hover {
    background: #EEF2FF;
}

.page-item input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 1.125rem;
    height: 1.125rem;
    border: 2px solid #D1D5DB;
    border-radius: 0.25rem;
    background: #fff;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s ease;
    position: relative;
}

.page-item input[type="checkbox"]:checked {
    background: #2563EB;
    border-color: #2563EB;
}

.page-item input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 3px;
    top: 0px;
    width: 6px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.page-item-title {
    font-size: 0.8125rem;
    font-weight: 500;
    color: #1F2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 280px;
}

.page-item-url {
    font-size: 0.6875rem;
    color: #9CA3AF;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

/* Page Tabs (multi-page results) */
.page-tabs {
    display: flex;
    gap: 0.375rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
    scrollbar-width: thin;
}

.page-tabs::-webkit-scrollbar {
    height: 4px;
}

.page-tabs::-webkit-scrollbar-thumb {
    background: #D1D5DB;
    border-radius: 2px;
}

.page-tab {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.875rem;
    border-radius: 0.625rem;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s ease;
    background: #F3F4F6;
    color: #6B7280;
}

.page-tab:hover {
    background: #E5E7EB;
}

.page-tab.active {
    background: #2563EB;
    color: #fff;
    border-color: #2563EB;
}

.page-tab .tab-score {
    font-size: 0.625rem;
    padding: 0.125rem 0.375rem;
    border-radius: 0.375rem;
    font-weight: 700;
}

/* PRO Badge */
.pro-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.125rem 0.5rem;
    background: linear-gradient(135deg, #8B5CF6 0%, #6366F1 100%);
    color: #fff;
    font-size: 0.625rem;
    font-weight: 700;
    border-radius: 0.375rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Aggregate Score Banner */
.aggregate-banner {
    background: linear-gradient(135deg, #EEF2FF 0%, #E0E7FF 100%);
    border: 1px solid #C7D2FE;
    border-radius: 1rem;
    padding: 1rem 1.5rem;
    margin-bottom: 1rem;
}

/* Responsive grid fallback */
@media (max-width: 640px) {
    .ai-geo-audit .grid {
        grid-template-columns: 1fr !important;
    }

    .page-item-title {
        max-width: 160px;
    }

    .page-item-url {
        display: none;
    }
}
