/* CSS FOR SECOND ATTEMPT AT FRONTEND */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f5f5;
    padding: 20px;
}

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

.title {
    font-size: 28px;
    font-weight: bold;
    color: #000;
}

.controls {
    display: flex;
    gap: 12px;
    flex: 1;
    margin: 0 40px;
}

.dropdown {
    padding: 10px 15px;
    border: 2px solid #333;
    border-radius: 6px;
    background-color: #fff;
    font-size: 14px;
    cursor: pointer;
    min-width: 130px;
}

/* Simulation active state - dashed borders */
.dropdown.simulation-active {
    border: 2px dashed #333;
}

.card.simulation-active {
    border: 2px dashed #ccc;
}

#mute-button {
    width: 40px;
    height: 40px;
    border: none;
    background-color: transparent;
    cursor: pointer;
    padding: 0;
    margin-right: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

#mute-button img {
    width: 100%;
    height: 100%;
}

#mute-button:hover {
    opacity: 0.7;
}

#mute-button.muted {
    opacity: 0.5;
}

#help-button {
    width: 40px;
    height: 40px;
    border: none;
    background-color: transparent;
    cursor: pointer;
    padding: 0;
    margin-right: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#help-button img {
    width: 100%;
    height: 100%;
}

.paper-button {
    width: 40px;
    height: 40px;
    border: none;
    background-color: transparent;
    cursor: pointer;
    font-size: 24px;
    margin-right: 10px;
}

.github-button {
    width: 40px;
    height: 40px;
    border: none;
    background-color: transparent;
    cursor: pointer;
    font-size: 24px;
}

.container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: 1fr;
    max-width: 1400px;
    overflow-x: auto;
}

.picker-card {
    min-width: 345px;
    margin-right: 20px;
}

.card {
    background-color: #fff;
    border: 2px solid #ccc;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #000;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: #ffffff;
    border-radius: 6px;
    margin-bottom: 5px;
}

.card-footer {
    padding-top: 10px;
    border-top: 1px solid #eee;
    font-size: 13px;
    color: #666;
}

/* Mapper card footer specific styling */
.mapper-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.mapper-footer-text {
    font-size: 13px;
    color: #666;
}

.mapper-rgb-box {
    border: 2px solid #333;
    border-radius: 6px;
    overflow: hidden;
    display: inline-flex;
    flex-direction: row;
}

.mapper-rgb-header {
    background-color: #f5f5f5;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 600;
    color: #000;
    text-align: center;
    display: flex;
    align-items: center;
}

.mapper-rgb-values {
    padding: 0;
    font-size: 13px;
    color: #000;
    background-color: #fff;
    text-align: center;
    display: flex;
    align-items: stretch;
    gap: 0;
}

.rgb-value {
    padding: 4px 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.rgb-value:not(:last-child) {
    border-right: 2px solid #333;
}

.radial-chart {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
}

.radial-chart svg {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
}

.randomize-button {
    width: 24px;
    height: 24px;
    border: none;
    background-color: transparent;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

.randomize-button:hover {
    opacity: 0.7;
}

.randomize-button img {
    width: 100%;
    height: 100%;
}

.zoom-button {
    width: 24px;
    height: 24px;
    border: none;
    background-color: transparent;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

.zoom-button:hover {
    opacity: 0.7;
}

.zoom-button img {
    width: 100%;
    height: 100%;
}

/* Container for the 4 visualization cards */
.viz-cards-container {
    grid-column: 2 / 4;  /* Span columns 2-3 */
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 20px;
    position: relative;
    align-self: stretch;
}

/* Smooth transitions for all cards */
.viz-cards-container .card {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Magnified card spans full 2x2 grid */
.card.magnified {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
}

/* Increase content area height when magnified */
.card.magnified .card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 0;  /* Allow flex item to shrink below content size */
}

/* Make SVG visualizations fill the magnified card content */
.card.magnified .card-content > img,
.card.magnified .card-content > svg,
.card.magnified .card-content > div {
    flex: 1;
    min-height: 0;
    max-width: 100%;
    height: 100%;
}

.card.magnified .card-content img {
    object-fit: contain;
    width: 100%;
    height: 100%;
}

/* Override max-height constraints when magnified */
.card.magnified .card-content {
    max-height: none !important;
}

/* Hidden cards fade out */
.card.hidden {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0s 0.3s;
}

/* Icon rotation for visual feedback */
.zoom-button.magnified img {
    transform: rotate(180deg);
    transition: transform 0.3s ease;
}

.radar-shape {
    width: 160px;
    height: 160px;
    background-color: #ddd;
    border-radius: 40%;
    clip-path: polygon(30% 0%, 70% 0%, 100% 30%, 100% 70%, 70% 100%, 30% 100%, 0% 70%, 0% 30%);
}
/* END OF CSS FOR SECOND ATTEMPT */



/* THIS IS CSS FOR tHE ORIGINAL TEST AND CAN PROBABLY BE REMOVED */
/* Fixed size panels for 3x2 grid */
.container .row .col {
  width: 300px;
  height: 600p;
  margin: 10px;
  border: 1px solid #ddd;
  padding: 15px;
  overflow: auto;
  box-sizing: border-box;
}

/* Adjust row to accommodate fixed widths and margins */
.container .row {
  display: flex;
  flex-wrap: wrap;
  margin: 0;
}

/* Ensure container can fit the grid */
.container {
  max-width: none;
}

/* SVG containers - scale SVG to fit */
.svg-container {
  width: 100%;
  height: auto;
  display: flex;
  justify-content: center;
  align-items: center;
}

.svg-container svg {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
}
/* END OF TESTING CSS */

/* Picker card layout fixes: ensure the colour picker canvas and large
     colour display stack vertically and don't overlap. */
.picker-card .card-content {
    justify-content: flex-start;
    gap: 18px;
    align-items: center;
    flex: 0 0 auto;  /* Don't grow or shrink - use natural height */
}
.picker-card #color-picker,
.picker-card canvas {
    position: relative;
    z-index: 2;
    display: block;
}
.picker-card .colour-display {
    margin-top: 12px;
    z-index: 1;
}

#colour-display {
    border: 1px solid rgba(0, 0, 0, 0.2);
}

#colour-display.simulation-active {
    outline: 2px dashed #ccc;
    outline-offset: 1px;
}

/* Color space controls styling */
.color-space-controls {
    display: flex;
    gap: 8px;
    align-items: center;
    width: 265px;
    position: relative;
    top: -20px;
}

.color-space-dropdown {
    padding: 6px 10px;
    border: 2px solid #333;
    border-radius: 6px;
    background-color: #fff;
    font-size: 13px;
    cursor: pointer;
    flex: 0 0 auto;
    position: relative;
    left: -20px;
}

.color-value-input {
    padding: 6px 8px;
    border: 2px solid #333;
    border-radius: 6px;
    background-color: #fff;
    font-size: 13px;
    text-align: center;
    flex: 1;
    min-width: 55px;
    position: relative;
    left: -20px;
}

/* Picker footer styling */
.picker-footer {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    margin-top: -5px !important;
}

.picker-footer-title {
    font-size: 18px;
    font-weight: 600;
    color: #000;
    margin-bottom: 15px;
    align-self: flex-start;
    margin-left: 0px;
}

/* Color name container with play button */
.color-name-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

.play-audio-button {
    width: 24px;
    height: 24px;
    border: none;
    background-color: transparent;
    cursor: pointer;
    padding: 0;
    display: flex;
    position: relative;
    top: 0px;
    align-items: center;
    justify-content: center;
    transition: opacity 0.2s;
}

.play-audio-button:hover {
    opacity: 0.7;
}

.play-audio-button img {
    width: 100%;
    height: 100%;
}

/* Help Popover Styles */
.popover-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
}

.popover-overlay.active {
    display: flex;
}

.popover-content {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    max-width: 800px;
    max-height: 90vh;
    width: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
    animation: popoverFadeIn 0.3s ease;
}

@keyframes popoverFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.popover-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    color: #666;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s, color 0.2s;
    z-index: 1;
}

.popover-close:hover {
    background-color: #f0f0f0;
    color: #000;
}

.popover-body {
    padding: 30px 40px;
    overflow-y: auto;
    overflow-x: hidden;
}

.popover-body h1 {
    font-size: 22px;
    font-weight: 600;
    color: #000;
    margin-top: 25px;
    margin-bottom: 12px;
}

.popover-body h1:first-child {
    margin-top: 0;
}

.popover-body h2 {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-top: 20px;
    margin-bottom: 10px;
}

.popover-body p {
    font-size: 15px;
    line-height: 1.6;
    color: #444;
    margin-bottom: 12px;
}

.popover-body ul {
    margin-left: 20px;
    margin-bottom: 12px;
}

.popover-body li {
    font-size: 15px;
    line-height: 1.6;
    color: #444;
    margin-bottom: 6px;
}

/* Sponsor Footer Styles */
.sponsor-footer {
    margin-top: 20px;
    padding: 15px 20px;
    background-color: #fff;
    border: 2px solid #ccc;
    border-radius: 8px;
}

.sponsor-logos {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 60px;
    flex-wrap: wrap;
}

.sponsor-text {
    font-size: 16px;
    font-weight: 500;
    color: #333;
}

.sponsor-logo {
    height: 60px;
    width: auto;
    object-fit: contain;
}

#mapper-plot svg {
    transform: scale(1.0);
}

/* Reduce height of thesaurus and mapper cards */
.card[data-viz="thesaurus"] .card-content {
    max-height: 240px;
}

.card[data-viz="mapper"] .card-content {
    max-height: 240px;
}


.card[data-viz="translator"] .card-content {
    max-height: 290px;
}


.card[data-viz="profiler"] .card-content {
    max-height: 290px;
}
