/* =================================================================
  ROOT VARIABLES & THEME SETUP
================================================================= */
:root {
    /* Light Mode Colors */
    --bg-light: #EEEEEE;
    --surface-light: #FFFFFF;
    --text-primary-light: #000000;
    --text-secondary-light: #212121;
    --outline-light: #dadce0;

    /* Dark Mode Colors */
    --bg-dark: #212121;
    --surface-dark: #000000;
    --text-primary-dark: #FFFFFF;
    --text-secondary-dark: #F5F5F5;
    --outline-dark: #3C4043;
}

/* =================================================================
  GENERAL BODY & CONTAINER STYLES
================================================================= */
body {
    background-color: var(--bg-dark);
    color: var(--text-primary-dark);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    transition: background-color 0.3s, color 0.3s;
}

body.light-mode {
    background-color: var(--bg-light);
    color: var(--text-primary-light);
}

.container {
    max-width: 1440px; 
    width: 100%;
}

/* =================================================================
  HEADER & BUTTON STYLES
================================================================= */
.header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    margin-bottom: 32px;
    gap: 20px;
}

.header-item {
    text-align: center;
}

.header-item-left {
    display: flex;
    gap: 16px; 
    align-items: center;
    justify-self: start;
    position: relative;
    top: 10px;
    margin: 0 40px; 
}

.header-item-right {
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 20px;
    margin: 0 40px; 
}

.header-item h1 {
    margin: 0;
    font-weight: 600;
    color: inherit;
    white-space: nowrap;
}

.header-item-center .material-symbols-outlined {
    font-size: 32px;
    line-height: 1;
    vertical-align: sub;
}

.icon-button {
    display: flex;
    flex-direction: column; 
    align-items: center;
    width: 40px;
    gap: 4px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 8px;
    transition: background-color 0.2s ease-in-out;
    color: var(--text-secondary-dark);
    -webkit-user-select: none; 
    -ms-user-select: none; 
    user-select: none; 
}

body.light-mode .icon-button {
    color: var(--text-secondary-light);
}

.icon-button:hover {
    background-color: #3C4043;
}

:root body.light-mode .icon-button:hover {
    background-color: #dadce0;
}

.icon-button .material-symbols-outlined {
    font-size: 32px;
}

.icon-button span:last-child {
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}


input[type="file"] {
    display: none;
}

/* =================================================================
  DRAG-AND-DROP AREA
================================================================= */
#drop-area {
    width: 100%;
    max-width: 800px;
    height: 250px;
    border: 2px dashed var(--outline-dark);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 1.2em;
    cursor: pointer;
    margin: 80px auto;
    transition: all 0.2s ease-in-out;
}

#drop-area a {
    color: #007AFF;
    text-decoration: none;
}

body.light-mode #drop-area {
    border-color: var(--outline-light);
}

#drop-area:hover,
#drop-area.highlight {
    background-color: var(--surface-dark);
}

body.light-mode #drop-area:hover,
body.light-mode #drop-area.highlight {
    background-color: var(--bg-light);
}

#drop-area .material-symbols-outlined {
    font-size: 48px;
    margin-bottom: 8px;
}


/* =================================================================
  MAIN CONTENT WRAPPER & SHOT DETAILS
================================================================= */
#export-wrapper {
    display: none;
    background-color: var(--surface-dark);
    border-radius: 16px;
    padding: 16px 24px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    transition: background-color 0.3s;
}
body.light-mode #export-wrapper {
     background-color: var(--surface-light);
}

.shot-details {
    display: none;
    justify-content: space-between;
    align-items: center; 
    margin-bottom: 24px;
    flex-wrap: wrap;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--outline-dark);
}
body.light-mode .shot-details { border-color: var(--outline-light); }

.profile-info {
    text-align: left;
}
.profile-info h2 { 
    margin-top: 0; 
    margin-bottom: 2px;
    font-size: 1.8em;
    color: inherit;
    font-weight: 500;
}
.profile-info .timestamp {
    font-weight: bold;
    color: var(--text-secondary-dark);
    font-size: 0.9em;
    margin-top: 2px;
    margin-bottom: 2px;
}
body.light-mode .profile-info .timestamp { color: var(--text-secondary-light); }

.description-input {
    flex-grow: 1; 
    margin-left: 24px; 
    max-width: 700px; 
    background-color: transparent;
    border: none;
    color: var(--text-primary-dark);
    padding: 8px 12px;
    font-family: inherit;
    font-size: 14px;
    box-sizing: border-box;
    resize: vertical;
}
body.light-mode .description-input {
    color: var(--text-primary-light);
}
.description-input:focus {
    outline: none;
    border: 1px solid var(--outline-dark);
    border-radius: 8px;
}
body.light-mode .description-input:focus {
    border-color: var(--outline-light);
}

/* =================================================================
  CONTENT GRID & SHOT VITALS PANEL
================================================================= */
.content-grid {
    display: grid;
    grid-template-columns: 4fr 1fr;
    gap: 24px;
    align-items: start;
}

#shotVitals {
    display: none;
}

#shotVitals h3 {
    text-align: center;
    margin-top: 0;
    margin-bottom: 20px;
    font-weight: bold; 
    letter-spacing: 1px;
    font-size: 1.1em;
}

#shotVitals h4 {
    margin-top: 24px;
    margin-bottom: 12px;
    font-size: 0.9em;
    font-weight: bold; 
    color: var(--text-secondary-dark);
    border-bottom: 1px solid var(--outline-dark);
    padding-bottom: 4px;
}
body.light-mode #shotVitals h4 {
    color: var(--text-secondary-light);
    border-color: var(--outline-light);
}

.vitals-row {
    display: grid;
    grid-template-columns: 100px 1fr; 
    gap: 8px;
    margin-bottom: 8px;
    align-items: center;
    font-size: 14px;
}

.vitals-label {
    font-weight: 500;
    color: var(--text-secondary-dark);
}
body.light-mode .vitals-label { color: var(--text-secondary-light); }

.vitals-value {
    font-weight: bold;
    color: var(--text-primary-dark);
    display: flex;
    align-items: center;
}
body.light-mode .vitals-value { color: var(--text-primary-light); }

.placeholder-text {
    color: var(--text-secondary-dark);
    font-weight: bold; 
    font-style: normal; 
    opacity: 0.7;
}
body.light-mode .placeholder-text {
    color: var(--text-secondary-light);
}

.vitals-input {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-primary-dark);
    font-family: inherit;
    font-size: 1em;
    font-weight: bold;
    padding: 2px 4px;
    border-radius: 4px;
    box-sizing: border-box;
}
body.light-mode .vitals-input { color: var(--text-primary-light); }

.vitals-input:focus {
    outline: none;
    background-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 0 0 1px var(--outline-dark);
}
body.light-mode .vitals-input:focus {
    background-color: rgba(0, 0, 0, 0.05);
    box-shadow: 0 0 0 1px var(--outline-light);
}

.vitals-unit {
    margin-left: 4px;
    color: var(--text-secondary-dark);
    font-weight: normal;
}
body.light-mode .vitals-unit { color: var(--text-secondary-light); }

.vitals-row-full {
    display: grid;
    gap: 4px;
    margin-bottom: 8px;
    font-size: 14px; 
}

.vitals-textarea {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-primary-dark);
    font-family: inherit;
    font-size: 1em;
    font-weight: normal; 
    padding: 2px 4px;
    border-radius: 4px;
    box-sizing: border-box;
    resize: vertical;
    border: 1px solid transparent; 
    transition: border-color 0.2s;
}
body.light-mode .vitals-textarea { color: var(--text-primary-light); }

.vitals-textarea:focus {
    outline: none;
    background-color: rgba(255, 255, 255, 0.1);
    border-color: var(--outline-dark);
}
body.light-mode .vitals-textarea:focus {
    background-color: rgba(0, 0, 0, 0.05);
    border-color: var(--outline-light);
}

/* =================================================================
  CHARTS & LEGENDS
================================================================= */
.charts-container {
    display: none;
    text-align: center;
}

.chart-wrapper {
    position: relative;
    width: 100%;
}
#mainChartWrapper {
    height: 470px;
}
#temperatureChartWrapper {
    height: 180px;
}

.legend-container {
    margin-top: 12px;
    margin-bottom: 4px;
    text-align: center;
}

.legend-table {
    width: auto;
    border-collapse: collapse;
    table-layout: fixed;
    display: inline-table;
    vertical-align: top;
    margin: 0;
}

.legend-table.temp {
    position: static;
    left: auto;
}

.legend-table td {
    border: none;
    padding: 2px 4px;
    vertical-align: middle;
    font-size: 12px;
    border-radius: 6px;
    transition: background-color 0.2s;
}

.legend-cell-label {
    text-align: left;
    width: 140px; 
}

.legend-cell-value {
    text-align: left;
    width: 90px;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    color: var(--text-secondary-dark);
}
body.light-mode .legend-item { color: var(--text-secondary-light); }

.legend-cell-label.hover {
    background-color: #3C4043;
}
body.light-mode .legend-cell-label.hover {
    background-color: #e8eaed;
}

.legend-cell-label.hidden,
.legend-cell-value.hidden {
    opacity: 0.5;
}

.legend-table .legend-color-dot {
    width: 20px;
    height: 20px;
    margin-right: 8px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    line-height: 1;
}

.legend-table .legend-color-dot.is-dot::before {
    content: '';
    display: block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: var(--dot-color);
}

/* This rule was removed as it caused non-interactive items to have a hover effect */
/*
#temperatureChartLegend .legend-item:hover {
    background-color: #3C4043;
}
body.light-mode #temperatureChartLegend .legend-item:hover {
    background-color: #e8eaed; 
}
*/

#temperatureChartLegend .legend-color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 8px;
    flex-shrink: 0;
}

.legend-label-text {
    text-align: left;
    margin-right: 4px;
    white-space: nowrap;
}

.legend-label-value {
    font-weight: bold;
    color: inherit;
    white-space: nowrap;
}

/* =================================================================
  THEME TOGGLE SWITCH
================================================================= */
.switch-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary-dark);
}
body.light-mode .switch-wrapper {
     color: var(--text-secondary-light);
}
.switch {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 32px;
}
.switch input { display: none; }
.slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background-color: #3C4043;
    border: 2px solid #5F6368;
    transition: .4s;
    border-radius: 16px;
}
body.light-mode .slider {
    background-color: #F1F3F4;
    border: 2px solid #DADCE0;
}
.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 6px;
    bottom: 6px;
    background-color: var(--text-secondary-dark);
    transition: .4s;
    border-radius: 50%;
}
body.light-mode .slider:before {
     background-color: var(--text-secondary-light);
}
input:checked + .slider {
    background-color: #007AFF;
    border-color: #007AFF;
}
body.light-mode input:checked + .slider {
    background-color: #007AFF;
    border-color: #007AFF;
}
input:checked + .slider:before {
    background-color: var(--text-primary-dark);
    transform: translateX(20px);
    height: 24px;
    width: 24px;
    left: 2px;
    bottom: 2px;
}
body.light-mode input:checked + .slider:before {
     background-color: var(--text-primary-light);
}
.material-symbols-outlined {
    font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0, 'opsz' 24;
    transition: color 0.3s;
}
body.light-mode .material-symbols-outlined {
    font-variation-settings: 'FILL' 1, 'wght' 300, 'GRAD' 0, 'opsz' 24;
}
.switch-wrapper .material-symbols-outlined {
    font-size: 24px;
}
.switch-wrapper .material-symbols-outlined.dark-mode-icon {
    color: var(--text-primary-dark);
}
body.light-mode .switch-wrapper .material-symbols-outlined.dark-mode-icon {
    color: var(--text-secondary-light);
}
.switch-wrapper .material-symbols-outlined.light-mode-icon {
    color: var(--text-secondary-dark);
}
body.light-mode .switch-wrapper .material-symbols-outlined.light-mode-icon {
    color: var(--text-primary-light);
}

/* =================================================================
  UTILITY & MISCELLANEOUS
================================================================= */
#customTooltip {
    display: none;
    position: absolute;
    background-color: rgba(30,30,30,0.9);
    color: #E1E3E6;
    padding: 10px;
    border-radius: 8px;
    pointer-events: none;
    font-size: 12px;
    border: 1px solid #3C4043;
    white-space: nowrap;
    z-index: 10;
}

body.light-mode #customTooltip {
    background-color: rgba(250,250,250,0.9);
    color: #202124;
    border-color: #dadce0;
}

#exportButton,
#compareButton,
#clearCompareButton {
    display: none;
}

.error-message {
    color: #ff6b6b;
    text-align: center;
    margin-bottom: 20px;
}