* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Hanken Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f3f4f6;
    min-height: 100vh;
    color: #1f2937;
    line-height: 1.6;
}

/* Header */
.header {
    background: var(--color-primary, #060A27);
    padding: 20px 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 20px;
}

.aifi-logo {
    height: 45px;
    width: auto;
    max-width: 200px;
    object-fit: contain;
}

.report-title {
    text-align: center;
    color: #ffffff;
    font-size: 1.25rem;
    font-weight: 600;
    flex: 1;
}

.user-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-email {
    color: #ffffff;
    font-size: 0.875rem;
}

.logout-btn {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Login Section */
.login-section {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 80px);
    padding: 40px 20px;
}

.login-container {
    background: #ffffff;
    border-radius: 8px;
    padding: 40px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    max-width: 400px;
    width: 100%;
}

.login-container h2 {
    margin-bottom: 24px;
    color: #1f2937;
    text-align: center;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #1f2937;
    font-weight: 500;
    font-size: 0.875rem;
}

.form-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 0.875rem;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: var(--color-secondary, #22c55e);
}

.login-btn {
    width: 100%;
    padding: 12px;
    background: var(--color-primary, #060A27);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.login-btn:hover {
    opacity: 0.9;
}

.login-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.error-message {
    margin-top: 16px;
    padding: 12px;
    background: #fee2e2;
    color: #991b1b;
    border-radius: 6px;
    font-size: 0.875rem;
}

/* Loading */
.loading-container {
    text-align: center;
    padding: 60px 20px;
}

.spinner {
    border: 4px solid #f3f4f6;
    border-top: 4px solid var(--color-secondary, #22c55e);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Main Content */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}

.metric-card {
    background: #ffffff;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s ease;
}

.metric-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.metric-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.metric-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: #6b7280;
    display: flex;
    align-items: center;
    gap: 6px;
}

.info-icon {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #e5e7eb;
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: help;
}

.metric-number {
    font-size: 2.5rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 8px;
}

.metric-change {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 0.875rem;
    font-weight: 500;
}

.metric-change.positive {
    color: #22c55e;
}

.metric-change.negative {
    color: #ef4444;
}

.metric-change.neutral {
    color: #6b7280;
}

.arrow-up::before {
    content: '↑';
}

.arrow-down::before {
    content: '↓';
}

.dashboard-section {
    background: #ffffff;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

.section-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 20px;
}

.protocol-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
}

.protocol-step-card {
    background: #f9fafb;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    border: 1px solid #e5e7eb;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s ease;
}

.protocol-step-card.visible {
    opacity: 1;
    transform: translateY(0);
}

.protocol-step-card.completed {
    border-left: 4px solid #22c55e;
}

.protocol-step-card.partial {
    border-left: 4px solid #f59e0b;
}

.protocol-step-card.missing {
    border-left: 4px solid #ef4444;
}

.step-name {
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 12px;
    font-size: 0.875rem;
}

.step-score {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 8px;
}

.step-score.completed { color: #22c55e; }
.step-score.partial { color: #f59e0b; }
.step-score.missing { color: #ef4444; }

.step-count {
    font-size: 0.75rem;
    color: #6b7280;
    margin-bottom: 8px;
}

.step-description {
    font-size: 0.75rem;
    color: #6b7280;
}

.interactions-section {
    background: #ffffff;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

.search-bar {
    margin-bottom: 20px;
}

.search-input {
    width: 100%;
    max-width: 400px;
    padding: 10px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 0.875rem;
    color: #1f2937;
    transition: border-color 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: var(--color-secondary, #22c55e);
}

.search-input::placeholder {
    color: #9ca3af;
}

.interaction-card {
    background: #ffffff;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 16px;
    border: 1px solid #e5e7eb;
    transition: all 0.2s;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.6s ease forwards;
}

.interaction-card.visible {
    opacity: 1;
    transform: translateY(0);
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.interaction-card:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.interaction-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.interaction-date {
    color: #6b7280;
    font-size: 0.875rem;
    font-weight: 500;
}

.interaction-metrics {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.metric-badge {
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.metric-badge.score-high {
    background: #dcfce7;
    color: #166534;
}

.metric-badge.score-medium {
    background: #fef3c7;
    color: #92400e;
}

.metric-badge.score-low {
    background: #fee2e2;
    color: #991b1b;
}

.client-info {
    margin-bottom: 16px;
}

.client-name {
    font-weight: 600;
    color: #1f2937;
    font-size: 1rem;
    margin-bottom: 4px;
}

.client-email {
    color: #6b7280;
    font-size: 0.875rem;
}

.retail-analysis {
    margin-bottom: 20px;
}

.content-title {
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 8px;
    font-size: 0.875rem;
}

.analysis-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.analysis-item {
    background: #f9fafb;
    border-radius: 6px;
    padding: 12px;
    border: 1px solid #e5e7eb;
}

.analysis-label {
    font-weight: 600;
    color: #1f2937;
    font-size: 0.875rem;
    margin-bottom: 8px;
}

.analysis-value {
    color: #4b5563;
    font-size: 0.8125rem;
    line-height: 1.5;
}

.content-text {
    color: #4b5563;
    line-height: 1.6;
    margin-bottom: 12px;
    font-size: 0.875rem;
}

.interaction-content {
    margin-top: 16px;
}

.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e5e7eb;
    flex-wrap: wrap;
    gap: 16px;
}

.results-per-page {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: #6b7280;
}

.results-select {
    padding: 6px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 0.875rem;
    color: #1f2937;
    background: #ffffff;
    cursor: pointer;
}

#pagination-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.pagination-btn {
    padding: 6px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    background: #ffffff;
    color: #1f2937;
    cursor: pointer;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.pagination-btn:hover:not(:disabled) {
    background: #f9fafb;
    border-color: #d1d5db;
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-info {
    font-size: 0.875rem;
    color: #6b7280;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
}

.empty-state p {
    font-size: 1rem;
    margin-top: 16px;
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 16px;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
    }

    .protocol-grid {
        grid-template-columns: 1fr;
    }

    .analysis-grid {
        grid-template-columns: 1fr;
    }

    .interaction-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .pagination {
        flex-direction: column;
        align-items: stretch;
    }
}
