/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: url('https://hebbkx1anhila5yf.public.blob.vercel-storage.com/JoeBG-j5UplJZUet9leMFFkgD53HnzVhrH2d.png');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    min-height: 100vh;
    /* padding: 20px; */
}

/* Import shared styles */
@import url('../shared/shared.css');

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    /* background-color: rgba(215, 218, 69, 0.3); */
    /* border-radius: 10px; */
    /* box-shadow: 0 0 20px rgba(0, 0, 0, 0.3); */
}

h1 {
    text-align: center;
    margin-bottom: 30px;
    color: #2c3e50;
}

h2, h3 {
    color: #34495e;
    margin-bottom: 15px;
}

/* App layout */
.app-container {
    display: flex;
    flex-direction: column;
}

.preview-section {
    background: white;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    text-align: center;
    order: 2;
}

#pfpCanvas {
    max-width: 100%;
    height: auto;
    border: 1px solid #ddd;
    border-radius: 8px;
    margin: 0;
    background-color: #f9f9f9;
}

.button-group {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-top: 15px;
}

button {
    background-color: #ffd700; /* Gold yellow */
    color: #333;
    border: none;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

button:hover {
    background-color: #e6c200; /* Darker yellow on hover */
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

button:active {
    background-color: #ccac00; /* Even darker yellow */
    transform: translateY(0);
}

#randomizeBtn {
    background-color: #ffd700; /* Gold yellow */
}

#randomizeBtn:hover {
    background-color: #e6c200; /* Darker yellow on hover */
}

/* Icon button styles */
button i {
    font-size: 18px;
    transition: transform 0.2s ease;
}

button:hover i {
    transform: scale(1.1);
}

button:active i {
    transform: scale(0.95);
}

/* Options section */
.options-section {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    order: 1;
}

.option-group {
    position: relative;
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    overflow: visible; /* Changed from hidden to visible to allow glow to show */
    margin-bottom: 20px;
}

.option-group:not(.disabled) {
    z-index: 1; /* Ensure the container creates a stacking context */
}

.option-group:not(.disabled)::after {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    border-radius: 11px; /* Slightly larger than the container's border-radius */
    background: transparent;
    z-index: -1;
    opacity: 1;
    transition: opacity 0.3s ease, box-shadow 0.3s ease;
    pointer-events: none; /* Prevent the pseudo-element from blocking interactions */
    animation: pulse-glow-container 2s infinite ease-in-out;
}

.option-group:not(.disabled):hover::after {
    opacity: 1;
    animation: pulse-glow-container 2s infinite ease-in-out;
}

@keyframes pulse-glow-container {
    0% {
        box-shadow: 0 0 8px 3px rgba(255, 215, 0, 0.4);
    }
    50% {
        box-shadow: 0 0 20px 8px rgba(255, 215, 0, 0.7);
    }
    100% {
        box-shadow: 0 0 8px 3px rgba(255, 215, 0, 0.4);
    }
}

/* Ensure disabled option groups don't show any glow */
.option-group.disabled {
    box-shadow: none !important;
    pointer-events: none;
}

.option-group.disabled .options {
    opacity: 0;
    max-height: 0;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden;
    transition: all 0.3s ease;
    visibility: hidden;
    pointer-events: none;
}

.options {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.option-bg {
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid #ddd;
    transition: transform 0.15s, border-color 0.15s;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f5f5f5;
    padding: 2px;
    box-sizing: border-box;
}

.option-bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.15s;
}

.option-bg:hover {
    transform: scale(1.05);
    border-color: #ffd700; /* Gold yellow */
}

.option-bg:hover img {
    transform: scale(1);
}

.option-bg.selected {
    border-color: #ffd700; /* Gold yellow */
    border-width: 2px;
    animation: pulse-glow 2s infinite ease-in-out;
    position: relative;
    z-index: 1;
}

.option-bg, .option-img {
    width: 36px;
    height: 36px;
}
.option-img {
    object-fit: cover;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s;
    padding: 2px;
    box-sizing: border-box;
}

.option-img:hover {
    transform: scale(1.05);
    border-color: #ffd700; /* Gold yellow */
}

.option-img.selected {
    border-color: #ffd700; /* Gold yellow */
    border-width: 3px;
    animation: pulse-glow 2s infinite ease-in-out;
    position: relative;
    z-index: 1;
}

/* Category Header */
.option-group {
    opacity: 1;
    transition: opacity 0.3s ease;
}

.option-group.disabled .options {
    pointer-events: none;
}

.option-group.disabled .shuffle-btn {
    opacity: 0.6;
    cursor: not-allowed;
}

.category-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 20px;
}

.category-header::after {
    content: '▼';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%) rotate(-90deg);
    transition: transform 0.3s ease;
    font-size: 12px;
    opacity: 0.7;
}

.option-group:not(.collapsed) .category-header::after {
    transform: translateY(-50%) rotate(0deg);
}

.disabled .category-header h3 {
    color: #888;
}

.category-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.category-header h3 {
    margin: 0;
    color: #333;
    font-size: 1.1rem;
    font-weight: 600;
}

/* Text Overlay Styles */
.text-options {
    padding: 10px 0;
}

.text-input {
    width: 100%;
    padding: 8px 12px;
    margin-bottom: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    background: rgba(255, 255, 255, 0.9);
}

/* Position controls container */
.position-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 12px 0;
}

/* Position rows - both horizontal and vertical */
.position-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Remove vertical column layout - make it row */
.position-row.vertical {
    flex-direction: row;
    margin-left: 0;
}

/* Position buttons */
.pos-btn {
    width: 25px;
    height: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #f8f9fa;
    color: #333;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    margin: 0;
}

/* Font size buttons */
.font-size-btn {
    width: 25px;
    height: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: #f8f9fa;
    color: #333;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    margin-left: 8px;
}

/* Style for gradient/color options */
.style-options {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0;
    align-items: center;
}

.style-option {
    position: relative;
    width: 25px;
    height: 25px;
    border-radius: 4px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    overflow: hidden;
    padding: 0;
    margin: 0;
    background: #fff;
}

.style-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.style-option .style-label {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 2px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-shadow: 0 0 2px rgba(0,0,0,0.5);
    font-weight: bold;
}

/* Selected state */
.style-option input[type="radio"]:checked + .style-label {
    border: 2px solid #ffd700; /* Gold yellow */
    box-shadow: 0 0 0 1px white, 0 0 0 3px #ffd700; /* Gold yellow */
}

/* Hover effect */
.style-option:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

/* Disabled state for position buttons */
.pos-btn:disabled,
.pos-btn.disabled,
.font-size-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #f5f5f5;
    color: #999;
    border-color: #ddd;
    box-shadow: none;
    pointer-events: none;
}

.pos-btn:hover:not(:disabled),
.font-size-btn:hover:not(:disabled) {
    background-color: #e9ecef;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.pos-btn:active:not(:disabled),
.font-size-btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: none;
}

.pos-btn.active {
    background-color: #ffd700; /* Gold yellow */
    color: white;
    border-color: #ccac00; /* Even darker yellow */
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
    margin: 0 4px;
}

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

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 20px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: #ffd700; /* Gold yellow */
}

input:focus + .toggle-slider {
    box-shadow: 0 0 1px #ffd700; /* Gold yellow */
}

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

/* Shuffle Button */
.shuffle-btn {
    background: #ffd700; /* Gold yellow */
    border: 1px solid #ddd;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    padding: 0;
    margin: 0 5px;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.shuffle-btn:hover {
    background: #e6c200; /* Darker yellow on hover */
    transform: scale(1.1);
}

.shuffle-btn:active {
    transform: scale(0.95);
    background: #ccac00; /* Even darker yellow */
}

/* Disabled state for shuffle buttons */
.option-group.disabled .shuffle-btn,
.shuffle-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    pointer-events: none;
}

/* Animation for cycling */
@keyframes cycleAnimation {
    0% { transform: translateX(0); }
    50% { transform: translateX(3px); }
    100% { transform: translateX(0); }
}

.shuffle-btn.cycle-active {
    animation: cycleAnimation 0.3s ease;
}

.shuffle-btn svg {
    width: 16px;
    height: 16px;
}

/* Disabled state for category */
.category-disabled .options {
    opacity: 0.5;
    pointer-events: none;
}

/* Hide categories that only have the 'none' option */
.option-group.empty-category {
    display: none;
}

/* Add smooth transition for options */
.options {
    transition: all 0.3s ease;
    max-height: 1000px; /* Large enough to contain all options */
    overflow: hidden;
    opacity: 1;
}

/* .option-group.collapsed .options {
    opacity: 0;
    max-height: 0;
    padding: 0 !important;
    margin: 0 !important;
    pointer-events: none;
    visibility: hidden;
} */

.option-group.collapsed .options,
.option-group.collapsed .text-options {
    opacity: 0;
    max-height: 0;
    padding: 0 !important;
    margin: 0 !important;
    pointer-events: none;
    visibility: hidden;
}

/* Keep the header and controls visible when collapsed */
.option-group.collapsed .category-header,
.option-group.collapsed .category-controls,
.option-group.collapsed .toggle-switch {
    pointer-events: auto;
}

.option-group.collapsed .category-header {
    margin-bottom: 0;
}

.category-disabled .shuffle-btn {
    opacity: 0.5;
    cursor: not-allowed;
}

.category-disabled .toggle-slider {
    opacity: 0.7;
}

/* Pulsing glow animation for active option groups */
.option-group {
    position: relative;
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    overflow: visible; /* Changed from hidden to visible to allow glow to show */
    margin-bottom: 20px;
}

.option-group:not(.disabled) {
    z-index: 1; /* Ensure the container creates a stacking context */
}

.option-group:not(.disabled)::after {
    content: '';
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    border-radius: 11px; /* Slightly larger than the container's border-radius */
    background: transparent;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease, box-shadow 0.3s ease;
    pointer-events: none; /* Prevent the pseudo-element from blocking interactions */
}

.option-group:not(.disabled):hover::after {
    opacity: 1;
    animation: pulse-glow-container 2s infinite ease-in-out;
}

@keyframes pulse-glow-container {
    0% {
        box-shadow: 0 0 8px 3px rgba(255, 215, 0, 0.4);
    }
    50% {
        box-shadow: 0 0 20px 8px rgba(255, 215, 0, 0.7);
    }
    100% {
        box-shadow: 0 0 8px 3px rgba(255, 215, 0, 0.4);
    }
}

/* Ensure disabled option groups don't show any glow */
.option-group.disabled {
    box-shadow: none !important;
    pointer-events: none;
}

/* Disclaimer styles */
.disclaimer {
    display: none;
}

/* Footer Styles */
.site-footer {
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    padding: 1.5rem 0;
    margin-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    width: 100%;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    text-align: center;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    line-height: 1.6;
}

.footer-content a {
    color: #ff9900;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-content a:hover {
    color: #ffcc66;
    text-decoration: underline;
}

.footer-content p {
    margin: 0.5rem 0;
}

/* Update preview section to remove old disclaimer styles */
.preview-section {
    text-align: center;
    padding: 2rem;
    background: rgba(255, 255, 255, 1);
    border-radius: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    /* margin-left: 2rem; */
    /* max-width: 500px; */
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}

/* Responsive design */
@media (min-width: 992px) {
    .app-container {
        flex-direction: row;
        align-items: flex-start;
    }
    
    .preview-section {
        width: 400px;
        flex-shrink: 0;
        position: sticky;
        top: 20px;
    }
    
    .options-section {
        flex-grow: 1;
        margin-right: 30px;
    }
}

@media (max-width: 991px) {
    .container {
        max-width: 991px;
        margin: 0 auto;
        background-color: transparent;
        border-radius: 0px !important;
        box-shadow: none;
        background: none !important;
        border: none !important;
    }
    
    .app-container {
        position: relative;
    }
    
    .options-section {
        order: 2;
        margin-top: 20px;
    }
    
    .preview-section {
        order: 1;
        position: sticky;
        top: 0;
        z-index: 100;
        background: white;
        padding: 15px 15px 5px;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
        margin-bottom: 10px;
        transition: all 0.3s ease;
    }
    
    /* Compact state when scrolled */
    .preview-section.compact {
        padding: 5px 15px;
        background-color: #d5bd3ed1; /* 70% opacity white */
        backdrop-filter: blur(10px);
    }
    
    .preview-section.compact h2 {
        display: none;
    }
    
    /* Keep the button group visible in compact mode but positioned differently */
    
    .preview-section.compact .preview-content {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
    }
    
    .preview-section.compact #pfpCanvas {
        max-height: 200px;
        width: auto;
        margin: 0;
        display: block;
        flex-shrink: 0;
    }
    
    .preview-section.compact .button-group {
        display: flex;
        flex-direction: column;
        gap: 8px;
        margin: 0 0 0 10px;
    }
    
    .option-group {
        margin-bottom: 5px;
    }
    
    /* Ensure the preview is visible above other content when scrolling */
    .preview-section {
        transform: translateZ(0); /* Force hardware acceleration */
        -webkit-backdrop-filter: blur(10px);
        backdrop-filter: blur(10px);
        background-color: rgba(255, 255, 255, 1);
    }
    
    /* Adjust the canvas size on very small screens */
    #pfpCanvas {
        max-width: 100%;
        max-height: 300px;
        height: auto;
        width: auto;
        transition: all 0.3s ease;
        display: block;
        margin: 0 auto 10px;
    }
    
    .button-group {
        transition: all 0.3s ease;
        margin-top: 0;
    }
}

/* Canvas container for maintaining aspect ratio */
.canvas-container {
    position: relative;
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

.canvas-container::before {
    content: "";
    display: block;
    padding-top: 100%; /* 1:1 Aspect Ratio */
}

.canvas-container canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Dual text toggle styles */
.dual-text-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 10px;
    padding: 8px;
    border-radius: 4px;
    background-color: rgba(0, 0, 0, 0.05);
}

.dual-text-label {
    display: flex;
    align-items: center;
    margin-left: 8px;
    font-size: 14px;
    color: #555;
    cursor: pointer;
}

.dual-text-label i {
    margin-right: 5px;
    font-size: 16px;
}

/* Disabled state for position buttons */
.position-controls.disabled .pos-btn,
.position-controls.disabled .font-size-btn {
    opacity: 0.5;
    pointer-events: none;
    cursor: not-allowed;
}

/* Adjust toggle switch for dual text */
.dual-text-toggle .toggle-switch {
    margin: 0;
}

.position-row {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 0px;
    align-items: center;
}

.position-row {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 0px;
    align-items: center;
}

.position-row {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 0px;
    align-items: center;
}

.position-row.horizontal {
    justify-content: center;
}

.position-row.vertical {
    flex-direction: row;
    align-items: center;
}

.position-row.horizontal .pos-btn{
    background-color: lightyellow;
}

.position-row.vertical .pos-btn{
    background-color: rgb(255, 214, 214);
}

/* Pulsing glow animation for selected items */
@keyframes pulse-glow {
    0% {
        box-shadow: 0 0 5px 2px rgba(255, 215, 0, 0.4);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 15px 5px rgba(255, 215, 0, 0.7);
        transform: scale(1.02);
    }
    100% {
        box-shadow: 0 0 5px 2px rgba(255, 215, 0, 0.4);
        transform: scale(1);
    }
}
