/* Global sizing tokens for square cards shared across pages */
:root {
    --square-card-size: 180px;
    --square-card-max-width-mobile: 180px;
    --square-card-border-radius: 28px;
    --square-card-padding: 16px;
    --square-card-gap: 16px;
    /* Legacy aliases used on the home page */
    --skill-card-size: var(--square-card-size);
    --skill-card-gap-desktop: var(--square-card-gap);
    --skill-card-gap-mobile: var(--square-card-gap);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: "Inter", sans-serif;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    /* Applied globally */
}

/* ==============================================
   GLOBAL SCROLLBAR STYLING (All Pages)
   ============================================== */
/* Firefox scrollbar styling */
* {
    scrollbar-width: thin;
    scrollbar-color: #2a2a2a #1a1a1a; /* var(--bg-tertiary) var(--bg-modal) */
}

/* Webkit (Chrome/Safari/Edge) scrollbar styling */
*::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

*::-webkit-scrollbar-track {
    background: #1a1a1a; /* var(--bg-modal) */
}

*::-webkit-scrollbar-thumb {
    background-color: #2a2a2a; /* var(--bg-tertiary) */
    border-radius: 4px;
    border: 2px solid #1a1a1a; /* var(--bg-modal) */
}

*::-webkit-scrollbar-thumb:hover {
    background-color: #3a3a3a;
}

/* Allow pull-to-refresh on mobile browsers */
html {
    overscroll-behavior: auto;
    overscroll-behavior-y: auto;
}

body {
    overflow: visible;
    /* Changed from hidden to visible for iOS Safari scrolling compatibility */
    height: 100vh;
    width: 100vw;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: #1a1a1a;
    overscroll-behavior: auto;
    overscroll-behavior-y: auto;
    -webkit-overflow-scrolling: touch;
    /* iOS Safari specific fixes */
    min-height: -webkit-fill-available;
    position: relative;
}

main.page-content {
    display: flex;
    flex-direction: column;
    /* To stack its children, like #skills-view */
    flex-grow: 1;
    /* To take available space from the body flex container */
    width: 100%;
    /* Ensure it takes full width */
    height: 100%;
    /* Ensure it takes full height within the body */
    overflow: hidden;
    /* Prevent content from spilling out, good for main app areas */
    position: relative;
    /* Establishes a stacking context, might be useful later */
    overscroll-behavior: auto;
    overscroll-behavior-y: auto;
}

/* --- Buttons (Shared Styles) --- */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border-radius: 1000px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    text-align: center;
    text-decoration: none;
    color: #F6EAE7;
    background-color: #7f8c8d;
    /* Default grey */
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.1s ease;
    user-select: none;
    vertical-align: middle;
    line-height: 1.5;
}

.btn-confirm {
    background-color: #2980b9;
}

.btn:hover {
    filter: brightness(110%);
    transform: translateY(-1px);
}

.btn:active {
    filter: brightness(95%);
    transform: translateY(0px);
}

.btn:disabled,
.btn.disabled {
    background-color: #95a5a6;
    border-color: #95a5a6;
    color: #bdc3c7;
    cursor: not-allowed;
    transform: none;
    filter: none;
    opacity: 0.65;
}

/* Button Color Modifiers */
.btn-primary {
    background-color: #3498db;
    border-color: #3498db;
    color: white;
}

/* Primary button hover styling */
.btn-primary:hover:not(:disabled):not(.disabled) {
    background-color: #2980b9;
    border-color: #2980b9;
}

.btn-success {
    background-color: #3498db;
    border-color: #3498db;
    color: #F6EAE7;
}

/* Used in locationModal.js, workoutPrefsModal */
.btn-success:hover:not(:disabled):not(.disabled) {
    background-color: #3498db;
    border-color: #3498db;
}

.btn-danger {
    background-color: #e74c3c;
    border-color: #e74c3c;
    color: #F6EAE7;
}

/* Used in profileUtils.js (delete confirm) */
.btn-danger:hover:not(:disabled):not(.disabled) {
    background-color: #c0392b;
    border-color: #c0392b;
}

.btn-info {
    background-color: #1abc9c;
    border-color: #3498db;
    color: white;
}

/* Used for #generate-workout-btn, common machines button state */
.btn-info:hover:not(:disabled):not(.disabled) {
    background-color: #3498db;
    border-color: #3498db;
}

.btn-secondary {
    background-color: #7f8c8d;
    border-color: #7f8c8d;
    color: white;
}

/* Used in profile menu, common machines button state */
.btn-secondary:hover:not(:disabled):not(.disabled) {
    background-color: #95a5a6;
    border-color: #95a5a6;
}

.btn-outline-secondary {
    background-color: transparent;
    border-color: #7f8c8d;
    color: #bdc3c7;
}

/* Used in locationModal.js (category buttons) */
.btn-outline-secondary:hover:not(:disabled):not(.disabled) {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: #95a5a6;
    color: white;
}

.btn-outline-secondary.active {
    background-color: #3498db;
    border-color: #3498db;
    color: white;
}

/* Added/removed in locationModal.js */
.btn-stepper {
    background-color: #F6EAE7;
    border-color: #000000;
    color: rgb(0, 0, 0);
    font-size: 24px;
    width: 36px;
    height: 36px;
    padding: 0;
    line-height: 36px;
    border-radius: 4px;
    align-items: center;
    display: flex;
    justify-content: center;
}

/* Used in workoutPrefsModal */
/* Button Size Modifiers */
/* .btn-sm (Not found referenced in provided JS/HTML for styles.css) */
/* Button Layout Modifiers */
.btn-block {
    display: block;
    width: 100%;
}

/* Used in form layouts and locationModal.js */
/* --- Main Skill Tree View (#skills-view) --- */
#skills-view {
    flex-grow: 1;
    width: 100%;
    display: flex;
    /* Changed by navigation.js */
    flex-direction: column;
}

/* --- Left Side Category Indicator --- */
/* side-circle removed - functionality transferred to fab-icon-container */

.curved-text span {
    display: block;
    height: 1em;
    text-align: center;
    transition: transform 0.6s cubic-bezier(0.25, 0.1, 0.25, 1.5);
    transform: translateX(0px);
    /* Modified by skillWheel.js */
    /* Opacity/animation handled by JS/keyframes */
    /* Ensure child spans are visible by default if parent is */
    opacity: 1;
    /* Explicitly set span opacity to 1 */
}

/* Category text container GPU acceleration */
#category-text {
    /* GPU acceleration for smooth animations */
    -webkit-transform: translateZ(0);
    -moz-transform: translateZ(0);
    -ms-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    /* will-change set dynamically during animations */
}

/* Optimize letter animations for GPU */
#category-text span {
    /* Force GPU acceleration on each letter */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    /* will-change set dynamically during animations */
}

/* Fade classes for curved text (added/removed by skillWheel.js) */
.fade-out {
    opacity: 0;
    transform: translateY(-50%) translateX(-12px);
}

.fade-in {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

@keyframes letter-appear {
    from {
        opacity: 0;
        /* Start transparent */
        transform: translate3d(12px, 0, 0);
        -webkit-transform: translate3d(12px, 0, 0);
    }

    to {
        opacity: 1;
        /* Fade in */
        transform: translate3d(0, 0, 0);
        -webkit-transform: translate3d(0, 0, 0);
    }
}

/* Skill Selection Dots */
#skill-selection-dots {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 24px 12px 12px 12px;
    /* Aligned with burger and badge */
    margin-bottom: 24px;
    height: 36px;
    /* Fixed height to prevent layout shift */
    /* Safe area support for iPhone notch/Dynamic Island */
    padding-top: calc(24px + env(safe-area-inset-top, 0px));
    padding-left: calc(12px + env(safe-area-inset-left, 0px));
    padding-right: calc(12px + env(safe-area-inset-right, 0px));
}

.skill-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: #D9D9D930;
    transition: background-color 0.3s ease;
    margin-top: 16px;
    z-index: 200;
}

.skill-dot.selected {
    background-color: var(--dot-color);
}

/* Shake animation for skill dots */
@keyframes shake-dots {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-4px);
    }

    75% {
        transform: translateX(4px);
    }
}

#skill-selection-dots.shake {
    animation: shake-dots 0.3s ease-in-out;
}

.skill-section {
    position: relative;
    width: 100%;
    padding: 64px 0;
    transition: opacity 0.3s ease;
    /* class: category-* (Added by skillWheel.js) */
    /* GPU acceleration without containment */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    /* dataset.category (Added by skillWheel.js) */
}

.skill-row {
    display: flex;
    justify-content: center;
    margin: 24px 0;
    position: relative;
    width: 100%;
    left: 0;
    right: 0;
}

/* Skill Nodes (in the wheel) */
.skill-node {
    position: relative;
    width: 76px;
    height: 76px;
    margin: 0 12px;
    border-radius: 50%;
    /* Enhanced GPU acceleration for iOS */
    -webkit-transform-style: preserve-3d;
    transform-style: preserve-3d;
    -webkit-transform: translate3d(0, 0, 0);
    transform: translate3d(0, 0, 0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    /* iOS-specific performance optimizations */
    -webkit-perspective: 1000px;
    perspective: 1000px;
    /* Remove CSS transitions - handled by JS for better iOS performance */
    /* transition: transform 0.2s ease-out, opacity 0.3s ease, border 0.2s ease; */
    /* will-change set dynamically during animations */
    cursor: pointer;
    z-index: 1;
    opacity: 1;
    /* Touch optimization */
    -webkit-tap-highlight-color: transparent;
    /* Modified by skillWheel.js */
}

.node-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: visible;
}

/* Hover and selected transforms are handled by JavaScript due to dynamic positioning */
/* Skill Label */
.skill-label {
    position: absolute;
    text-align: center;
    font-size: 10px;
    /* Consistent with subscription badge */
    width: 100px;
    top: 100%;
    color: #ffffff;
    font-weight: bold;
    left: 50%;
    transition: opacity 0.2s ease;
    /* will-change set dynamically during animations */
    opacity: 0;
    /* Base state */
    pointer-events: none;
    border-radius: 4px;
    z-index: 1;
    transform: translateX(-50%) rotate(0deg);
    /* Modified by skillWheel.js */
}

.skill-node:hover .skill-label,
.skill-node.show-label .skill-label {
    opacity: 1;
}

/* Hide label on mobile when not selected */
.skill-node:not(.show-label) .skill-label {
    opacity: 0;
}

/* Styling for the new skill icon image */
.skill-node .skill-node-icon {
    position: absolute;
    /* Position it within the .skill-node */
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    /* Center the icon */
    width: 85%;
    /* Adjust percentage to fit nicely within the circle, leaving some padding */
    height: 85%;
    /* Adjust percentage to fit nicely within the circle, leaving some padding */
    object-fit: contain;
    /* Ensures the SVG scales correctly without cropping */
    pointer-events: none;
    /* Make sure it doesn't interfere with clicks on the node itself */
    z-index: 1;
    /* Ensures it's above the colored circle but below any text/indicators if needed */
}

/* Generate Workout Button (Initially hidden) */
#generate-workout-btn {
    position: fixed;
    bottom: 24px;
    /* Aligns with footer initially */
    /* Added for centering text */
    display: flex;
    align-items: center;
    /* Vertically centers the content (text) */
    justify-content: center;
    /* Horizontally centers the content (text) */
    text-align: center;
    /* Retained for good measure, though justify-content often handles it for direct text */
    left: 36%;
    width: 27%;
    height: 36px;
    /* Reduced from 50px for better proportions */
    font-size: 16px;
    /* Explicit font size */
    padding: 8px 16px;
    /* Proper padding */
    transition: bottom 0.5s ease-in-out, opacity 0.5s ease-in-out;
    z-index: 51;
    /* Above footer */
    opacity: 0;
    pointer-events: none;
    background-color: #282a2c;
    color: #b3b2b1;
}

#generate-workout-btn:hover {
    background-color: #3a3f42;
}

/* class: visible (Added/removed by uiUpdates.js) */
#generate-workout-btn.visible {
    opacity: 1;
    pointer-events: auto;
    border-color: #282a2c;
}

/* Adjust Generate Workout Button for smaller screens */
@media (max-width: 600px) {
    #generate-workout-btn {
        left: 15%;
        /* New left position for phones */
        width: 70%;
        /* Adjusted width to keep it centered */
    }
}

/* --- Profile Menu --- */
#profile-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 60;
    display: flex;
    align-items: flex-start;
    opacity: 1;
    /* Modified by skillWheel.js for transitions */
}

#profile-circle {
    width: 48px;
    height: 48px;
    background-color: #1b98e0;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.3s ease;
    box-shadow: 0 4px 4px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 62;
}

#profile-circle:hover {
    transform: scale(1.1);
}

#profile-initials {
    color: white;
    font-size: 16px;
    font-weight: bold;
    user-select: none;
    /* Text updated by uiUpdates.js */
}

#profile-side-menu {
    background-color: #000000;
    box-shadow: -4px 0px 12px rgba(0, 0, 0, 0.5);
    padding: 24px 12px;
    width: 252px;
    position: fixed;
    top: 0;
    bottom: 0;
    right: 0;
    transform: translateX(100%);
    /* Starts off-screen */
    transition: transform 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    visibility: hidden;
    /* Start hidden */
    opacity: 0;
    /* Start faded out */
    z-index: 90;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    border-left: 1px solid #333;
    /* class: menu-open (Added/removed by profile.js) */
}

#profile-side-menu.menu-open {
    transform: translateX(0);
    visibility: visible;
    opacity: 1;
}

#profile-list {
    list-style: none;
    padding: 0;
    margin: 0;
    margin-bottom: 12px;
    flex-grow: 1;
}

#profile-list li {
    color: #ecf0f1;
    padding: 12px 12px;
    margin-bottom: 4px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 16px;
    /* class: active-profile (Added by uiUpdates.js) */
}

#profile-list li:hover {
    background-color: #34495e;
}

#profile-list li.active-profile {
    background-color: #1abc9c;
    color: white;
    font-weight: bold;
}

.profile-item-details {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Used in uiUpdates.js */
.initials-badge {
    display: inline-block;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: #bdc3c7;
    color: #2c3e50;
    font-size: 12px;
    font-weight: bold;
    text-align: center;
    line-height: 24px;
}

/* Used in uiUpdates.js */
/* .arrow (Not found referenced) */
#logout-btn {
    display: none;
}

/* display: block/none toggled by uiUpdates.js */
#profile-config-btn {
    position: absolute;
    bottom: 12px;
    left: 12px;
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: #bdc3c7;
    transition: color 0.2s ease;
    display: none;
    /* display: block/none toggled by uiUpdates.js */
}

#profile-config-btn svg {
    display: block;
    width: 24px;
    height: 24px;
}

#profile-config-btn:hover {
    color: #ffffff;
}

/* Add profile button (Not found referenced in provided JS for styles.css) */
/* #add-profile-btn { margin: 16px 12px 24px 12px; } */
/* --- Category Skills View (#category-skills-view) --- */
#category-skills-view {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #1a1a1a;
    z-index: 150;
    overflow: hidden;
    display: none;
    /* Toggled by skillWheel.js */
    opacity: 0;
    /* Transitioned by skillWheel.js */
    transition: opacity 0.7s ease;
    /* class: visible (Added/removed by skillWheel.js) */
}



/* --- Profile Dropdown Menu Styles --- */
/* Ensure profile container can contain the absolutely positioned dropdown */
#profile-container {
    /* Restore fixed positioning to keep it in the top-right */
    position: fixed;
    top: 16px;
    right: 16px;
    /* The fixed position also serves as the context for the absolute dropdown */
    /* Keep other existing styles like display: flex, align-items, z-index */
}

.profile-dropdown {
    display: none;
    /* Hidden by default */
    position: absolute;
    top: 56px;
    /* Position below the circle (adjust if circle size changes) */
    right: 0;
    background-color: #2c3e50;
    /* Dark blue-grey (match modal style) */
    min-width: 160px;
    box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.4);
    z-index: 91;
    /* Higher than side menu (90) if it existed */
    border-radius: 4px;
    padding: 8px 0;
    /* Vertical padding */
    border: 1px solid #4b5563;
    /* Optional border */
}

.profile-dropdown.dropdown-visible {
    display: block;
    /* Show when class is added */
}

/* Style for items within the dropdown */
.dropdown-item {
    color: #ecf0f1;
    /* Light text */
    padding: 12px 16px;
    /* Padding for each item */
    text-decoration: none;
    display: block;
    /* Ensure items take full width */
    background: none;
    border: none;
    width: 100%;
    /* Full width */
    text-align: left;
    cursor: pointer;
    font-size: 16px;
    white-space: nowrap;
    /* Prevent wrapping */
}

.dropdown-item:hover {
    background-color: #34495e;
    /* Slightly darker hover */
}

/* Specific style for danger items like Logout */
.dropdown-item-danger {
    color: #e74c3c;
    /* Red text */
}

.dropdown-item-danger:hover {
    background-color: rgba(231, 76, 60, 0.2);
    /* Reddish hover */
    color: #f1a096;
    /* Lighter red on hover */
}

/* Divider style */
.dropdown-divider {
    height: 1px;
    margin: 8px 0;
    /* Space around divider */
    overflow: hidden;
    background-color: #4b5563;
    /* Separator line color */
    border: 0;
}

.page-error-message {
    background-color: #f8d7da;
    /* Light red background */
    color: #721c24;
    /* Dark red text */
    padding: 12px 16px;
    border-radius: 4px;
    margin-bottom: 16px;
    text-align: center;
    font-size: 12px;
}

/* Add to styles.css or a relevant CSS file */
.goal-selector-group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px;
    border-radius: 4px;
    box-shadow: inset 0 0 4px rgba(0, 0, 0, 0.1);
    /* Optional inner shadow */
    margin-bottom: 4px;
}

.goal-selector-group label {
    display: flex;
    align-items: center;
    background-color: #e9ecef;
    /* Light background for each goal */
    padding: 8px 12px;
    border-radius: 24px;
    /* Pill shape */
    cursor: pointer;
    transition: background-color 0.2s ease;
    font-size: 12px;
    color: #0A090C;
    /* Dark text */
    border: 1px solid #ced4da;
    /* Light border */
}

.goal-selector-group label:hover {
    background-color: #dee2e6;
}

.goal-selector-group input[type="checkbox"] {
    margin-right: 8px;
    accent-color: #3498db;
    /* Your primary accent color */
    width: 16px;
    height: 16px;
}

.goal-selector-group label:has(input[type="checkbox"]:checked) {
    background-color: #3498db;
    /* Accent color when selected */
    color: white;
    font-weight: 500;
    border-color: #3498db;
}

/* Locked Skill Node Styles */
.skill-node.skill-locked {
    cursor: not-allowed;
}

.skill-node.skill-locked .skill-node-icon {
    /* Icon styling can be added here if needed in the future */
}

.skill-node.skill-locked:hover {
    transform: none;
    /* Disable hover effects */
}

/* Lock Icon Overlay */
.skill-lock-icon {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.skill-lock-icon svg {
    width: 12px;
    height: 12px;
    fill: #fff;
}

/* Unlock Tooltip */
.skill-unlock-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 10;
    margin-bottom: 12px;
}

.skill-unlock-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.9);
}

.skill-node.skill-locked:hover .skill-unlock-tooltip {
    opacity: 1;
}

/* Collapsible and advanced option styles moved to preferences-modal.css */
