:root {
    --bg-color: #1e2130;
    --card-bg: #2b2e42;
    --text-color: #ffffff;
    --accent-color: #e53935;
    /* Red */
    --accent-blue: #2196f3;
    /* Blue for settings */
    --accent-secondary: #e0e0e0;
    --gauge-bg: #3e4259;
    --gauge-color-secondary: #4caf50;
    /* Green for top gauges */
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--bg-color);
    background-image: url('../assets/background-table.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    color: var(--text-color);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    display: flex;
    justify-content: center;
    min-height: 100vh;
}

.app-container {
    width: 100%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    gap: 20px;
    padding: 20px;
    box-sizing: border-box;
}

.gauges {
    display: none;
    /* Deprecated */
}

.gauges-row {
    display: flex;
    justify-content: space-around;
    align-items: center;
    width: 100%;
    margin-bottom: 0px;
    margin-top: 0px;
}

.gauges-row.main-gauges {
    /* Removed flex: 1 to allow natural height */
    margin-bottom: 10px;
}

.gauge-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    width: 45%;
}

.gauge-wrapper.small {
    width: 20%;
}

.gauge-wrapper.medium {
    width: 30%;
}

.gauge-container {
    position: relative;
    width: 100%;
    padding-bottom: 100%;
    /* Aspect ratio 1:1 */
    touch-action: none;
    /* Prevent scrolling while interacting */
    cursor: ns-resize;
    user-select: none;
    -webkit-user-select: none;
    background: rgba(0, 0, 0, 0.4);
    /* Darkening effect for contrast */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 50%;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: opacity 0.3s ease, filter 0.3s ease;
}

body:not(.gf-mode) #gf-low-gauge-container,
body:not(.gf-mode) #gf-high-gauge-container {
    opacity: 0.3;
    filter: grayscale(1);
    pointer-events: none;
}

.gauge-ring {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform: rotate(0deg);
}

.ring-bg {
    stroke: var(--gauge-bg);
    fill: none;
}

.ring-progress {
    stroke: var(--accent-color);
    fill: none;
    transition: stroke-dashoffset 0.1s linear;
}

.fixed-color-gauge-ring {
    stroke: var(--accent-blue);
}

#gf-low-progress,
#gf-high-progress {
    stroke: var(--gauge-color-secondary);
}

body.gf-mode .ring-progress:not(.fixed-color-gauge-ring) {
    stroke: var(--gauge-color-secondary);
}

body.gf-mode .majoration-display {
    color: var(--gauge-color-secondary);
}


.gauge-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    pointer-events: none;
    /* Let clicks pass through to container */
}

.gauge-value {
    font-size: 1.5rem;
    font-weight: 300;
}

.gauge-value.small-text {
    font-size: 1.2rem;
}

.gauge-unit {
    font-size: 0.9rem;
    color: #ccc;
    margin-top: 5px;
}

.gauge-label {
    margin-top: 10px;
    font-size: 1.2rem;
    color: #fff;
    text-transform: lowercase;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    padding: 4px 12px;
    border-radius: 15px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.results-container {
    background: rgba(0, 0, 0, 0.4);
    /* Darkening effect */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 20px;
    min-height: 150px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.actions-container {
    display: flex;
    justify-content: center;
    gap: 10px;
    align-items: center;
}

.action-btn {
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-color);
    padding: 10px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.action-btn:hover {
    background: rgba(0, 0, 0, 0.6);
}

.stops-display {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 15px;
    min-height: 160px;
    height: auto;
    margin-top: 10px;
}

.stop-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    width: 40px;
}

.stop-depth {
    font-size: 1rem;
    color: #666;
    margin-bottom: 5px;
}

.stop-line {
    width: 1px;
    background-color: #666;
}

.stop-value-container {
    height: 40px;
    /* Fixed height for bottom area */
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 5px;
}

.stop-dot {
    width: 8px;
    height: 8px;
    background-color: #666;
    border-radius: 50%;
}

.stop-time {
    font-size: 1.8rem;
    font-weight: 400;
    color: #fff;
    line-height: 1;
}

.stop-item.active .stop-depth {
    color: #fff;
    /* Optional: highlight active depth label */
}

.stop-item.active .stop-line {
    background-color: #fff;
    /* Optional: highlight active line */
}

.placeholder-text {
    color: #666;
    font-style: italic;
    align-self: center;
}

.dive-details {
    margin-top: 20px;
    text-align: center;
    font-size: 1.1rem;
    color: #fff;
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    font-weight: 500;
}

/* Successive dive section */
.successive-container {
    margin: 10px 0;
    padding: 15px;
}

.glass-panel {
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.successive-header {
    display: flex;
    align-items: center;
    gap: 15px;
    color: #fff;
    font-size: 1.1rem;
    margin-bottom: 5px;
}

.successive-controls {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    margin-top: 15px;
    gap: 15px;
    width: 100%;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.control-group label {
    font-size: 0.8rem;
    color: #aaa;
}

.majoration-display {
    text-align: center;
    margin-bottom: 15px;
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
    background: rgba(0, 0, 0, 0.3);
    padding: 8px 15px;
    border-radius: 10px;
}

.glass-input {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    padding: 8px;
    border-radius: 10px;
    font-size: 1rem;
    width: 60px;
    text-align: center;
}

.glass-input option {
    background: #2b2e42;
    color: #fff;
}

.majoration-display {
    color: var(--accent-color);
    font-weight: bold;
    font-size: 0.9rem;
}

/* Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.2);
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
}

input:checked+.slider {
    background-color: var(--accent-color);
}

input:checked+.slider:before {
    transform: translateX(16px);
}

.slider.round {
    border-radius: 24px;
}

.slider.round:before {
    border-radius: 50%;
}

/* Interaction feedback */
.gauge-container:active {
    transform: scale(0.98);
    transition: transform 0.1s;
}

/* Small mobile devices */
@media (max-width: 400px) {
    .app-container {
        padding: 10px;
    }

    .gauge-wrapper.small {
        width: 20%;
    }

    .gauge-value.small-text {
        font-size: 1.2rem;
    }

    .gauge-unit {
        font-size: 0.8rem;
        margin-top: 2px;
    }

}

/* Toggle Styles */
.toggle-container {
    margin-bottom: 10px;
}

.toggle-wrapper {
    display: flex;
    position: relative;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 3px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
    width: 25%;
    min-width: 120px;
}

.toggle-wrapper input[type="radio"] {
    display: none;
}

.toggle-option {
    flex: 1;
    text-align: center;
    padding: 6px 0;
    cursor: pointer;
    z-index: 2;
    color: #ccc;
    transition: color 0.3s ease;
    font-weight: 500;
    font-size: 0.8rem;
}

.toggle-wrapper input[type="radio"]:checked+.toggle-option {
    color: #fff;
}

.toggle-slider {
    position: absolute;
    top: 3px;
    left: 3px;
    bottom: 3px;
    width: calc(50% - 3px);
    /* Assuming 2 options */
    background: var(--accent-color);
    border-radius: 17px;
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1), background 0.3s ease;
    z-index: 1;
}

#mode-gf:checked~.toggle-slider {
    transform: translateX(100%);
    background: var(--gauge-color-secondary);
}

/* Footer Links */
.footer-links {
    text-align: center;
    font-size: 0.9em;
    margin-top: 0px;
    padding-bottom: 20px;
    opacity: 0.8;
}

.footer-links a {
    color: var(--text-color);
    /* text-decoration: none; */
    margin: 0 10px;
    border-bottom: 1px solid transparent;
    transition: border-bottom 0.2s, opacity 0.2s;
}

.footer-links a:hover {
    border-bottom: 1px solid var(--accent-color);
    opacity: 1;
}

.footer-links a:has(img),
.footer-links a:has(img):hover {
    border-bottom: none;
    text-decoration: none;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    overflow: auto;
}

.modal-content {
    background-color: var(--card-bg);
    margin: 10% auto;
    padding: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    width: 90%;
    max-width: 500px;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    color: var(--text-color);
    position: relative;
    animation: fadeIn 0.3s;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.close-button {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close-button:hover,
.close-button:focus {
    color: #fff;
    text-decoration: none;
    cursor: pointer;
}

.modal h2 {
    margin-top: 0;
    color: var(--text-color);
    font-size: 1.5rem;
    margin-bottom: 15px;
}

.modal h3 {
    color: var(--text-color);
    font-size: 1.1rem;
    margin-top: 20px;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 5px;
}

.modal ul {
    padding-left: 20px;
    line-height: 1.6;
    margin: 0;
}

.modal li {
    margin-bottom: 8px;
    font-size: 0.95rem;
    color: #ddd;
}

.modal p {
    line-height: 1.6;
    font-size: 0.95rem;
    color: #ddd;
}
