/* Index page specific styles */

:root {
    --background-color: #f8f9fa;
    --text-color: #212529;
    --table-bg-color: white;
    --shadow-color: rgba(0,0,0,0.1);
    --border-color: #dee2e6;
    --hover-bg: #f8f9fa;
}

/* Social media icons styling */
.social-icons {
    display: flex;
    align-items: center;
    gap: 8px;
}

.social-icon {
    display: flex;
    align-items: center;
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.9rem;
}

.social-icon:hover {
    opacity: 0.8;
}

.social-icon svg {
    width: 18px;
    height: 18px;
    margin-right: 4px;
}

/* Platform-specific colors */
.twitter-icon:hover svg { color: #1DA1F2; }
.instagram-icon:hover svg { color: #E1306C; }
.threads-icon:hover svg { color: #000000; }
.facebook-icon:hover svg { color: #1877F2; }
.twitch-icon:hover svg { color: #9146FF; }
.email-icon:hover svg { color: #EA4335; }
.tiktok-icon:hover svg { color: #000000; }
.youtube-icon:hover svg { color: #FF0000; }
.discord-icon:hover svg { color: #5865F2; }

.dark-theme .tiktok-icon:hover svg { color: #ffffff; }
.dark-theme .threads-icon:hover svg { color: #ffffff; }

.social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: auto;
    height: auto;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    background-color: var(--table-bg-color);
    color: var(--text-color);
    margin: 0 0.25rem;
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 4px var(--shadow-color);
    text-decoration: none;
}

.social-link:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px var(--shadow-color);
    color: var(--text-color);
    text-decoration: none;
}

.dark-theme .social-link {
    background-color: #000000;
    color: #ffffff;
    border-color: #444;
}

.dark-theme .social-link:hover {
    background-color: #222222;
    color: #ffffff;
    border-color: #ffffff;
}

.dark-theme {
    --background-color: #000000;
    --text-color: #e0e0e0;
    --table-bg-color: #1e1e1e;
    --shadow-color: rgba(0,0,0,0.5);
    --border-color: #444;
    --hover-bg: #2a2a2a;
}

body {
    background-color: var(--background-color);
    color: var(--text-color);
    transition: background-color 0.3s, color 0.3s;
}

.header {
    margin-bottom: 2rem;
}

.theme-toggle-container {
    display: flex;
    justify-content: center;
    margin-top: -1rem;
    margin-bottom: 1.5rem;
}

.theme-toggle-button {
    display: flex;
    align-items: center;
    background-color: var(--table-bg-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: 0 2px 4px var(--shadow-color);
    transition: all 0.3s;
}

.theme-toggle-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px var(--shadow-color);
}

.toggle-icon {
    margin-right: 8px;
    font-size: 1.1rem;
}

/* Keep inline editors on one line and widen company columns */
td.dev-cell, td.pub-cell { 
    white-space: nowrap; 
    min-width: 340px; 
}

.inline-editor { 
    display: inline-flex; 
    align-items: center; 
    gap: 6px; 
    flex-wrap: nowrap; 
}

.loading {
    display: flex;
    justify-content: center;
    padding: 20px;
}

.pagination {
    margin-top: 1rem;
    justify-content: center;
}

/* Force override Bootstrap styles for dark mode */
.dark-theme .table {
    color: var(--text-color) !important;
}

.dark-theme .table td,
.dark-theme .table th {
    color: var(--text-color) !important;
    border-color: var(--border-color) !important;
    background-color: var(--table-bg-color) !important;
}

/* Force all table rows to have black background on hover in dark mode - maximum specificity */
html body.dark-theme .table tbody tr:hover,
html body.dark-theme .table-hover tbody tr:hover,
html body.dark-theme #appsTable tbody tr:hover,
html body.dark-theme #xViewTable tbody tr:hover,
html body.dark-theme #aggregateTable tbody tr:hover,
html body.dark-theme table tbody tr:hover {
    background-color: #000000 !important;
}

html body.dark-theme .table tbody tr:hover td,
html body.dark-theme .table-hover tbody tr:hover td,
html body.dark-theme #appsTable tbody tr:hover td,
html body.dark-theme #xViewTable tbody tr:hover td,
html body.dark-theme #aggregateTable tbody tr:hover td,
html body.dark-theme table tbody tr:hover td {
    background-color: #000000 !important;
    color: #e0e0e0 !important;
}

/* Ensure all nested elements keep proper text color */
html body.dark-theme .table tbody tr:hover td *,
html body.dark-theme .table-hover tbody tr:hover td *,
html body.dark-theme #appsTable tbody tr:hover td *,
html body.dark-theme #xViewTable tbody tr:hover td *,
html body.dark-theme #aggregateTable tbody tr:hover td *,
html body.dark-theme table tbody tr:hover td * {
    color: #e0e0e0 !important;
}

/* Ensure links stay properly colored */
html body.dark-theme .table tbody tr:hover td a,
html body.dark-theme .table-hover tbody tr:hover td a,
html body.dark-theme #appsTable tbody tr:hover td a,
html body.dark-theme #xViewTable tbody tr:hover td a,
html body.dark-theme #aggregateTable tbody tr:hover td a,
html body.dark-theme table tbody tr:hover td a {
    color: #6ea8fe !important;
}

/* Override any Bootstrap or other framework styles */
html body.dark-theme table tr:hover {
    background-color: #000000 !important;
}

html body.dark-theme table tr:hover td {
    background-color: #000000 !important;
    color: #e0e0e0 !important;
}

.dark-theme .form-control {
    background-color: var(--hover-bg) !important;
    color: var(--text-color) !important;
    border-color: var(--border-color) !important;
}

/* Make placeholders white in dark theme (search + inline editors) */
.dark-theme #searchInput::placeholder { 
    color: #ffffff; 
    opacity: 1; 
}

.dark-theme .form-control::placeholder { 
    color: #ffffff; 
    opacity: 1; 
}

.dark-theme .page-link {
    background-color: var(--table-bg-color) !important;
    color: var(--text-color) !important;
    border-color: var(--border-color) !important;
}

.dark-theme .page-item.active .page-link {
    background-color: #0d6efd !important;
    border-color: #0d6efd !important;
    color: white !important;
}

.dark-theme .page-item.disabled .page-link {
    background-color: var(--table-bg-color) !important;
    color: #6c757d !important;
}

.dark-theme a:not(.heatmap-colored):not([style*="color"]) {
    color: #6ea8fe !important;
}

.dark-theme .table-container {
    background-color: var(--table-bg-color) !important;
}

.theme-toggle-link {
    border: none !important;
    background-color: var(--table-bg-color) !important;
    cursor: pointer;
}

.theme-toggle-link:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 8px var(--shadow-color);
    color: var(--text-color) !important;
}

/* Spinning animation for force scrape buttons */
.spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Ensure Name column never wraps to multiple lines - show full name */
td:first-child {
    white-space: nowrap;
    min-width: fit-content;
}

/* Force table header social icons to use brand colors */
th[data-field="socials"] svg {
    fill: #000000 !important;
    color: #000000 !important;
}

th[data-field="tiktok"] svg {
    fill: #FF0050 !important;
    color: #FF0050 !important;
}

th[data-field="instagram"] svg {
    fill: #E1306C !important;
    color: #E1306C !important;
}

th[data-field="threads"] svg {
    fill: #000000 !important;
    color: #000000 !important;
}

th[data-field="bluesky"] svg {
    fill: #00D4FF !important;
    color: #00D4FF !important;
}

th[data-field="youtube"] svg {
    fill: #FF0000 !important;
    color: #FF0000 !important;
}

th[data-field="facebook_group"] svg {
    fill: #1877F2 !important;
    color: #1877F2 !important;
}

th[data-field="facebook_page"] svg {
    fill: #1877F2 !important;
    color: #1877F2 !important;
}

th[data-field="discord"] svg {
    fill: #5865F2 !important;
    color: #5865F2 !important;
}

/* Ensure dark theme doesn't override header icon colors */
.dark-theme th[data-field="socials"] svg,
.dark-theme th[data-field="tiktok"] svg,
.dark-theme th[data-field="instagram"] svg,
.dark-theme th[data-field="threads"] svg,
.dark-theme th[data-field="bluesky"] svg,
.dark-theme th[data-field="youtube"] svg,
.dark-theme th[data-field="facebook_group"] svg,
.dark-theme th[data-field="facebook_page"] svg,
.dark-theme th[data-field="discord"] svg {
    fill: inherit !important;
    color: inherit !important;
}

/* Navigation button styling */
.pagination .page-link {
    padding: 0.75rem 1rem !important;
    border-radius: 0.5rem !important;
    margin: 0 0.25rem !important;
    border: 1px solid var(--border-color) !important;
    background-color: var(--table-bg-color) !important;
    color: var(--text-color) !important;
}

.dark-theme .pagination .page-link {
    background-color: #000000 !important;
    color: #ffffff !important;
    border-color: #444 !important;
}

.dark-theme .pagination .page-item.active .page-link {
    background-color: #000000 !important;
    color: #ffffff !important;
    border-color: #ffffff !important;
}

/* Custom dropdown implementation */
.custom-dropdown {
    position: relative;
    display: inline-block;
}

.custom-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--table-bg-color);
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    padding: 0.5rem 0;
    min-width: 280px;
    max-height: 70vh;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    transform: translateX(-20px);
}

.custom-dropdown-menu.show {
    display: block;
}

.custom-dropdown-menu .form-check {
    padding: 0.5rem 2rem;
    margin: 0;
    white-space: nowrap;
}

.custom-dropdown-menu .form-check:hover {
    background-color: var(--hover-bg);
}

.dark-theme .custom-dropdown-menu {
    background: var(--table-bg-color);
    border-color: var(--border-color);
}

.custom-dropdown-menu .dropdown-item {
    padding: 0.5rem 2rem;
    cursor: pointer;
    white-space: nowrap;
}

.custom-dropdown-menu .dropdown-item:hover {
    background-color: var(--hover-bg);
}

/* Edit mode functionality */
.editor-only {
    display: none !important;
}

.edit-mode .editor-only {
    display: inline-block !important;
}

/* Wider columns in edit mode to accommodate buttons */
.edit-mode th[data-field="socials"],
.edit-mode th[data-field="tiktok"],
.edit-mode th[data-field="instagram"],
.edit-mode th[data-field="threads"],
.edit-mode th[data-field="bluesky"],
.edit-mode th[data-field="youtube"],
.edit-mode th[data-field="facebook_group"],
.edit-mode th[data-field="facebook_page"],
.edit-mode th[data-field="discord"],
.edit-mode td:nth-child(2), /* X */
.edit-mode td:nth-child(3), /* TikTok */
.edit-mode td:nth-child(4), /* Insta */
.edit-mode td:nth-child(5), /* Threads */
.edit-mode td:nth-child(6), /* Bluesky */
.edit-mode td:nth-child(7), /* YT */
.edit-mode td:nth-child(8), /* FB Group */
.edit-mode td:nth-child(9), /* FB Page */
.edit-mode td:nth-child(10) /* Discord */ {
    width: 180px !important;
    min-width: 180px !important;
    max-width: 180px !important;
}

/* Ensure inline editor has enough space */
.edit-mode .inline-editor {
    min-width: 320px;
}

/* Add vertical gridlines to match horizontal grid styling */
.table td,
.table th {
    border-left: 1px solid var(--border-color) !important;
}

.table td:first-child,
.table th:first-child {
    border-left: none !important;
}

.dark-theme .table td,
.dark-theme .table th {
    border-left-color: var(--border-color) !important;
}

/* Mobile-friendly sort buttons */

.sort-btn {
    display: inline-block;
    padding: 6px 10px;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    border-radius: 3px;
    transition: all 0.2s ease;
    background-color: transparent;
    color: var(--text-color);
    opacity: 0.6;
    min-width: 28px;
    text-align: center;
    user-select: none;
    margin: 1px 0;
}

.sort-btn:hover {
    opacity: 1;
    background-color: var(--hover-bg);
    transform: scale(1.1);
}

.sort-btn.active {
    opacity: 1;
    color: #0d6efd;
    background-color: rgba(13, 110, 253, 0.1);
    font-weight: bold;
}

.dark-theme .sort-btn {
    color: var(--text-color);
}

.dark-theme .sort-btn:hover {
    background-color: var(--hover-bg);
}

.dark-theme .sort-btn.active {
    color: #6ea8fe;
    background-color: rgba(110, 168, 254, 0.1);
}

/* Heat map color styling for dynamic content */
.heatmap-colored {
    font-weight: 600 !important;
}

.heatmap-colored.total-social,
.heatmap-colored.rating-count {
    font-weight: 600 !important;
}

/* Heat map colors using CSS custom properties with maximum specificity */
.table tbody tr td.heatmap-colored,
.table tbody tr td a.heatmap-colored,
.table tbody tr td span.heatmap-colored {
    color: var(--heat-color) !important;
    font-weight: 600 !important;
}

/* Remove text decoration only for links */
.table tbody tr td a.heatmap-colored,
.table tbody tr td a.heatmap-colored:hover,
.table tbody tr td a.heatmap-colored:visited,
.table tbody tr td a.heatmap-colored:focus,
.table tbody tr td a.heatmap-colored:active {
    text-decoration: none !important;
}

/* Override dark theme colors with maximum specificity */
body.dark-theme .table tbody tr td.heatmap-colored,
body.dark-theme .table tbody tr td a.heatmap-colored,
body.dark-theme .table tbody tr td span.heatmap-colored,
body.dark-theme .table tbody tr td.heatmap-colored:hover,
body.dark-theme .table tbody tr td a.heatmap-colored:hover,
body.dark-theme .table tbody tr td span.heatmap-colored:hover,
body.dark-theme .table tbody tr td.heatmap-colored:visited,
body.dark-theme .table tbody tr td a.heatmap-colored:visited,
body.dark-theme .table tbody tr td.heatmap-colored:focus,
body.dark-theme .table tbody tr td a.heatmap-colored:focus,
body.dark-theme .table tbody tr td span.heatmap-colored:focus,
body.dark-theme .table tbody tr td.heatmap-colored:active,
body.dark-theme .table tbody tr td a.heatmap-colored:active,
body.dark-theme .table tbody tr td span.heatmap-colored:active {
    color: var(--heat-color) !important;
}

/* Remove text decoration for dark theme links */
body.dark-theme .table tbody tr td a.heatmap-colored,
body.dark-theme .table tbody tr td a.heatmap-colored:hover,
body.dark-theme .table tbody tr td a.heatmap-colored:visited,
body.dark-theme .table tbody tr td a.heatmap-colored:focus,
body.dark-theme .table tbody tr td a.heatmap-colored:active {
    text-decoration: none !important;
}

/* Equal width for social media columns only in socials view */
body:not(.store-view) th[data-field="socials"],
body:not(.store-view) th[data-field="tiktok"],
body:not(.store-view) th[data-field="instagram"],
body:not(.store-view) th[data-field="threads"],
body:not(.store-view) th[data-field="bluesky"],
body:not(.store-view) th[data-field="youtube"],
body:not(.store-view) th[data-field="facebook_group"],
body:not(.store-view) th[data-field="facebook_page"],
body:not(.store-view) th[data-field="discord"] {
    width: 90px;
    min-width: 90px;
    max-width: 90px;
}

/* Left-aligned headers to match consistently */
th {
    text-align: left;
    white-space: nowrap;
}

.sort-controls {
    float: right;
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-right: 4px;
}

/* Center align content in social media columns only in socials view */
body:not(.store-view) td:nth-child(2), /* X */
body:not(.store-view) td:nth-child(3), /* TikTok */
body:not(.store-view) td:nth-child(4), /* Insta */
body:not(.store-view) td:nth-child(5), /* Threads */
body:not(.store-view) td:nth-child(6), /* Bluesky */
body:not(.store-view) td:nth-child(7), /* YT */
body:not(.store-view) td:nth-child(8), /* FB Group */
body:not(.store-view) td:nth-child(9), /* FB Page */
body:not(.store-view) td:nth-child(10) /* Discord */ {
    text-align: center;
    width: 90px;
    min-width: 90px;
    max-width: 90px;
}

/* Auto-sizing table layout for content-based widths */
.table {
    table-layout: auto;
    width: auto;
    max-width: 100%;
}

/* Make table container compact and center the table */
.table-responsive {
    width: fit-content;
    max-width: 100%;
    margin: 0 auto;
}

/* Auto-size columns based on content */
th, td {
    white-space: nowrap;
    width: auto;
}

/* Only allow wrapping for Name column when needed */
th[data-field="name"],
td:first-child {
    white-space: normal;
    word-wrap: break-word;
}

/* Keep name column flexible in store view */
body.store-view th[data-field="name"],
body.store-view td:first-child {
    width: auto;
    min-width: 150px;
    max-width: 200px;
}

/* Compact widths for Total and Ratings columns */
th[data-field="total_social"],
td:has(.total-social),
th[data-field="rating_count"],
td:has(.rating-count) {
    width: 80px;
    min-width: 80px;
    max-width: 80px;
    white-space: nowrap;
}

/* More compact Name column in socials view */
body:not(.store-view) th[data-field="name"],
body:not(.store-view) td:first-child {
    width: auto;
    min-width: 120px;
    white-space: normal;
    word-wrap: break-word;
}

/* Profile Setup Modal Dropdown Styling */
.dropdown-menu {
    border: 1px solid var(--border-color);
    background-color: var(--table-bg-color);
    color: var(--text-color);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.dropdown-item {
    padding: 0.5rem 1rem;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    color: var(--text-color);
    transition: background-color 0.15s ease-in-out;
}

.dropdown-item:hover {
    background-color: var(--hover-bg);
    color: var(--text-color);
}

.dark-theme .dropdown-menu {
    background-color: var(--table-bg-color);
    border-color: var(--border-color);
}

.dark-theme .dropdown-item {
    color: var(--text-color);
}

.dark-theme .dropdown-item:hover {
    background-color: var(--hover-bg);
    color: var(--text-color);
}