* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family:'Ubuntu', sans-serif;
}
html, body {
    background: #000;
    color: #f2f2f2;
    width: 100%;
    text-align: center;
    overflow-x: hidden;
}

/* text */
h1 {
    margin: 10px 0;
}
strong, a {
    color: orange;
    margin: 3px 0;
    text-transform: capitalize;
}
h3 {
    font-size: 14px;
    margin: 5px 0 10px 0;
    color: orange;
}
.warning {
    color: red;
}
.library-list .row,
.library-stats .row {
    flex-direction: row;
    justify-content: center;
    flex-wrap: wrap;
}
.library-list.collapsed .row {
    flex-direction: column;
}
.library-list .row p {
    margin: 5px 25px;
    padding: 5px;
}
.library-stats .row p {
    min-width: 30%
}
.row p.note {
    font-size: 12px;
    color: #ccc;
    margin: 5px 0;
}
.library-list .row p.selected {
    border: 1px solid white;
    border-radius: 5px;
    background: #444;
    padding: 5px;
    text-decoration: none;
}
.library-list .row p.selected a {
    text-decoration: none;
}
.library-stats .row p strong {
    display: block;
    white-space: nowrap;
}
.library-info .card p {
    margin: 0 10px;
    line-height: 24px;
}
p.ip-address a {
    text-transform: lowercase;
}
/* cards */
.card {
    background: #444;
    border-radius: 5px;
    margin: 20px;
    padding: 5px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: stretch;
}
.card .header {
    font-size: 20px;
    font-weight: bold;
    text-transform: capitalize;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
}
.card .content {
    background: #222;
    font-size: 16px;
    margin: 5px 0 0 0;
    padding: 5px;
    display: flex;
    flex-direction: column;
    border-radius: 0 0 5px 5px;
    height: 100%;
    overflow: hidden;
}
.card.half {
    flex-grow: 0;
    flex-shrink: 1;
    width: 48%;
}
.card.full {
    max-width: 98%;
}
/* info icons */
.info-icon {
    border-radius: 50%;
    border: 2px solid #e2e2e2;
    user-select: none;
    display:inline-block;
    width: 20px;
    height: 20px;
    text-align: center;
    line-height: 18px;
    font-size: 14px;
    color: #e2e2e2;
    vertical-align: middle;
}
/* layout */
.row {
    display: flex;
    flex-grow: 0;
    flex-direction: row;
    justify-content: space-evenly;
    margin: 10px 0;
}

/* controls */
.chart-limit {
    min-width: 30%;
}
.chart-limit input {
    max-width: 50px;
}
.chart-limit button {
    padding:2px 5px;
    margin:0 5px;
}
/* charts */
.chart {
    font-size:12px;
    font-weight: 100;
    color:#f2f2f2;
    margin:10px;
    display:inline-block;
    min-height:500px;
    margin: 0 auto;
    min-width: 98%;
}
#items-by-rating.chart {
    min-height:500px;
}
.infolayer .legend {
    position:relative;
    top: -10px;
    margin-top: 0;
}
/* Treemap grouping control */
.grouping-control {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 10px;
    justify-content: center;
}

.grouping-control label {
    font-size: 16px;
    font-weight: bold;
    color: orange;
}

.grouping-control select {
    background-color: #333;
    color: #f2f2f2;
    border: 1px solid #666;
    border-radius: 3px;
    padding: 6px 12px;
    font-size: 14px;
    font-family: 'Ubuntu', sans-serif;
    min-width: 120px;
}

.grouping-control select:hover {
    border-color: orange;
}

.grouping-control select:focus {
    outline: none;
    border-color: orange;
    box-shadow: 0 0 3px rgba(255, 165, 0, 0.3);
}

.grouping-control .loader {
    margin: 0 0 0 10px;
    width: 20px;
    padding: 3px;
}

/* Treemap color control */
.color-control {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 5px;
    justify-content: center;
}

.color-control span {
    font-size: 16px;
    font-weight: bold;
    color: orange;
}

.color-control label {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    padding: 3px 8px;
    border-radius: 3px;
}

.color-control label:hover:not(:has(input:disabled)) {
    background-color: rgba(255, 165, 0, 0.1);
}

.color-control input[type="radio"]:disabled + label,
.color-control input[type="radio"]:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* chart toggle buttons */
.chart-toggle input {
    display:none;
}
.chart-toggle input + label {
    height: 30px;
    width: 30px;
    display:inline-block;
    background-image: url(../images/icon-pie_64.png);
    background-size: 90% 90%;
    background-position: top center;
    background-repeat: no-repeat;
    cursor: pointer;
    position:relative;
}
.chart-toggle input:checked + label {
    background-image: url(../images/icon-bar_64.png);
}
.chart-toggle input + label:hover {
    scale: 1.2;
}

/* plotly charts */
.js-plotly-plot .plotly .main-svg {
    overflow: visible;
    top: -30px;
}
.card.full .js-plotly-plot .plotly .main-svg {
    top: 0;
}
.card.full .js-plotly-plot .plotly .modebar {
    position: relative;
    left: 45%;
    top: 45px;
}
.card.half .js-plotly-plot .plotly .modebar {
    left: 37%;
}
.js-plotly-plot .plotly .modebar .modebar-group {
    background-color: transparent !important;
    display: inline-block;
}
.js-plotly-plot .plotly .modebar .modebar-group a {
    margin: 2px;
}
.legend {
    margin-top: -20px;
}
.legend p {
    display: inline-block;
    margin: 0 auto;
}
.legend p span {
    display: inline-block;
    vertical-align: middle;
    margin: 5px 10px;
    border-radius: 50%;
    height: 10px;
    width: 10px;
    background: #F75C03;
}
.legend p span.watched {
    background: #D62828;
}
.legend p span.unwatched {
    background: #F75C03;
}
.legend p span.legend-color {
    background: inherit; /* This will be overridden by inline styles */
}

/* Treemap color legend */
.color-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin: 15px 0;
    padding: 10px;
    background-color: rgba(34, 34, 34, 0.5);
    border-radius: 5px;
}

.color-legend .legend-title {
    flex-basis: 100%;
    text-align: center;
    margin-bottom: 5px;
    color: orange;
}

.color-legend .legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
}

.color-legend .legend-color {
    display: inline-block;
    width: 15px;
    height: 15px;
    border-radius: 3px;
    border: 1px solid #444;
}
/* plotly tooltips */
.hoverlayer .name,
.hoverlayer rect {
    display: none;
}

/* sweet loading spinner from css-tricks */
.loader {
    width: 40px;/* the size */
    padding: 5px;/* the border thickness */
    background: orange;
    aspect-ratio: 1;
    border-radius: 50%;
    --_m:
    conic-gradient(#0000,#000),
    linear-gradient(#000 0 0) content-box;
    -webkit-mask: var(--_m);
    mask: var(--_m);
    -webkit-mask-composite: source-out;
    mask-composite: subtract;
    box-sizing: border-box;
    animation: load 0.8s linear infinite;
    margin: 5px auto;
    will-change: transform;
}
@keyframes load {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Chart-specific loading spinner */
.chart-loading-spinner {
    width: 30px !important;
    padding: 4px !important;
}

/* Clever loading animation for first library load */
.first-load-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #000 0%, #111 50%, #000 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 1;
    transition: opacity 0.8s ease-out;
}

.first-load-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
}

.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

.medialytics-logo {
    font-size: 3rem;
    font-weight: bold;
    color: #f2f2f2;
    text-align: center;
    margin-bottom: 20px;
}

.medialytics-logo strong {
    color: orange;
}

.data-visualization {
    position: relative;
    width: 300px;
    height: 150px;
}

.chart-bars {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    height: 100%;
    gap: 8px;
}

.bar {
    width: 20px;
    background: linear-gradient(to top, orange, #ff8c00);
    border-radius: 4px 4px 0 0;
    opacity: 0.3;
    animation: barGrow 2.5s cubic-bezier(0.4, 0, 0.6, 1) infinite;
    transform-origin: bottom;
    will-change: transform, opacity;
}

.bar:nth-child(1) { animation-delay: 0s; height: 20%; }
.bar:nth-child(2) { animation-delay: 0.15s; height: 60%; }
.bar:nth-child(3) { animation-delay: 0.3s; height: 100%; }
.bar:nth-child(4) { animation-delay: 0.45s; height: 40%; }
.bar:nth-child(5) { animation-delay: 0.6s; height: 80%; }
.bar:nth-child(6) { animation-delay: 0.75s; height: 70%; }
.bar:nth-child(7) { animation-delay: 0.9s; height: 30%; }
.bar:nth-child(8) { animation-delay: 1.05s; height: 90%; }
.bar:nth-child(9) { animation-delay: 1.2s; height: 50%; }
.bar:nth-child(10) { animation-delay: 1.35s; height: 35%; }

@keyframes barGrow {
    0% {
        opacity: 0.3;
        transform: scaleY(0.5);
    }
    25% {
        opacity: 0.6;
        transform: scaleY(0.75);
    }
    50% {
        opacity: 1;
        transform: scaleY(1);
        box-shadow: 0 0 20px rgba(255, 165, 0, 0.5);
    }
    75% {
        opacity: 0.6;
        transform: scaleY(0.75);
    }
    100% {
        opacity: 0.3;
        transform: scaleY(0.5);
    }
}

.loading-text {
    color: #f2f2f2;
    font-size: 1.2rem;
    text-align: center;
    animation: textPulse 2s ease-in-out infinite;
}

@keyframes textPulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

.data-points {
    position: absolute;
    width: 100%;
    height: 100%;
}

.data-point {
    position: absolute;
    width: 4px;
    height: 4px;
    background: orange;
    border-radius: 50%;
    animation: dataFloat 4s ease-in-out infinite;
    opacity: 0;
}

.data-point:nth-child(1) {
    top: 20%; left: 10%;
    animation-delay: 0s;
}
.data-point:nth-child(2) {
    top: 60%; left: 25%;
    animation-delay: 0.5s;
}
.data-point:nth-child(3) {
    top: 30%; left: 70%;
    animation-delay: 1s;
}
.data-point:nth-child(4) {
    top: 80%; left: 60%;
    animation-delay: 1.5s;
}
.data-point:nth-child(5) {
    top: 10%; left: 85%;
    animation-delay: 2s;
}

@keyframes dataFloat {
    0%, 100% {
        opacity: 0;
        transform: translateY(0px) scale(1);
    }
    25% {
        opacity: 1;
        transform: translateY(-10px) scale(1.2);
    }
    50% {
        opacity: 0.8;
        transform: translateY(-5px) scale(1.1);
    }
    75% {
        opacity: 1;
        transform: translateY(-15px) scale(1.3);
        box-shadow: 0 0 10px rgba(255, 165, 0, 0.8);
    }
}

/* Hide the main content during first load */
.first-loading .wrapper > *:not(.first-load-overlay) {
    visibility: hidden;
}

/* visibility override since v-if doesn't work with svg */
.hidden {
    display: none;
}

/* export button */
.export-button-container {
    margin: 15px 0;
}

.export-button {
    background-color: orange;
    color: #000;
    border: none;
    padding: 10px 20px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.export-button:hover:not(:disabled) {
    background-color: #ff8c00;
    transform: scale(1.05);
}

.export-button:disabled {
    background-color: #666;
    color: #999;
    cursor: not-allowed;
}

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

.modal-content {
    background-color: #444;
    border-radius: 5px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    position: relative;
}

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

.modal-header h2 {
    margin: 0;
    color: orange;
}

.modal-close {
    background: none;
    border: none;
    color: #f2f2f2;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: orange;
}

.modal-body {
    padding: 20px;
    background-color: #222;
}

.modal-description {
    margin-bottom: 20px;
    color: #f2f2f2;
}

.attribute-section {
    margin-bottom: 30px;
}

.attribute-section h3 {
    color: orange;
    margin-bottom: 15px;
    font-size: 16px;
    border-bottom: 1px solid #666;
    padding-bottom: 5px;
}

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

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 5px;
    border-radius: 3px;
    transition: background-color 0.2s;
}

.checkbox-label:hover {
    background-color: rgba(255, 165, 0, 0.1);
}

.checkbox-label input[type="checkbox"] {
    margin-right: 8px;
    width: 16px;
    height: 16px;
    accent-color: orange;
}

.checkmark {
    margin-left: 8px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid #666;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.cancel-button {
    background-color: #666;
    color: #f2f2f2;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
}

.cancel-button:hover {
    background-color: #555;
}

.export-modal-button {
    background-color: orange;
    color: #000;
    border: none;
    padding: 10px 20px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.export-modal-button:hover:not(:disabled) {
    background-color: #ff8c00;
    transform: scale(1.05);
}

.export-modal-button:disabled {
    background-color: #666;
    color: #999;
    cursor: not-allowed;
    transform: none;
}

/* Movie Comparison Card Styles */
.comparison-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-around;
    gap: 15px;
    padding: 10px 0;
}

.filter-group {
    display: flex;
    flex-direction: column;
    min-width: 150px;
    flex: 1;
}

.filter-group label {
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 5px;
    color: orange;
}

.filter-group select {
    background-color: #333;
    color: #f2f2f2;
    border: 1px solid #666;
    border-radius: 3px;
    padding: 8px;
    font-size: 14px;
    font-family: 'Ubuntu', sans-serif;
}

.filter-group select:hover {
    border-color: orange;
}

.filter-group select:focus {
    outline: none;
    border-color: orange;
    box-shadow: 0 0 3px rgba(255, 165, 0, 0.3);
}

.analyze-button {
    background-color: orange;
    color: #000;
    border: none;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: bold;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 38px;
}

.analyze-button:hover:not(:disabled) {
    background-color: #ff8c00;
    transform: scale(1.05);
}

.analyze-button:disabled {
    background-color: #666;
    color: #999;
    cursor: not-allowed;
    transform: none;
}

.movie-comparison-results {
    margin-top: 20px;
}

.movie-list {
    background-color: #111;
    border-radius: 5px;
    padding: 10px;
    margin-bottom: 15px;
}

.movie-item {
    display: flex;
    flex-direction: column;
    padding: 8px 0;
    border-bottom: 1px solid #333;
}

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

.movie-title {
    font-weight: bold;
    color: orange;
    margin-bottom: 3px;
}

.movie-details {
    font-size: 13px;
    color: #ccc;
}

.show-more-container {
    text-align: center;
    padding: 10px 0;
}

.show-more-link {
    color: orange;
    text-decoration: none;
    font-weight: bold;
    padding: 8px 15px;
    border: 1px solid orange;
    border-radius: 5px;
    display: inline-block;
    transition: all 0.3s ease;
}

.show-more-link:hover {
    background-color: orange;
    color: #000;
}

/* Table styles for movie comparison */
.table-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 15px;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.table-search {
    background-color: #333;
    color: #f2f2f2;
    border: 1px solid #666;
    border-radius: 3px;
    padding: 8px 12px;
    font-size: 14px;
    min-width: 200px;
}

.table-search:focus {
    outline: none;
    border-color: orange;
    box-shadow: 0 0 3px rgba(255, 165, 0, 0.3);
}

.export-table-button {
    background-color: orange;
    color: #000;
    border: none;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: bold;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.export-table-button:hover {
    background-color: #ff8c00;
    transform: scale(1.05);
}

.table-container {
    overflow-x: auto;
    background-color: #111;
    border-radius: 5px;
    border: 1px solid #333;
}

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

.comparison-table th {
    background-color: #222;
    color: orange;
    font-weight: bold;
    padding: 12px 8px;
    text-align: left;
    border-bottom: 2px solid #444;
    position: sticky;
    top: 0;
    z-index: 10;
}

.comparison-table th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: background-color 0.2s;
}

.comparison-table th.sortable:hover {
    background-color: #333;
}

.comparison-table th.sortable.sort-asc .sort-arrow::after {
    content: " ↑";
    color: orange;
}

.comparison-table th.sortable.sort-desc .sort-arrow::after {
    content: " ↓";
    color: orange;
}

.comparison-table td {
    padding: 10px 8px;
    border-bottom: 1px solid #333;
    color: #f2f2f2;
}

.comparison-table tbody tr:hover {
    background-color: #1a1a1a;
}

.comparison-table tbody tr:nth-child(even) {
    background-color: #0f0f0f;
}

.comparison-table tbody tr:nth-child(even):hover {
    background-color: #1a1a1a;
}

/* Pagination styles */
.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
    padding: 15px 0;
}

.page-btn {
    background-color: #333;
    color: #f2f2f2;
    border: 1px solid #666;
    padding: 8px 12px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.page-btn:hover:not(:disabled) {
    background-color: orange;
    color: #000;
    border-color: orange;
}

.page-btn:disabled {
    background-color: #222;
    color: #666;
    cursor: not-allowed;
    border-color: #444;
}

.page-info {
    color: #f2f2f2;
    font-weight: bold;
    margin: 0 15px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .comparison-filters {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-group {
        min-width: auto;
        margin-bottom: 10px;
    }

    .table-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .control-group {
        justify-content: center;
        margin-bottom: 10px;
    }

    .table-search {
        min-width: auto;
        width: 100%;
    }

    .comparison-table {
        font-size: 12px;
    }

    .comparison-table th,
    .comparison-table td {
        padding: 8px 4px;
    }

    .pagination-controls {
        flex-wrap: wrap;
    }
}

/* Shows Rating Legend Styles */
.shows-rating-legend {
    justify-content: center;
    margin-top: 15px;
}

.gradient-legend {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background-color: rgba(34, 34, 34, 0.5);
    border-radius: 5px;
}

.gradient-legend .legend-label {
    font-size: 14px;
    font-weight: bold;
    color: orange;
}

.gradient-legend .gradient-bar {
    width: 300px;
    height: 25px;
    background: linear-gradient(to right,
        rgb(255, 0, 0) 0%,       /* Deep red */
        rgb(255, 127, 0) 25%,     /* Orange-red */
        rgb(255, 255, 0) 50%,     /* Yellow */
        rgb(128, 255, 0) 75%,     /* Yellow-green */
        rgb(0, 128, 80) 100%      /* Rich green */
    );
    border-radius: 3px;
    border: 1px solid #444;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.gradient-legend .gradient-labels {
    display: flex;
    justify-content: space-between;
    width: 300px;
    font-size: 12px;
    color: #ccc;
}

.gradient-legend .gradient-labels span:first-child {
    color: rgb(255, 0, 0);
}

.gradient-legend .gradient-labels span:last-child {
    color: rgb(0, 128, 80);
}
