* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #ffffff;
    background-image: 
        linear-gradient(45deg, #f9f9f9 25%, transparent 25%),
        linear-gradient(-45deg, #f9f9f9 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #f9f9f9 75%),
        linear-gradient(-45deg, transparent 75%, #f9f9f9 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    min-height: 100vh;
    color: #333;
}

/* Login Page Styles */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-box {
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.1), 0 0 0 1px rgba(255, 107, 53, 0.1);
    padding: 40px;
    width: 100%;
    max-width: 450px;
}

.logo h1 {
    text-align: center;
    color: #ff6b35;
    margin-bottom: 30px;
    font-size: 28px;
}

.form-step {
    display: none;
}

.form-step.active {
    display: block;
    animation: fadeIn 0.3s ease-in;
}

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

h2 {
    color: #333;
    margin-bottom: 10px;
    font-size: 24px;
}

.subtitle {
    color: #666;
    margin-bottom: 25px;
    font-size: 14px;
}

.form-group {
    margin-bottom: 20px;
}

.form-step .btn {
    width: 100%;
}

label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
    font-size: 14px;
}

input[type="text"],
input[type="email"],
input[type="password"] {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s ease;
}

input:focus {
    outline: none;
    border-color: #ff6b35;
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.btn {
    padding: 14px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 10px;
}

.btn-primary {
    background: linear-gradient(135deg, #ff8c42 0%, #ff6b35 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 107, 53, 0.3);
}

.btn-primary:hover {
    background: linear-gradient(135deg, #ff9d5c 0%, #ff7b45 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 53, 0.4);
}

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

.btn-secondary {
    background: #f5f5f5;
    color: #666;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.error-message {
    background: #ffebee;
    color: #c62828;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 15px;
    border-left: 4px solid #c62828;
    font-size: 14px;
}

.dev-info {
    background: #fff3cd;
    color: #856404;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 15px;
    border-left: 4px solid #ffc107;
    font-size: 13px;
}

/* Dashboard Styles */
.dashboard-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background: #f8f9fa;
}

/* Sidebar Styles */
.sidebar {
    position: fixed;
    left: 0;
    top: 72px; /* Height of navbar */
    width: 240px;
    height: calc(100vh - 72px);
    background: white;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.05);
    z-index: 100;
    overflow-y: auto;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    padding: 20px 0;
}

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 24px;
    color: #666;
    text-decoration: none;
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 15px;
    border-left: 3px solid transparent;
}

.sidebar-item svg {
    flex-shrink: 0;
}

.sidebar-item:hover {
    background: #f8f9fa;
    color: #ff6b35;
}

.sidebar-item.active {
    color: #ff6b35;
    background: #fff5f2;
    border-left-color: #ff6b35;
}

.sidebar-item.active svg {
    stroke: #ff6b35;
}

/* Dashboard Container with Sidebar */
.dashboard-container {
    margin-left: 240px; /* Width of sidebar */
    min-height: calc(100vh - 72px);
    background: #f8f9fa;
    padding-top: 72px; /* Height of navbar */
}

.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 16px 0;
}

.nav-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-left h1 {
    color: #ff6b35;
    font-size: 24px;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* User Menu Dropdown */
.user-menu {
    position: relative;
}

.user-menu-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #333;
}

.user-menu-button:hover {
    border-color: #ff6b35;
    background: #fff5f2;
}

.user-menu-button svg {
    color: #ff6b35;
}

.customer-name-button {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    text-transform: capitalize;
}

.menu-icon {
    transition: transform 0.3s ease;
}

.user-menu-button:hover .menu-icon {
    transform: rotate(180deg);
}

.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    min-width: 280px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
}

.user-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-dropdown-header {
    padding: 15px;
    background: #f9f9f9;
    border-radius: 8px 8px 0 0;
}

.customer-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.customer-logo {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    object-fit: cover;
    border: 2px solid #e0e0e0;
}

.customer-logo-placeholder {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background: linear-gradient(135deg, #ff8c42 0%, #ff6b35 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #ff6b35;
}

.customer-logo-placeholder span {
    color: white;
    font-size: 20px;
    font-weight: 700;
}

.customer-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.customer-name {
    font-weight: 700;
    color: #333;
    font-size: 15px;
    text-transform: capitalize;
}

.user-email {
    font-size: 13px;
    color: #666;
    word-break: break-all;
}

.user-dropdown-divider {
    height: 1px;
    background: #e0e0e0;
    margin: 0;
}

.user-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 15px;
    color: #dc3545;
    text-decoration: none;
    transition: background 0.2s ease;
    font-size: 14px;
    font-weight: 500;
}

.user-dropdown-item:hover {
    background: #fff5f5;
}

.user-dropdown-item svg {
    flex-shrink: 0;
}

.btn-logout {
    padding: 8px 20px;
    background: #dc3545;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
}

.btn-logout:hover {
    background: #c82333;
}

.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* View Sections */
.view-section {
    display: none;
}

.view-section.active {
    display: block;
}

.welcome-section {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.welcome-section h2 {
    color: #333;
    margin-bottom: 10px;
}

.welcome-section p {
    color: #666;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 20px;
}

.stat-icon {
    font-size: 40px;
}

.stat-content h3 {
    color: #666;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 5px;
}

.stat-number {
    color: #333;
    font-size: 28px;
    font-weight: 700;
}

.content-section {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.content-section h3 {
    color: #333;
    margin-bottom: 20px;
}

.placeholder-text {
    color: #666;
    margin-bottom: 15px;
    line-height: 1.6;
}

code {
    background: #f5f5f5;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    color: #667eea;
}

.error-box {
    background: #ffebee;
    color: #c62828;
    padding: 15px;
    border-radius: 8px;
    margin: 20px 0;
    border-left: 4px solid #c62828;
}

.action-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

.action-buttons .btn {
    width: auto;
    padding: 12px 24px;
}

#dataContainer {
    overflow-x: auto;
}

/* Filters Section */
.filters-section {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.filters-section h3 {
    margin-bottom: 20px;
    color: #333;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    align-items: end;
}

.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-group label {
    margin-bottom: 8px;
    color: #666;
    font-size: 14px;
    font-weight: 500;
}

.filter-select,
.filter-input {
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.3s ease;
    background: white;
}

.filter-select:focus,
.filter-input:focus {
    outline: none;
    border-color: #ff6b35;
    box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.1);
}

.filter-actions {
    display: flex;
    gap: 10px;
}

.filter-actions .btn {
    flex: 1;
    margin: 0;
}

/* Metrics Section */
.metrics-section {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.metrics-section h3 {
    margin-bottom: 20px;
    color: #333;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.metric-card {
    background: white;
    padding: 25px;
    border-radius: 12px;
    color: #333;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    border: 1px solid #e0e0e0;
}

.metric-label {
    font-size: 14px;
    color: #666;
    margin-bottom: 10px;
    font-weight: 500;
}

.metric-value {
    font-size: 36px;
    font-weight: 700;
    color: #ff6b35;
}

.metric-delta {
    font-size: 14px;
    font-weight: 600;
    margin-top: 10px;
    padding: 6px 12px;
    border-radius: 6px;
    display: inline-block;
    min-height: 28px;
}

.metric-delta.positive {
    background-color: rgba(16, 185, 129, 0.2);
    color: #10b981;
}

.metric-delta.negative {
    background-color: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.metric-delta::before {
    margin-right: 4px;
    font-weight: bold;
}

.metric-delta.positive::before {
    content: '\25B2'; /* Up arrow */
}

.metric-delta.negative::before {
    content: '\25BC'; /* Down arrow */
}

/* Platform Metrics Section */
.platform-metrics-section {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.platform-title {
    font-size: 24px;
    font-weight: 700;
    color: #ff6b35;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e0e0e0;
}

.platform-chart-container {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.platform-chart-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 15px;
}

/* Charts Section */
.charts-section {
    margin-bottom: 30px;
}

.chart-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.chart-container {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.chart-container h3 {
    margin-bottom: 20px;
    color: #333;
    font-size: 18px;
}

.chart-container canvas {
    max-height: 300px;
}

.chart-container.chart-full-width {
    grid-column: 1 / -1;
}

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

.chart-title-section h3 {
    margin: 0 0 5px 0;
}

.chart-subtext {
    color: #666;
    font-size: 13px;
    margin: 0;
    font-style: italic;
}

.section-insight {
    color: #666;
    font-size: 14px;
    margin: 8px 0 20px 0;
    padding: 12px 16px;
    background: #f9f9f9;
    border-left: 3px solid #ff6b35;
    border-radius: 4px;
    font-style: italic;
    line-height: 1.5;
}

.chart-controls {
    display: flex;
    gap: 15px;
    align-items: center;
}

/* Toggle Switch */
.toggle-switch {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.toggle-switch input[type="checkbox"] {
    display: none;
}

.toggle-slider {
    position: relative;
    width: 44px;
    height: 24px;
    background-color: #ccc;
    border-radius: 24px;
    transition: background-color 0.3s ease;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background-color: white;
    top: 3px;
    left: 3px;
    transition: transform 0.3s ease;
}

.toggle-switch input[type="checkbox"]:checked + .toggle-slider {
    background-color: #ff6b35;
}

.toggle-switch input[type="checkbox"]:checked + .toggle-slider::before {
    transform: translateX(20px);
}

.toggle-label {
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

/* Visibility Ranking Table */
.ranking-table-container {
    margin-top: 20px;
    overflow-x: auto;
}

.ranking-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: white;
}

.ranking-table thead {
    background: #f5f7fa;
}

.ranking-table th {
    padding: 15px 20px;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #e0e0e0;
    font-size: 14px;
}

.ranking-table th:first-child {
    width: 80px;
    text-align: center;
}

.ranking-table th:last-child {
    width: 150px;
    text-align: center;
}

.ranking-table td {
    padding: 18px 20px;
    border-bottom: 1px solid #f0f0f0;
    color: #666;
    font-size: 14px;
    vertical-align: middle;
}

.ranking-table tbody tr:hover {
    background: #fafafa;
    transition: background 0.2s ease;
}

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

.rank-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 18px;
}

.rank-number.rank-1 {
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: white;
}

.rank-number.rank-2 {
    background: linear-gradient(135deg, #C0C0C0 0%, #A0A0A0 100%);
    color: white;
}

.rank-number.rank-3 {
    background: linear-gradient(135deg, #CD7F32 0%, #B8722C 100%);
    color: white;
}

.rank-number.rank-other {
    background: #f5f5f5;
    color: #666;
}

.brand-name {
    font-weight: 600;
    color: #333;
    font-size: 15px;
}

.brand-name.is-customer {
    color: #ff6b35;
    font-weight: 700;
}

.visibility-share {
    font-weight: 600;
    color: #333;
    font-size: 16px;
}

.rank-change {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 13px;
}

.rank-change.improved {
    background-color: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.rank-change.declined {
    background-color: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.rank-change.no-change {
    background-color: #f5f5f5;
    color: #999;
}

.rank-change.new-entry {
    background-color: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.rank-change-arrow {
    font-size: 14px;
    font-weight: bold;
}

/* Latest Mentions List */
.mentions-list {
    max-height: 300px;
    overflow-y: auto;
}

.mention-item {
    padding: 15px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background 0.2s ease;
}

.mention-item:hover {
    background: #f9f9f9;
}

.mention-item:last-child {
    border-bottom: none;
}

.mention-timestamp {
    font-size: 12px;
    color: #999;
    margin-bottom: 5px;
}

.mention-prompt {
    color: #333;
    font-size: 14px;
    line-height: 1.5;
}

.mention-platform {
    display: inline-block;
    background: #ff6b35;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    margin-top: 5px;
}

.loading-state {
    text-align: center;
    padding: 40px;
    color: #999;
    font-style: italic;
}

/* Table Section */
.table-section {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

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

.table-header h3 {
    margin: 0;
    color: #333;
}

.table-controls {
    margin-bottom: 20px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 8px;
}

.column-filters {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

/* Compact button styles for table controls */
.table-header .btn,
.column-filters .btn {
    width: auto;
    padding: 6px 12px;
    font-size: 13px;
    border-radius: 4px;
    white-space: nowrap;
    margin-bottom: 0;
}

.table-header .btn-primary,
.column-filters .btn-primary {
    box-shadow: 0 2px 6px rgba(255, 107, 53, 0.2);
}

.table-header .btn-primary:hover,
.column-filters .btn-primary:hover {
    box-shadow: 0 3px 8px rgba(255, 107, 53, 0.3);
}

.table-search {
    flex: 0 1 auto;
    max-width: 250px;
    min-width: 150px;
    padding: 6px 10px;
    border: 1px solid #d0d0d0;
    border-radius: 4px;
    font-size: 13px;
    transition: border-color 0.2s ease;
}

.table-search:focus {
    outline: none;
    border-color: #ff6b35;
}

.table-responsive {
    overflow-x: auto;
    margin-bottom: 20px;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table thead {
    background: #f5f7fa;
    position: sticky;
    top: 0;
    z-index: 1;
}

.data-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #333;
    border-bottom: 2px solid #ddd;
}

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

.data-table th.sortable:hover {
    background: #e8ecf1;
}

.sort-indicator {
    color: #ff6b35;
    font-size: 12px;
    margin-left: 5px;
}

.data-table td {
    padding: 12px;
    border-bottom: 1px solid #eee;
    color: #666;
}

.data-table tbody tr:hover {
    background: #f9f9f9;
}

.prompt-cell {
    max-width: 400px;
    cursor: pointer;
    color: #ff6b35;
}

.prompt-cell:hover {
    text-decoration: underline;
}

.sentiment-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: capitalize;
}

.sentiment-positive {
    background: #d4edda;
    color: #155724;
}

.sentiment-negative {
    background: #f8d7da;
    color: #721c24;
}

.sentiment-neutral {
    background: #d1ecf1;
    color: #0c5460;
}

.rank-badge {
    display: inline-block;
    background: #ff6b35;
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-yes {
    background-color: #10b981 !important;
    color: white !important;
}

.status-no {
    background-color: #6b7280 !important;
    color: white !important;
}

.citations-link {
    color: #ff6b35;
    cursor: pointer;
    text-decoration: underline;
}

.citations-link:hover {
    color: #ff8c42;
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-top: 20px;
}

.pagination button {
    padding: 8px 12px;
    border: 1px solid #ddd;
    background: white;
    cursor: pointer;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.pagination button:hover:not(:disabled) {
    background: #ff6b35;
    color: white;
    border-color: #ff6b35;
}

.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination button.active {
    background: #ff6b35;
    color: white;
    border-color: #ff6b35;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
    animation: fadeIn 0.3s ease;
}

.modal.show {
    display: block;
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 12px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow: hidden;
    animation: slideDown 0.3s ease;
}

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

.modal-header {
    padding: 20px 25px;
    background: linear-gradient(135deg, #ff8c42 0%, #ff6b35 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
    color: white;
}

.close {
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close:hover {
    opacity: 0.8;
}

.modal-body {
    padding: 25px;
    max-height: calc(80vh - 80px);
    overflow-y: auto;
}

.modal-section {
    margin-bottom: 25px;
}

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

.modal-section h4 {
    color: #333;
    margin-bottom: 10px;
    font-size: 16px;
}

.modal-section p {
    color: #666;
    line-height: 1.6;
    margin: 0;
}

.citation-item {
    padding: 10px;
    background: #f5f7fa;
    border-radius: 6px;
    margin-bottom: 8px;
}

.citation-item:last-child {
    margin-bottom: 0;
}

.citation-item a {
    color: #ff6b35;
    word-break: break-all;
}

.metadata-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.metadata-section:last-child {
    border-bottom: none;
}

.metadata-section h5 {
    color: #ff6b35;
    margin-bottom: 15px;
    font-size: 16px;
    font-weight: 600;
}

.metadata-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.metadata-item {
    background: #f5f7fa;
    padding: 12px;
    border-radius: 6px;
}

.metadata-item.full-width {
    grid-column: 1 / -1;
}

.metadata-label {
    font-size: 12px;
    color: #999;
    margin-bottom: 5px;
    font-weight: 600;
    text-transform: uppercase;
}

.metadata-value {
    font-size: 14px;
    color: #333;
    font-weight: 500;
    line-height: 1.6;
    word-wrap: break-word;
}

.citation-number {
    display: inline-block;
    background: #ff6b35;
    color: white;
    width: 24px;
    height: 24px;
    text-align: center;
    line-height: 24px;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 600;
    margin-right: 10px;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .chart-row {
        grid-template-columns: 1fr;
    }

    .table-header .btn,
    .column-filters .btn {
        padding: 6px 10px;
        font-size: 12px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        width: 60px;
    }

    .sidebar-item span {
        display: none;
    }

    .sidebar-item {
        justify-content: center;
        padding: 14px;
    }

    .dashboard-container {
        margin-left: 60px;
    }

    .nav-left h1 {
        font-size: 18px;
    }

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

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

    .filter-actions {
        flex-direction: column;
    }

    .filter-actions .btn {
        width: 100%;
    }

    .table-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }

    .table-header .btn {
        width: 100%;
        padding: 8px 12px;
    }

    .column-filters {
        gap: 8px;
    }

    .column-filters .btn {
        flex: 1;
        min-width: 70px;
        padding: 7px 10px;
        font-size: 12px;
    }

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

    .modal-content {
        width: 95%;
        margin: 10% auto;
    }

    .chart-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .chart-controls {
        width: 100%;
    }
}

/* Action Items Section */
.action-items-section {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

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

.action-items-header h3 {
    margin-bottom: 5px;
    color: #333;
}

.action-items-stats {
    display: flex;
    align-items: center;
    gap: 10px;
}

.action-items-badge {
    background: #ff6b35;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 16px;
    min-width: 50px;
    text-align: center;
}

.action-items-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.action-items-table thead {
    background: #f8f9fa;
}

.action-items-table th,
.action-items-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

.action-items-table th {
    font-weight: 600;
    color: #666;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.action-items-table tbody tr:hover {
    background: #f9f9f9;
}

.action-items-table tbody tr:last-child td {
    border-bottom: none;
}

.status-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.status-negative {
    background: #ffebee;
    color: #c62828;
}

.status-not-mentioned {
    background: #fff3e0;
    color: #e65100;
}

.citation-link {
    color: #1976d2;
    text-decoration: none;
    display: block;
    margin: 3px 0;
    font-size: 12px;
}

.citation-link:hover {
    text-decoration: underline;
}

.prompt-text {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.citation-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.citation-item-wrapper {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    background: #f9f9f9;
    border-radius: 6px;
    border-left: 3px solid #ff6b35;
}

.citation-link {
    color: #ff6b35;
    text-decoration: none;
    font-weight: 600;
    font-size: 13px;
}

.citation-link:hover {
    text-decoration: underline;
}

.citation-url {
    color: #666;
    text-decoration: none;
    font-size: 11px;
    word-break: break-all;
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.citation-url:hover {
    color: #ff6b35;
    text-decoration: underline;
    white-space: normal;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 10px;
}

.empty-state-text {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 5px;
}

.empty-state-subtext {
    font-size: 14px;
    color: #bbb;
}

/* Low Sentiment Themes Section */
.low-sentiment-section {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.low-sentiment-header {
    margin-bottom: 20px;
}

.low-sentiment-header h3 {
    margin-bottom: 5px;
    color: #333;
}

.low-sentiment-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.theme-item {
    display: flex;
    align-items: center;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 8px;
    border-left: 4px solid #f44336;
    transition: all 0.2s ease;
}

.theme-item:hover {
    background: #f5f5f5;
    transform: translateX(3px);
}

.theme-item.collapsed {
    display: none;
}

.theme-rank {
    font-size: 24px;
    font-weight: bold;
    color: #999;
    min-width: 40px;
    text-align: center;
}

.theme-content {
    flex: 1;
    margin: 0 20px;
}

.theme-name {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.theme-stats {
    font-size: 13px;
    color: #666;
}

.theme-sentiment-bar {
    width: 200px;
    height: 30px;
    background: #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.sentiment-fill {
    height: 100%;
    background: linear-gradient(90deg, #f44336, #ff9800);
    transition: width 0.3s ease;
}

.sentiment-label {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    font-size: 12px;
    font-weight: bold;
    pointer-events: none;
}

.expand-button {
    width: 100%;
    padding: 12px;
    margin-top: 15px;
    background: #f5f5f5;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    color: #666;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.expand-button:hover {
    background: #ebebeb;
    border-color: #d0d0d0;
}

.expand-button.expanded {
    background: #fff;
    color: #ff6b35;
    border-color: #ff6b35;
}

/* Low Rank Domains Section */
.low-rank-domains-section {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
}

.low-rank-domains-header {
    margin-bottom: 20px;
}

.low-rank-domains-header h3 {
    margin-bottom: 5px;
    color: #333;
}

.low-rank-domains-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.domain-rank-card {
    background: #f9f9f9;
    border-radius: 10px;
    padding: 20px;
    border-left: 4px solid #ff6b35;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.domain-rank-card:hover {
    background: #f5f5f5;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.domain-rank-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.domain-name-large {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    word-break: break-all;
}

.rank-badge-large {
    background: linear-gradient(135deg, #ff6b35, #ff8c61);
    color: white;
    padding: 8px 14px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 14px;
    white-space: nowrap;
}

.domain-rank-stats {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 13px;
    color: #666;
}

.domain-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid #e0e0e0;
}

.domain-stat-row:last-child {
    border-bottom: none;
}

.stat-label {
    color: #888;
    font-size: 12px;
}

.stat-value {
    font-weight: 600;
    color: #333;
}

.empty-domains-message {
    text-align: center;
    padding: 40px 20px;
    color: #999;
    font-size: 14px;
}

/* Configuration View Styles */
.config-container {
    padding: 20px 0;
}

.config-details {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.config-section {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 8px;
    border-left: 4px solid #ff6b35;
}

.config-section-title {
    font-size: 16px;
    font-weight: 600;
    color: #ff6b35;
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.config-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #e0e0e0;
}

.config-item:last-child {
    border-bottom: none;
}

.config-label {
    font-weight: 600;
    color: #666;
    min-width: 180px;
}

.config-value {
    color: #333;
    font-weight: 500;
}

.competitors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
    margin-top: 8px;
}

.competitor-badge {
    background: white;
    padding: 12px 16px;
    border-radius: 6px;
    border: 2px solid #ff6b35;
    color: #ff6b35;
    font-weight: 600;
    text-align: center;
    transition: all 0.2s ease;
}

.competitor-badge:hover {
    background: #ff6b35;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(255, 107, 53, 0.2);
}

.platforms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-top: 8px;
}

.platform-status {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 6px;
    background: white;
    border: 2px solid #e0e0e0;
    transition: all 0.2s ease;
}

.platform-status.enabled {
    border-color: #4CAF50;
    background: #f1f8f4;
}

.platform-status.disabled {
    border-color: #e0e0e0;
    background: #f9f9f9;
    opacity: 0.6;
}

.platform-icon {
    font-size: 18px;
    font-weight: bold;
}

.platform-status.enabled .platform-icon {
    color: #4CAF50;
}

.platform-status.disabled .platform-icon {
    color: #999;
}

.platform-name {
    font-weight: 600;
    color: #333;
    font-size: 13px;
}

.platform-status.disabled .platform-name {
    color: #999;
}

.error-message,
.error-state {
    text-align: center;
    padding: 20px;
    color: #f44336;
    font-size: 14px;
}

.empty-state {
    text-align: center;
    padding: 20px;
    color: #999;
    font-style: italic;
}

/* Response Viewer Modal Styles */
.modal-large {
    max-width: 900px;
    width: 90%;
}

.btn-view-response {
    background: linear-gradient(135deg, #ff6b35 0%, #ff8c5a 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-view-response:hover {
    background: linear-gradient(135deg, #ff5520 0%, #ff7645 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 107, 53, 0.3);
}

.btn-view-response:active {
    transform: translateY(0);
}

.response-prompt-text {
    background: #f5f7fa;
    padding: 15px;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    border-left: 4px solid #ff6b35;
}

.response-metadata {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    padding: 12px;
    background: #f9fafb;
    border-radius: 8px;
    margin-bottom: 10px;
}

.metadata-item {
    font-size: 13px;
    color: #555;
}

.metadata-item strong {
    color: #333;
    margin-right: 6px;
}

.response-text-content {
    background: #ffffff;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    font-size: 14px;
    line-height: 1.8;
    color: #333;
    max-height: 500px;
    overflow-y: auto;
}

.response-text-content p {
    margin-bottom: 12px;
}

.response-citations-list {
    margin-top: 10px;
}

.response-citations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 12px;
}

.response-citation-card {
    display: flex;
    gap: 12px;
    padding: 12px;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    transition: all 0.2s ease;
}

.response-citation-card:hover {
    border-color: #ff6b35;
    box-shadow: 0 2px 8px rgba(255, 107, 53, 0.15);
}

.citation-number {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    background: #ff6b35;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
}

.citation-details {
    flex: 1;
    min-width: 0;
}

.citation-domain {
    font-weight: 600;
    color: #333;
    font-size: 13px;
    margin-bottom: 4px;
}

.citation-full-url {
    font-size: 12px;
    color: #666;
    text-decoration: none;
    word-break: break-all;
    display: block;
}

.citation-full-url:hover {
    color: #ff6b35;
    text-decoration: underline;
}

.analysis-tip {
    background: linear-gradient(135deg, #fff5f0 0%, #ffebe0 100%);
    border: 1px solid #ffd4c1;
    border-radius: 8px;
    padding: 16px;
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.tip-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.tip-content {
    flex: 1;
    font-size: 13px;
    color: #555;
    line-height: 1.6;
}

.tip-content strong {
    color: #ff6b35;
    font-size: 14px;
    display: block;
    margin-bottom: 8px;
}

.tip-content ul {
    margin-top: 8px;
    padding-left: 20px;
}

.tip-content li {
    margin-bottom: 6px;
    color: #666;
}

/* Metadata Table Styles for Response Details Modal */
.metadata-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
}

.metadata-table tbody tr {
    border-bottom: 1px solid #f0f0f0;
}

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

.metadata-table tbody tr:hover {
    background: #fafafa;
}

.metadata-table td {
    padding: 12px 16px;
    vertical-align: top;
}

.metadata-table .metadata-label {
    width: 35%;
    font-weight: 600;
    color: #333;
    background: #f9f9f9;
    font-size: 13px;
    text-transform: none;
    letter-spacing: normal;
}

.metadata-table .metadata-value {
    width: 65%;
    color: #555;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.6;
    word-wrap: break-word;
}

.metadata-table .full-width-cell {
    width: 100%;
    padding: 14px 16px;
}

.metadata-table .sentiment-details-cell {
    max-height: 150px;
    overflow-y: auto;
    padding: 10px;
    background: #fafafa;
    border-radius: 4px;
}

.metadata-section h5 {
    color: #ff6b35;
    margin-bottom: 12px;
    margin-top: 0;
    font-size: 16px;
    font-weight: 600;
    padding-bottom: 8px;
    border-bottom: 2px solid #ffe8df;
}

.status-indicator {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-indicator.status-yes {
    background-color: #10b981;
    color: white;
}

.status-indicator.status-no {
    background-color: #6b7280;
    color: white;
}

/* Competitor mention badges in table */
.metadata-table .competitor-mention-badge {
    display: inline-block;
    background: #fff3e0;
    color: #e65100;
    padding: 4px 10px;
    border-radius: 12px;
    margin: 2px;
    font-size: 12px;
    font-weight: 500;
}

/* Sentiment score styling in table */
.metadata-table .sentiment-score {
    font-weight: 600;
    font-size: 14px;
}

.metadata-table .sentiment-score.positive {
    color: #10b981;
}

.metadata-table .sentiment-score.negative {
    color: #ef4444;
}

.metadata-table .sentiment-score.neutral {
    color: #6b7280;
}

/* Scrollbar styling for sentiment details */
.sentiment-details-cell::-webkit-scrollbar {
    width: 6px;
}

.sentiment-details-cell::-webkit-scrollbar-track {
    background: #f0f0f0;
    border-radius: 3px;
}

.sentiment-details-cell::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.sentiment-details-cell::-webkit-scrollbar-thumb:hover {
    background: #aaa;
}

/* Domain Citations Modal Styles */
.domain-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.domain-summary-card {
    background: #f9fafb;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    text-align: center;
}

.summary-label {
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    margin-bottom: 10px;
}

.summary-value {
    font-size: 24px;
    font-weight: 700;
    color: #ff6b35;
}

.domain-summary-card:nth-child(4) .summary-value {
    font-size: 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
}

.domain-citations-table tbody tr {
    cursor: pointer;
    transition: background 0.2s ease;
}

.domain-citations-table tbody tr:hover {
    background: #f9fafb;
    transform: translateX(2px);
}

/* Make citation domain chart clickable */
#topCitationDomainsChart {
    cursor: pointer;
}

/* Competitor Domains Grid */
.competitor-domains-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.competitor-domains-grid .domain-rank-card {
    cursor: pointer;
}

.competitor-domains-grid .domain-rank-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);
}

