/* Basic Reset & Defaults */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    margin: 0;
    padding: 0;
    width: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f4f7f6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    width: 100%;
}

a {
    text-decoration: none;
    color: #007bff;
}

a:hover {
    text-decoration: underline;
}

.hidden {
    display: none !important;
}

/* Top Navigation Bar */
.top-nav {
    background-color: #343a40;
    /* Dark Grey */
    color: #fff;
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    width: 100vw;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1001;
    margin: 0;
    box-sizing: border-box;
}

.top-nav .logo {
    font-size: 1.5rem;
    font-weight: bold;
}

.user-profile-container {
    display: flex;
    align-items: center;
    position: relative;
}

.user-profile-icon {
    width: 30px;
    height: 30px;
    background-color: #6c757d;
    /* Medium Grey */
    border-radius: 50%;
    margin-left: 0.5rem;
    cursor: pointer;
    position: relative;
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    min-width: 120px;
    z-index: 1000;
    margin-top: 0.5rem;
}

.user-dropdown a {
    display: block;
    padding: 0.5rem 1rem;
    color: #333;
    text-decoration: none;
    border-bottom: 1px solid #f8f9fa;
}

.user-dropdown a:last-child {
    border-bottom: none;
}

.user-dropdown a:hover {
    background-color: #f8f9fa;
    text-decoration: none;
}

/* App Container (Left Nav + Main Content) */
.app-container {
    display: flex;
    flex-grow: 1;
    margin-top: 60px; /* Add margin to account for fixed header */
}

/* Left Navigation */
.left-nav {
    width: 220px;
    background-color: #e9ecef;
    /* Light Grey */
    padding: 1rem;
    flex-shrink: 0;
    position: fixed;
    top: 60px; /* Below the fixed header */
    left: 0;
    height: calc(100vh - 60px); /* Full height minus header */
    overflow-y: auto; /* Allow scrolling if content is too tall */
    z-index: 1000;
    box-sizing: border-box;
}

.left-nav-header {
    font-weight: bold;
    margin-bottom: 1rem;
    color: #495057;
}

.left-nav ul {
    list-style: none;
}

.left-nav ul li a {
    display: block;
    padding: 0.5rem 0.75rem;
    color: #333;
    border-radius: 0.25rem;
    margin-bottom: 0.25rem;
}

.left-nav ul li a:hover,
.left-nav ul li.active a {
    background-color: #007bff;
    color: #fff;
    text-decoration: none;
}

/* Make specific navigation items light gray */
.left-nav ul li a[data-view="framing"],
.left-nav ul li a[data-view="futuring"],
.left-nav ul li a[data-view="visioning"],
.left-nav ul li a[data-view="designing"],
.left-nav ul li a[data-view="adapting"] {
    color: #999;
    opacity: 0.7;
}

.left-nav ul li a[data-view="framing"]:hover,
.left-nav ul li a[data-view="futuring"]:hover,
.left-nav ul li a[data-view="visioning"]:hover,
.left-nav ul li a[data-view="designing"]:hover,
.left-nav ul li a[data-view="adapting"]:hover {
    color: #666;
    background-color: #f8f9fa;
}

/* Main Content Area */
.main-content {
    flex-grow: 1;
    padding: 1.5rem;
    background-color: #fff;
    margin-left: 220px; /* Account for fixed left nav width */
}

.main-content h1 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
    color: #333;
}

/* Project Access Banner */
.project-access-banner {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.project-access-banner .access-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.project-access-banner .access-label {
    font-weight: 500;
    color: #495057;
}

.project-access-banner #user-projects-display {
    color: #007bff;
    font-weight: 500;
}

.project-access-banner.admin {
    background: #d1ecf1;
    border-color: #bee5eb;
}

.project-access-banner.admin #user-projects-display {
    color: #0c5460;
}

/* Scan Hits View Specifics */
.scan-hits-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.scan-hits-actions .search-filter {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.scan-hits-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

.scan-hits-table th,
.scan-hits-table td {
    border: 1px solid #dee2e6;
    padding: 0.75rem;
    text-align: left;
    vertical-align: top;
}

.scan-hits-table th {
    background-color: #f8f9fa;
}

.scan-hits-table .actions-cell .btn {
    margin-right: 0.3rem;
    padding: 0.2rem 0.4rem;
    font-size: 0.8rem;
}

/* URL column styling */
.scan-hits-table td:nth-child(2) {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.scan-hits-table td:nth-child(2) a {
    color: #007bff;
    text-decoration: none;
}

.scan-hits-table td:nth-child(2) a:hover {
    text-decoration: underline;
}

/* Specific column widths for better layout */
.scan-hits-table th:nth-child(1), /* TITLE */
.scan-hits-table td:nth-child(1) {
    width: 25%;
    max-width: 350px;
    min-width: 200px;
    white-space: normal;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: top;
    min-height: 6.5em; /* ~5 lines at 1.3em line-height */
}

.scan-hits-table th:nth-child(2), /* URL */
.scan-hits-table td:nth-child(2) {
    width: 15%;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.scan-hits-table th:nth-child(3), /* SNIPPET */
.scan-hits-table td:nth-child(3) {
    width: 25%;
    max-width: 350px;
    min-width: 200px;
    white-space: normal;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: top;
    min-height: 6.5em; /* ~5 lines at 1.3em line-height */
}

.scan-hits-table th:nth-child(4), /* STIRDEEPER */
.scan-hits-table td:nth-child(4) {
    width: 10%;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.scan-hits-table th:nth-child(5), /* Horizon */
.scan-hits-table td:nth-child(5) {
    width: 8%;
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.scan-hits-table th:nth-child(6), /* Region */
.scan-hits-table td:nth-child(6) {
    width: 10%;
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.scan-hits-table th:nth-child(7), /* Focus Implications */
.scan-hits-table td:nth-child(7) {
    width: 15%;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.scan-hits-table th:nth-child(8), /* Status */
.scan-hits-table td:nth-child(8) {
    width: 8%;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.scan-hits-table th:nth-child(9), /* INCLUDE IN MIRO */
.scan-hits-table td:nth-child(9) {
    width: 8%;
    max-width: 80px;
    text-align: center;
}

.scan-hits-table th:nth-child(10), /* Last Modified */
.scan-hits-table td:nth-child(10) {
    width: 9%;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.scan-hits-table th:nth-child(11), /* Actions */
.scan-hits-table td:nth-child(11) {
    width: 10%;
    max-width: 120px;
}

/* Miro checkbox styling */
.miro-checkbox-cell {
    text-align: center;
}

.miro-checkbox {
    transform: scale(1.2);
    cursor: pointer;
}

.pagination {
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.pagination .page-info {
    margin-right: 1rem;
    font-size: 0.9rem;
    color: #6c757d;
}

/* Pagination Controls */
.pagination-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 1rem 0;
    padding: 0.75rem;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
}

.pagination-controls.top-pagination {
    margin-bottom: 1rem;
    margin-top: 0;
}

.pagination-controls.bottom-pagination {
    margin-top: 1rem;
    margin-bottom: 0;
}

.page-size-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: #495057;
}

.page-size-dropdown {
    width: auto;
    min-width: 80px;
    padding: 0.25rem 0.5rem;
    font-size: 0.9rem;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    background-color: #fff;
}

.page-size-dropdown:focus {
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.pagination .btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

/* Add spacing between Prev and Next buttons */
.pagination .btn+.btn {
    margin-left: 6px;
}

/* Buttons */
.btn {
    display: inline-block;
    font-weight: 400;
    text-align: center;
    vertical-align: middle;
    cursor: pointer;
    user-select: none;
    background-color: transparent;
    border: 1px solid transparent;
    padding: 0.375rem 0.75rem;
    font-size: 1rem;
    line-height: 1.5;
    border-radius: 0.25rem;
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.btn-primary {
    color: #fff;
    background-color: #007bff;
    border-color: #007bff;
}

.btn-primary:hover {
    background-color: #0056b3;
    border-color: #0056b3;
}

.btn-secondary {
    color: #fff;
    background-color: #6c757d;
    border-color: #6c757d;
}

.btn-secondary:hover {
    background-color: #545b62;
    border-color: #545b62;
}

.btn-outline-secondary {
    color: #6c757d;
    background-color: transparent;
    border-color: #6c757d;
}

.btn-outline-secondary:hover {
    color: #fff;
    background-color: #6c757d;
    border-color: #6c757d;
}

.btn-danger {
    color: #fff;
    background-color: #dc3545;
    border-color: #dc3545;
}

.btn-danger:hover {
    background-color: #b02a37;
    border-color: #b02a37;
}

.btn-success {
    color: #fff;
    background-color: #28a745;
    border-color: #28a745;
}

.btn-success:hover {
    background-color: #218838;
    border-color: #1e7e34;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
}

.btn-edit {
    /* Specific for edit link/button in table */
    color: #007bff;
    background-color: transparent;
    padding: 0.2rem 0.4rem;
    border: none;
    cursor: pointer;
}

.btn-edit:hover {
    text-decoration: underline;
}

.btn-delete-table {
    /* Specific for delete link/button in table */
    color: #dc3545;
    background-color: transparent;
    padding: 0.2rem 0.4rem;
    border: none;
    cursor: pointer;
}

.btn-delete-table:hover {
    text-decoration: underline;
}


/* Form Elements */
input[type="text"],
input[type="url"],
input[type="date"],
input[type="file"],
textarea,
select {
    display: block;
    width: 100%;
    padding: 0.5rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #495057;
    background-color: #fff;
    background-clip: padding-box;
    border: 1px solid #ced4da;
    border-radius: 0.25rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

input[type="text"]:focus,
input[type="url"]:focus,
input[type="date"]:focus,
textarea:focus,
select:focus {
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Search keyword input specific styling to match button dimensions */
#search-keyword {
    width: auto;
    min-width: 200px;
    padding: 0.375rem 0.75rem;
    display: inline-block;
    vertical-align: middle;
}

#search-keyword:focus {
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.form-group {
    margin-bottom: 1rem;
}

.form-group.form-group-horizontal {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.form-group.form-group-horizontal label {
    flex-shrink: 0;
    min-width: 80px;
    margin-bottom: 0;
}

.form-group.form-group-horizontal select,
.form-group.form-group-horizontal .filter-dropdown-container {
    flex: 1;
}

.form-group label,
fieldset legend {
    display: inline-block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    /* row-gap column-gap */
}

.checkbox-group label {
    display: flex;
    align-items: center;
    font-weight: normal;
    margin-bottom: 0;
    /* Override default label margin */
}

.checkbox-group input[type="checkbox"] {
    margin-right: 0.5rem;
    width: auto;
    /* Override full width for inputs */
}

.error-message {
    color: #dc3545;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    padding: 0.75rem 1.25rem;
    margin-top: 1rem;
    border-radius: 0.25rem;
}


/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    /* Dimmed background */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    overflow-y: auto;
    /* For long modals */
    padding: 20px;
    /* Padding for small screens so modal doesn't touch edges */
}

.modal {
    background-color: #fff;
    padding: 1.5rem 2rem;
    border-radius: 0.3rem;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    width: 100%;
    max-width: 700px;
    /* Default max width */
    max-height: 90vh;
    /* Prevent modal from being too tall */
    display: flex;
    flex-direction: column;
}

.modal.modal-small {
    max-width: 500px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 1rem;
    border-bottom: 1px solid #dee2e6;
    margin-bottom: 1rem;
}

.modal-header h2 {
    font-size: 1.5rem;
    margin: 0;
}

.close-modal-btn {
    background: none;
    border: none;
    font-size: 1.75rem;
    font-weight: bold;
    line-height: 1;
    color: #000;
    opacity: 0.5;
    cursor: pointer;
}

.close-modal-btn:hover {
    opacity: 0.8;
}

.modal-body {
    flex-grow: 1;
    overflow-y: auto;
    /* For scrollable content within modal body */
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding-top: 1rem;
    border-top: 1px solid #dee2e6;
    margin-top: 1rem;
}

/* Placeholder styles */
.placeholder-content {
    text-align: center;
    padding: 2rem;
    color: #6c757d;
}

.placeholder-content h2 {
    margin-bottom: 0.5rem;
}

/* Filter Dropdown Styles */
.filter-dropdown-container {
    position: relative;
    display: inline-block;
}

.dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
    justify-content: space-between;
    width: 100%;
    text-align: left;
}

/* Specific styling for region dropdown */
#region-dropdown-toggle {
    min-width: 350px;
    padding: 0.375rem 0.75rem;
}

/* Specific styling for horizon dropdown to match region dropdown width */
#horizon {
    min-width: 350px;
    width: 350px;
}

.selected-count {
    background-color: #007bff;
    color: white;
    border-radius: 50%;
    padding: 0.125rem 0.375rem;
    font-size: 0.75rem;
    font-weight: bold;
    min-width: 1.25rem;
    text-align: center;
    display: none;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background-color: white;
    border: 1px solid #dee2e6;
    border-radius: 0.25rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    min-width: 350px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1050;
    margin-top: 0.25rem;
    display: none;
}

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

.dropdown-item {
    padding: 0.5rem 1rem;
    border-bottom: 1px solid #f8f9fa;
}

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

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

.dropdown-item label {
    display: flex;
    align-items: center;
    margin: 0;
    cursor: pointer;
    font-weight: normal;
    width: 100%;
}

.dropdown-item input[type="checkbox"] {
    margin-right: 0.5rem;
    width: auto;
}

/* Loading Spinner */
.loading {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 0.5rem;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.loading-overlay.hidden {
    display: none;
}

.loading-spinner-large {
    display: inline-block;
    width: 3rem;
    height: 3rem;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.loading-text {
    color: #333;
    font-size: 1.1rem;
    font-weight: 500;
}

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

    100% {
        transform: rotate(360deg);
    }
}

/* Specific styling for dropdowns inside modals */
.modal .dropdown-menu {
    z-index: 1060; /* Even higher z-index for modals */
    position: absolute;
}

.dropdown-item {
    padding: 0.5rem 1rem;
    border-bottom: 1px solid #f8f9fa;
}