/* Styles pour GrillzByYou Designer */
body {
    margin: 0;
    padding: 0;
    min-height: 100vh;
    position: relative;
}

/* Arrière-plan flou plein écran */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    background: url('../images/background.jpg') center/cover no-repeat;
    /* filter: blur(12px); */
    transform: scale(1.05); /* évite les bords visibles après le flou */
    z-index: -1;
    pointer-events: none;
    filter: grayscale(100%) contrast(1.2) blur(3px);
}

/* Conteneur principal pour limiter la largeur sur PC */
.app-container {
    max-width: 480px;
    margin: 0 auto;
    position: relative;
    background: #fafafa;
    min-height: 100vh;
}

/* Sur les grands écrans, ajouter de l'ombre au conteneur */
@media (min-width: 768px) {
    .app-container {
        box-shadow: 0 0 40px rgba(0,0,0,0.1);
        border-radius: 0;
    }
}

.draw-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.2rem 1.2rem 0.5rem 1.2rem;
    font-size: 1.5rem;
    font-weight: 700;
    background: #fff;
}

.draw-header .dots {
    background: #000000;
    color: white;
    border: none;
    border-radius: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.draw-header .dots:hover {
    background: #000000;
    transform: scale(1.1);
}

.draw-canvas-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 60vh;
    margin: 1.5rem 0 1.5rem 0;
}

.canvas-stack {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.canvas-layer {
    background: #fff;
    border-radius: 2rem;
    box-shadow: 0 4px 24px 0 rgba(0,0,0,0.07);
    width: 80vw;
    max-width: 420px;
    height: 80vw;
    max-height: 420px;
    touch-action: none;
    display: block;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

#background-canvas {
    z-index: 1;
}

#draw-canvas {
    z-index: 2;
    background: transparent;
}

.draw-toolbar-colors {
    position: fixed;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
    bottom: 3.5rem;
    width: 100%;
    max-width: 480px;
    background: rgba(255,255,255,0.75);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.7);
    border-radius: 1rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.12);
    padding: 0.6rem 0.8rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 101;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    padding-bottom: 2rem;
}

.draw-toolbar-colors.active {
    opacity: 1;
    transform: translateX(-50%) translateY(-10px);
    pointer-events: auto;
}

.draw-toolbar-colors-row {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    gap: 1.25rem;
}

.draw-toolbar-color-label-col {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.draw-toolbar-color {
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 50%;
    border: 2px solid #fff;
    margin: 0;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,0.15);
    transition: transform 0.15s, box-shadow 0.15s, border 0.15s;
}
.draw-toolbar-color:hover {
    transform: translateY(-2px) scale(1.04);
    box-shadow: 0 6px 16px rgba(0,0,0,0.2);
}

.draw-toolbar-color.selected {
    /* border: 3px solid #000; */
    /* box-shadow: 0 0 0 3px rgba(255,255,255,0.95), 0 8px 20px rgba(0,0,0,0.25); */
    transform: scale(1.3);
}

.draw-toolbar-label {
    width: 3.6rem;
    min-width: 3.6rem;
    max-width: 3.6rem;
    text-align: center;
    font-size: 0.95rem;
    color: #666;
    font-weight: 600;
    margin-top: 0.5rem;
    border-radius: 999px;
    padding: 0.22rem 0;
    background: rgba(255,255,255,0.7);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.draw-toolbar-sizes {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.8rem;
    margin-top: 0.8rem;
}

.size-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 0.5rem;
    transition: background-color 0.2s ease;
}

.size-option:hover {
    background-color: #f9fafb;
}

.size-option.selected {
    background-color: #e0e7ef;
}

.size-preview {
    background-color: #666;
    border-radius: 50%;
    margin-bottom: 0.3rem;
}

.size-label {
    font-size: 0.75rem;
    color: #666;
    font-weight: 500;
}

.draw-toolbar {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: 0;
    width: 100%;
    max-width: 480px;
    background: rgba(255,255,255,0.8);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-top-left-radius: 1.25rem;
    border-top-right-radius: 1.25rem;
    border-top: 1px solid rgba(255,255,255,0.7);
    box-shadow: 0 -10px 30px rgba(0,0,0,0.12);
    padding: 0.8rem 0.6rem 1.3rem 0.6rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    z-index: 102;
}

.draw-toolbar-btn {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #000;
    outline: none;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0,0,0,0.25);
    transition: transform 0.15s, box-shadow 0.15s, background 0.15s, border-color 0.15s;
}
.draw-toolbar-btn svg { fill: #fff; }
.draw-toolbar-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(0,0,0,0.18);
}

.draw-toolbar-btn.selected, .draw-toolbar-btn:active {
    background: #000;
    border-color: #111;
    box-shadow: 0 0 0 3px rgba(255,255,255,0.15), 0 10px 24px rgba(0,0,0,0.35);
    transform: scale(1.2);
}

.hidden { 
    display: none !important; 
}

@media (max-width: 400px) {
    #stone-colors {
        display: none !important;
    }
    #color-picker-container {
        display: none !important;
    }
    #color-picker-container.active {
        display: flex !important;
        justify-content: center;
        align-items: center;
        margin-top: 0.5rem;
        margin-bottom: 0.2rem;
    }
}

#color-picker-container {
    display: none;
}

#color-picker {
    display: none;
}

#color-picker-wrapper {
    position: relative;
    width: 2.1rem;
    height: 2.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

#diamond-preview {
    width: 2.1rem;
    height: 2.1rem;
    cursor: pointer;
    display: block;
}

/* Modal pour les couleurs de pierres */
#stone-color-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

/* Sur PC, limiter le backdrop du modal au conteneur */
@media (min-width: 768px) {
    #stone-color-modal, #size-modal, #download-modal {
        left: 50%;
        /* transform: translateX(-50%); */
        /* width: 480px; */
        max-width: 100vw;
    }
}

#stone-color-modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 1.5rem;
    padding: 2rem;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
    max-width: 90vw;
    max-height: 90vh;
}

.modal-title {
    font-size: 1.2rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 1.5rem;
    color: #333;
}

.modal-colors {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.modal-color-option {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    border: 3px solid #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.modal-color-option:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}

.modal-color-option.selected {
    border: 3px solid #222;
    transform: scale(1.1);
}

.modal-close {
    width: 100%;
    padding: 0.8rem;
    background: #f3f4f6;
    border: none;
    border-radius: 0.8rem;
    font-size: 1rem;
    font-weight: 500;
    color: #666;
    cursor: pointer;
}

/* Bouton flottant pour la gestion des tailles */
.size-floating-btn {
    position: fixed;
    bottom: 6rem;
    right: calc(50% - 240px + 1.5rem);
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    background: #000000;
    color: white;
    border: none;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 103;
}

/* Sur mobile, repositionner le bouton à droite de l'écran */
@media (max-width: 480px) {
    .size-floating-btn {
        right: -0.5rem;
    }
}

.size-floating-btn:hover {
    background: #000000;
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.size-floating-btn:active {
    transform: scale(0.95);
}

/* Modal de gestion des tailles */
#size-modal, #download-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1001;
}

#size-modal.active, #download-modal.active {
    display: flex;
}

.size-section {
    margin-bottom: 1.5rem;
}

.size-section:last-of-type {
    margin-bottom: 2rem;
}

.modal-sizes {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
}

.modal-size-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    padding: 1rem;
    border-radius: 0.8rem;
    transition: all 0.2s ease;
    background: #f9fafb;
    border: 2px solid transparent;
    min-width: 4rem;
}

.modal-size-option:hover {
    background-color: #f3f4f6;
    transform: translateY(-2px);
}

.modal-size-option.selected {
    background-color: #dbeafe;
    border-color: #000000;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.modal-size-option .size-preview {
    background-color: #666;
    border-radius: 50%;
    margin-bottom: 0.5rem;
}

/* Champs et actions du modal de téléchargement */
.modal-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.modal-field label {
    font-size: 0.95rem;
    color: #444;
}
.modal-field input[type="email"] {
    padding: 0.8rem 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.8rem;
    font-size: 1rem;
    outline: none;
}
.modal-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}
.modal-primary {
    padding: 0.8rem 1rem;
    background: #000000;
    color: #fff;
    border: none;
    border-radius: 0.8rem;
    font-weight: 600;
    cursor: pointer;
}
.modal-error {
    margin-top: 0.75rem;
    color: #b91c1c;
    font-size: 0.95rem;
}

.modal-size-option .size-label {
    font-size: 0.8rem;
    color: #666;
    font-weight: 500;
}

.draw-toolbar-label {
    display: none;
}