/* ============================================
   Agent SEO - WebCraftMQ
   Dark Theme Stylesheet
   ============================================ */

:root {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --bg-card: #16213e;
    --bg-sidebar: #0f0f23;
    --bg-input: #1e2a45;
    --accent-blue: #0f3460;
    --accent-light: #4a9eff;
    --accent-hover: #1a4a80;
    --text-primary: #e0e0e0;
    --text-secondary: #8892a4;
    --text-muted: #5a6478;
    --border-color: #2a3550;
    --success: #00c853;
    --warning: #ffc107;
    --danger: #ff5252;
    --info: #29b6f6;
    --chat-user: #0f3460;
    --chat-assistant: #1e2a45;
    --radius: 12px;
    --radius-sm: 8px;
    --transition: 0.2s ease;
    --sidebar-width: 260px;
    --header-height: 64px;
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--accent-light);
    text-decoration: none;
    transition: color var(--transition);
}

a:hover {
    color: #6db8ff;
}

/* ============================================
   Layout
   ============================================ */
.app-layout {
    display: flex;
    height: 100vh;
    width: 100vw;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform var(--transition);
}

.sidebar-brand {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-brand h1 {
    font-size: 18px;
    font-weight: 700;
    color: var(--accent-light);
    letter-spacing: 0.5px;
}

.sidebar-brand .brand-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    list-style: none;
}

.sidebar-nav li {
    margin-bottom: 4px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition);
}

.sidebar-nav a:hover {
    background: var(--accent-blue);
    color: var(--text-primary);
}

.sidebar-nav a.active {
    background: var(--accent-blue);
    color: var(--text-primary);
}

.sidebar-nav .nav-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.sidebar-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    font-size: 12px;
    color: var(--text-muted);
}

/* Main Content */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

/* Header */
.header {
    height: var(--header-height);
    min-height: var(--header-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
}

.header-title {
    font-size: 20px;
    font-weight: 600;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 16px;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
}

.header-badge {
    background: var(--accent-blue);
    color: var(--text-primary);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

/* Content Area */
.content-area {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
}

.content-area::-webkit-scrollbar {
    width: 6px;
}

.content-area::-webkit-scrollbar-track {
    background: transparent;
}

.content-area::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

/* ============================================
   Dashboard Cards
   ============================================ */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 24px;
    transition: transform var(--transition), box-shadow var(--transition);
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.stat-card .stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-card .stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-card .stat-change {
    font-size: 13px;
    margin-top: 4px;
}

.stat-change.positive {
    color: var(--success);
}

.stat-change.negative {
    color: var(--danger);
}

/* Site Cards Grid */
.sites-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 24px;
}

.site-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 28px;
    transition: transform var(--transition), box-shadow var(--transition);
    cursor: pointer;
}

.site-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.site-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
}

.site-card-info h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
}

.site-card-info .site-url {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Score Gauge */
.score-gauge {
    position: relative;
    width: 80px;
    height: 80px;
}

.score-gauge svg {
    transform: rotate(-90deg);
    width: 80px;
    height: 80px;
}

.score-gauge .gauge-bg {
    fill: none;
    stroke: var(--bg-primary);
    stroke-width: 6;
}

.score-gauge .gauge-fill {
    fill: none;
    stroke-width: 6;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s ease, stroke 0.5s ease;
}

.score-gauge .gauge-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 20px;
    font-weight: 700;
}

.score-high { color: var(--success); }
.score-medium { color: var(--warning); }
.score-low { color: var(--danger); }

.stroke-high { stroke: var(--success); }
.stroke-medium { stroke: var(--warning); }
.stroke-low { stroke: var(--danger); }
.stroke-none { stroke: var(--text-muted); }

.score-none { color: var(--text-muted); }

.site-card-no-audit {
    height: 40px;
    margin-top: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 13px;
    font-style: italic;
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-sm);
}

.site-card-subscores {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 8px;
    padding: 0 4px;
}

.site-card-info .site-type {
    display: inline-block;
    font-size: 11px;
    color: var(--text-muted);
    background: var(--bg-primary);
    padding: 2px 8px;
    border-radius: 10px;
    margin-top: 4px;
}

.site-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    font-size: 13px;
    color: var(--text-secondary);
}

.site-card-sparkline {
    height: 40px;
    margin-top: 12px;
}

.site-card-sparkline canvas {
    width: 100% !important;
    height: 40px !important;
}

/* Score chart (Phase 3) */
.site-card-chart {
    height: 80px;
    margin-top: 12px;
    position: relative;
}

.site-card-chart canvas {
    width: 100% !important;
    height: 80px !important;
}

/* Score delta indicator */
.score-gauge-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.score-delta {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
}

.score-delta.delta-up {
    color: var(--success);
    background: rgba(0, 200, 83, 0.15);
}

.score-delta.delta-down {
    color: var(--danger);
    background: rgba(255, 82, 82, 0.15);
}

/* Site card actions */
.site-card-actions {
    margin-top: 12px;
    display: flex;
    justify-content: flex-end;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 12px;
}

.btn-sm:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Status badge */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.status-badge.online {
    background: rgba(0, 200, 83, 0.15);
    color: var(--success);
}

.status-badge.online::before {
    background: var(--success);
}

.status-badge.offline {
    background: rgba(255, 82, 82, 0.15);
    color: var(--danger);
}

.status-badge.offline::before {
    background: var(--danger);
}

/* ============================================
   Chat Interface
   ============================================ */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px 32px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.chat-message {
    display: flex;
    gap: 12px;
    max-width: 75%;
    animation: messageIn 0.3s ease;
}

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

.chat-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-message.assistant {
    align-self: flex-start;
}

.message-avatar {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
}

.chat-message.user .message-avatar {
    background: var(--accent-blue);
    color: var(--accent-light);
}

.chat-message.assistant .message-avatar {
    background: var(--bg-primary);
    color: var(--accent-light);
    border: 1px solid var(--border-color);
}

.message-bubble {
    padding: 14px 18px;
    border-radius: var(--radius);
    font-size: 14px;
    line-height: 1.7;
    word-wrap: break-word;
}

.chat-message.user .message-bubble {
    background: var(--chat-user);
    border-bottom-right-radius: 4px;
}

.chat-message.assistant .message-bubble {
    background: var(--chat-assistant);
    border: 1px solid var(--border-color);
    border-bottom-left-radius: 4px;
}

/* Markdown in chat */
.message-bubble h1,
.message-bubble h2,
.message-bubble h3,
.message-bubble h4 {
    margin: 12px 0 8px;
    color: var(--text-primary);
}

.message-bubble h1 { font-size: 18px; }
.message-bubble h2 { font-size: 16px; }
.message-bubble h3 { font-size: 15px; }

.message-bubble p {
    margin-bottom: 8px;
}

.message-bubble p:last-child {
    margin-bottom: 0;
}

.message-bubble ul, .message-bubble ol {
    margin: 8px 0;
    padding-left: 20px;
}

.message-bubble li {
    margin-bottom: 4px;
}

.message-bubble code {
    background: var(--bg-primary);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
}

.message-bubble pre {
    background: var(--bg-primary);
    padding: 16px;
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin: 8px 0;
    border: 1px solid var(--border-color);
}

.message-bubble pre code {
    background: none;
    padding: 0;
    font-size: 13px;
    line-height: 1.5;
}

.message-bubble table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    font-size: 13px;
}

.message-bubble th,
.message-bubble td {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    text-align: left;
}

.message-bubble th {
    background: var(--bg-primary);
    font-weight: 600;
}

.message-bubble blockquote {
    border-left: 3px solid var(--accent-light);
    padding-left: 12px;
    margin: 8px 0;
    color: var(--text-secondary);
}

.message-bubble strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Typing indicator */
.typing-indicator {
    display: none;
    align-self: flex-start;
    gap: 12px;
    max-width: 75%;
}

.typing-indicator.visible {
    display: flex;
}

.typing-dots {
    background: var(--chat-assistant);
    border: 1px solid var(--border-color);
    padding: 14px 18px;
    border-radius: var(--radius);
    border-bottom-left-radius: 4px;
    display: flex;
    gap: 4px;
    align-items: center;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: typingBounce 1.4s infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-6px);
        opacity: 1;
    }
}

/* Chat input */
.chat-input-bar {
    padding: 16px 32px 24px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}

.chat-input-wrapper {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    max-width: 900px;
    margin: 0 auto;
}

.chat-input-wrapper textarea {
    flex: 1;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 14px 18px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: inherit;
    line-height: 1.5;
    resize: none;
    max-height: 150px;
    min-height: 48px;
    transition: border-color var(--transition);
}

.chat-input-wrapper textarea:focus {
    outline: none;
    border-color: var(--accent-light);
}

.chat-input-wrapper textarea::placeholder {
    color: var(--text-muted);
}

.btn-send {
    width: 48px;
    height: 48px;
    min-width: 48px;
    border-radius: var(--radius);
    background: var(--accent-blue);
    border: none;
    color: var(--accent-light);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.btn-send:hover {
    background: var(--accent-hover);
    transform: scale(1.05);
}

.btn-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Chat welcome */
.chat-welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.chat-welcome h2 {
    font-size: 24px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.chat-welcome p {
    font-size: 15px;
    max-width: 500px;
    line-height: 1.7;
}

.chat-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 24px;
    justify-content: center;
}

.chat-suggestions button {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
}

.chat-suggestions button:hover {
    background: var(--accent-blue);
    color: var(--text-primary);
    border-color: var(--accent-blue);
}

/* Score card in chat */
.score-card-inline {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 16px;
    margin: 8px 0;
    display: flex;
    align-items: center;
    gap: 16px;
}

.score-card-inline .score-value {
    font-size: 28px;
    font-weight: 700;
    min-width: 50px;
    text-align: center;
}

/* ============================================
   Loading & States
   ============================================ */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-light);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 40px auto;
}

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

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.empty-state h3 {
    font-size: 18px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 14px 20px;
    font-size: 14px;
    color: var(--text-primary);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    z-index: 1000;
    animation: toastIn 0.3s ease;
    max-width: 400px;
}

.toast.error {
    border-left: 3px solid var(--danger);
}

.toast.success {
    border-left: 3px solid var(--success);
}

.toast.info {
    border-left: 3px solid var(--info);
}

.toast.warning {
    border-left: 3px solid var(--warning);
}

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

/* ============================================
   Buttons
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    border: none;
    font-family: inherit;
}

.btn-primary {
    background: var(--accent-blue);
    color: var(--text-primary);
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-ghost {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--bg-input);
    color: var(--text-primary);
}

/* ============================================
   Section Headers
   ============================================ */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.section-header h2 {
    font-size: 20px;
    font-weight: 600;
}

/* ============================================
   Mobile Overlay
   ============================================ */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 99;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 1024px) {
    .sites-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    }
}

@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100%;
        transform: translateX(-100%);
        z-index: 200;
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay.visible {
        display: block;
    }

    .mobile-menu-btn {
        display: block;
    }

    .header {
        padding: 0 16px;
    }

    .content-area {
        padding: 20px 16px;
    }

    .chat-messages {
        padding: 16px;
    }

    .chat-input-bar {
        padding: 12px 16px 16px;
    }

    .chat-message {
        max-width: 90%;
    }

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

    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .stats-row {
        grid-template-columns: 1fr;
    }

    .site-card-header {
        flex-direction: column;
        gap: 16px;
    }

    .chat-suggestions {
        flex-direction: column;
    }
}

/* ============================================
   Site Selector (slash commands)
   ============================================ */

.site-selector {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
}

.site-select-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-primary, #1a1a2e);
    border: 1px solid var(--border-color, #2a2a4a);
    border-radius: 8px;
    color: var(--text-primary, #e0e0e0);
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
    font-size: 14px;
}

.site-select-btn:hover {
    background: var(--accent-blue, #0f3460);
    border-color: var(--accent-light, #4a9eff);
    transform: translateX(4px);
}

.site-select-name {
    font-weight: 600;
    min-width: 120px;
}

.site-select-url {
    color: var(--text-secondary, #888);
    flex: 1;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.site-select-score {
    font-weight: 700;
    color: var(--accent-light, #4a9eff);
    min-width: 50px;
    text-align: right;
}

/* ============================================
   Page load fade-in animation
   ============================================ */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.content-area,
.chat-container {
    animation: fadeInUp 0.4s ease-out;
}

/* Card hover lift effect */
.stat-card,
.site-card {
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

/* ============================================
   Active sidebar link - stronger highlight
   ============================================ */
.sidebar-nav a.active {
    background: var(--accent-blue);
    color: #fff;
    font-weight: 600;
    border-left: 3px solid var(--accent-light);
    position: relative;
}

.sidebar-nav a.active::after {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--accent-light);
    border-radius: 2px;
}

/* ============================================
   Audit progress indicator (chat)
   ============================================ */
.audit-progress {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 16px 20px;
    margin: 8px 0;
}

.audit-progress-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent-light);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.audit-progress-title .pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-light);
    animation: pulse 1.5s ease-in-out infinite;
}

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

.audit-progress-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-input);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 10px;
}

.audit-progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-light), var(--success));
    border-radius: 3px;
    transition: width 0.8s ease;
    width: 0%;
}

.audit-progress-bar-fill.indeterminate {
    width: 30%;
    animation: indeterminate 2s ease-in-out infinite;
}

@keyframes indeterminate {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(400%); }
}

.audit-progress-steps {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.audit-step {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
    transition: color 0.3s ease;
}

.audit-step.active {
    color: var(--accent-light);
    font-weight: 500;
}

.audit-step.done {
    color: var(--success);
}

.audit-step .step-icon {
    width: 16px;
    text-align: center;
    flex-shrink: 0;
}

.audit-step.active .step-icon::after {
    content: '';
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent-light);
    animation: pulse 1.5s ease-in-out infinite;
}

.audit-progress-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 8px;
    text-align: right;
}

/* ============================================
   Empty state with CTA
   ============================================ */
.empty-state-cta {
    margin-top: 20px;
}

.empty-state-cta .btn {
    font-size: 15px;
    padding: 12px 28px;
}

/* ============================================
   Report score badge
   ============================================ */
.report-score-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-weight: 700;
    font-size: 14px;
    color: #fff;
}

.report-score-badge.score-high { background: var(--success); }
.report-score-badge.score-medium { background: var(--warning); color: #1a1a2e; }
.report-score-badge.score-low { background: var(--danger); }

/* ============================================
   Page footer
   ============================================ */
.page-footer {
    padding: 16px 32px;
    border-top: 1px solid var(--border-color);
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    background: var(--bg-secondary);
    flex-shrink: 0;
}

/* ============================================
   Report card layout improvement
   ============================================ */
.report-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 12px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.report-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.report-card-info {
    flex: 1;
    min-width: 0;
}

.report-card-info h4 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 2px;
}

.report-card-info .report-card-url {
    font-size: 13px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.report-card-info .report-card-date {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.report-card-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* Dernier audit section on dashboard */
.last-audit-section {
    margin-bottom: 32px;
}

.last-audit-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.last-audit-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.last-audit-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.last-audit-card-info {
    flex: 1;
    min-width: 0;
}

.last-audit-card-info h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.last-audit-card-info .audit-date {
    font-size: 12px;
    color: var(--text-muted);
}

/* ============================================
   Additional mobile responsive fixes
   ============================================ */
@media (max-width: 768px) {
    .report-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .report-card-actions {
        width: 100%;
    }

    .report-card-actions .btn-sm {
        flex: 1;
        text-align: center;
        justify-content: center;
    }

    .last-audit-cards {
        grid-template-columns: 1fr;
    }

    .page-footer {
        padding: 12px 16px;
    }

    .audit-progress {
        padding: 12px 14px;
    }
}

@media (max-width: 480px) {
    .last-audit-card {
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
    }
}

/* ============================================
   Audit Progress Overlay (dashboard)
   ============================================ */
.audit-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: auditFadeIn 0.2s ease;
}

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

.audit-overlay-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 28px 32px;
    width: 440px;
    max-width: 92vw;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.audit-overlay-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--accent-light);
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pulse-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-light);
    flex-shrink: 0;
    animation: pulse 1.5s ease-in-out infinite;
}

.audit-overlay-url {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 20px;
}

.audit-overlay-bar-wrap {
    height: 6px;
    background: var(--bg-input);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 18px;
}

.audit-overlay-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-light), var(--success));
    border-radius: 3px;
    transition: width 0.9s ease;
    width: 5%;
}

.audit-overlay-steps {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 14px;
}

.audit-overlay-step {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text-muted);
    transition: color 0.3s ease;
}

.audit-overlay-step.active {
    color: var(--text-primary);
    font-weight: 500;
}

.audit-overlay-step.done {
    color: var(--success);
}

.audit-overlay-step .step-icon {
    width: 18px;
    text-align: center;
    flex-shrink: 0;
    font-size: 11px;
}

.audit-overlay-step.active .step-icon {
    position: relative;
}

.audit-overlay-step.active .step-icon::after {
    content: '';
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent-light);
    animation: pulse 1.5s ease-in-out infinite;
}

.audit-overlay-time {
    font-size: 11px;
    color: var(--text-muted);
    text-align: right;
}
