@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Lobster&family=Montserrat:wght@400;700;800&family=Outfit:wght@300;400;500;600;700;800&family=Pacifico&family=Playfair+Display:ital,wght@0,700;1,700&family=Permanent+Marker&display=swap');

:root {
    --bg-gradient: linear-gradient(135deg, #0a0612 0%, #120c1f 50%, #05030a 100%);
    --accent-color: #7b2cbf;
    --accent-glow: rgba(123, 44, 191, 0.4);
    --secondary-color: #3f37c9;
    --secondary-glow: rgba(63, 55, 201, 0.4);
    --cyan-color: #4cc9f0;
    --cyan-glow: rgba(76, 201, 240, 0.4);
    --text-primary: #ffffff;
    --text-secondary: #b0aab9;
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-bg-hover: rgba(255, 255, 255, 0.06);
    --card-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
    --danger-color: #ff3366;
    --success-color: #00f5d4;
    --font-sans: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-gradient);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    position: relative;
}

/* Background floating abstract elements */
.bg-decorations {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.circle-decor {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.18;
    animation: float 20s infinite alternate ease-in-out;
}

.circle-1 {
    top: -10%;
    left: 5%;
    width: 45vw;
    height: 45vw;
    background: var(--accent-color);
}

.circle-2 {
    bottom: -10%;
    right: 5%;
    width: 40vw;
    height: 40vw;
    background: var(--secondary-color);
    animation-delay: -5s;
}

.circle-3 {
    top: 30%;
    right: 20%;
    width: 25vw;
    height: 25vw;
    background: var(--cyan-color);
    opacity: 0.1;
    animation-delay: -10s;
}

@keyframes float {
    0% { transform: translateY(0) scale(1); }
    100% { transform: translateY(50px) scale(1.1); }
}

/* Auth Cards / Form styling (keep for login/register compatibility) */
.auth-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    z-index: 10;
}

.glass-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: 24px;
    padding: 3rem 2.5rem;
    width: 100%;
    max-width: 480px;
    box-shadow: var(--card-shadow);
    transition: transform 0.3s ease, border-color 0.3s ease;
    animation: fadeIn 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.glass-card:hover {
    border-color: rgba(255, 255, 255, 0.12);
}

.auth-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.auth-logo {
    width: 70px;
    height: 70px;
    margin: 0 auto 1rem;
    background: linear-gradient(135deg, var(--cyan-color), var(--accent-color));
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 25px rgba(123, 44, 191, 0.3);
    position: relative;
}

.auth-logo svg {
    color: white;
}

.auth-logo::before {
    content: '';
    position: absolute;
    top: -5px;
    left: -5px;
    right: -5px;
    bottom: -5px;
    border-radius: 24px;
    background: linear-gradient(135deg, var(--cyan-color), var(--accent-color));
    z-index: -1;
    opacity: 0.3;
    filter: blur(8px);
}

.auth-title {
    font-size: 2.2rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(to right, #ffffff, #dcdcdc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.auth-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.form-group {
    margin-bottom: 1.5rem;
    position: relative;
}

.form-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 16px;
    color: var(--text-secondary);
    pointer-events: none;
    transition: color 0.3s ease;
}

.form-input {
    width: 100%;
    padding: 14px 16px 14px 48px;
    font-family: var(--font-sans);
    font-size: 1rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-primary);
    outline: none;
    transition: all 0.3s ease;
}

.form-input:focus {
    border-color: var(--cyan-color);
    box-shadow: 0 0 0 4px rgba(76, 201, 240, 0.15);
}

.form-input:focus + .input-icon {
    color: var(--cyan-color);
}

.pwd-requirements {
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    list-style-type: none;
    padding-left: 5px;
}

.pwd-requirements li {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 3px;
}

.pwd-requirements li.valid { color: var(--success-color); }
.pwd-requirements li.invalid { color: #ff88a8; }
.pwd-requirements li::before { content: '•'; }
.pwd-requirements li.valid::before { content: '✓'; }

.alert {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 1.5rem;
}

.alert-danger {
    background: rgba(255, 51, 102, 0.08);
    border: 1px solid rgba(255, 51, 102, 0.15);
    color: #ff6b8b;
}

.alert-success {
    background: rgba(0, 245, 212, 0.08);
    border: 1px solid rgba(0, 245, 212, 0.15);
    color: #55ffd8;
}

.auth-footer {
    text-align: center;
    margin-top: 2rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.auth-link {
    color: var(--cyan-color);
    text-decoration: none;
    font-weight: 600;
}

.auth-link:hover {
    text-decoration: underline;
}


/* ==========================================================================
   T-SHIRT CUSTOMIZER STUDIO (index.php)
   ========================================================================== */

.studio-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* En-tête */
.studio-header {
    background: rgba(10, 8, 20, 0.4);
    border-bottom: 1px solid var(--glass-border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 1rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 100;
}

.studio-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.studio-logo {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--secondary-color), var(--accent-color));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 4px 12px rgba(123, 44, 191, 0.3);
}

.studio-brand h1 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(to right, #fff, #b8b3c0);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.studio-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--cyan-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.user-display {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
}

.btn-logout {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--danger-color);
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-logout:hover {
    background: rgba(255, 51, 102, 0.1);
    border-color: rgba(255, 51, 102, 0.2);
    transform: scale(1.05);
}

.btn-add-item {
    background: var(--accent-color);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 8px;
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(123, 44, 191, 0.2);
}

.btn-add-item:hover {
    background: #8b3fd6;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(123, 44, 191, 0.3);
}

.btn-delete {
    width: 100%;
    background: rgba(255, 51, 102, 0.1);
    color: #ff6b8b;
    border: 1px solid rgba(255, 51, 102, 0.2);
    padding: 10px;
    border-radius: 10px;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 1rem;
}

.btn-delete:hover {
    background: rgba(255, 51, 102, 0.2);
    color: white;
    border-color: #ff3366;
}

/* Espace Principal (Split Screen) */
.studio-workspace {
    flex: 1;
    display: flex;
    overflow: hidden;
    height: calc(100vh - 69px);
}

/* Zone Aperçu T-shirt (Gauche) */
.preview-area {
    flex: 1.2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 1.5rem 2rem; /* Petite marge en haut */
    background: radial-gradient(circle at 50% 50%, rgba(20, 15, 35, 0.6) 0%, rgba(5, 3, 10, 0.9) 100%);
    position: relative;
    overflow: auto;
}

.canvas-container {
    width: 100%;
    max-width: 800px; /* Taille d'origine restaurée */
    margin: 0; /* Retire la marge automatique pour forcer l'alignement en haut */
}

.tshirt-canvas {
    width: 100%;
    height: auto;
    position: relative;
    user-select: none;
}

/* Canvas 4-vues */
.tshirt-4view-canvas {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 14px;
    background: transparent;
}

/* Label vue active (Supprimé dans le HTML, on garde au cas où) */
.active-view-label {
    display: none;
}

/* Zones d'impression positionnées sur le canvas 4-vues */
.printable-zone {
    position: absolute;
    border: 1px dashed rgba(255, 255, 255, 0.18);
    border-radius: 6px;
    z-index: 10;
    pointer-events: auto;
    overflow: hidden;
    transition: border-color 0.3s ease;
}

.printable-zone:hover {
    border-color: rgba(76, 201, 240, 0.35);
}

/* Zone d'édition unique (couvre toute l'image) */
.pz-active {
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
}

/* Éléments Personnalisables Déplaçables */
.drag-element {
    position: absolute;
    cursor: move;
    user-select: none;
    touch-action: none; /* Désactive les gestes par défaut sur mobile pour le drag */
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    padding: 6px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    z-index: 20;
}

.drag-element:hover {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.02);
}

/* Élément Actif (Sélectionné) */
.drag-element.active-element {
    border: 1px dashed var(--cyan-color);
    background: rgba(76, 201, 240, 0.05);
    box-shadow: 0 0 10px rgba(76, 201, 240, 0.1);
}

/* Indicateur de poignée sur la sélection */
.element-handle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: var(--cyan-color);
    border: 1px solid white;
    border-radius: 50%;
    display: none;
}

.drag-element.active-element .element-handle {
    display: block;
    bottom: -4px;
    right: -4px;
    cursor: se-resize;
}

/* Contenu Texte */
.element-text {
    font-weight: 700;
    white-space: nowrap;
    text-transform: uppercase;
    text-align: center;
    line-height: 1.1;
}

/* Contenu Image */
.element-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
    pointer-events: none;
}

/* Zone Commandes (Droite) */
.controls-area {
    flex: 0.8;
    background: rgba(10, 8, 20, 0.35);
    border-left: 1px solid var(--glass-border);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    padding: 2rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.control-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.control-card:hover {
    border-color: rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
}

.card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 1rem;
}

/* En-tête de carte avec bouton d'activation */
.card-header-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.card-header-toggle .card-title {
    margin-bottom: 0;
}

.control-subgroup {
    transition: opacity 0.3s ease, pointer-events 0.3s ease;
}

.disabled-subgroup {
    opacity: 0.3;
    pointer-events: none;
}

/* Sélecteur Flottant Face / Dos */
.view-toggle-container {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    background: rgba(10, 8, 20, 0.6);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 4px;
    z-index: 100;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.view-btn {
    background: transparent;
    border: none;
    padding: 8px 16px;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.view-btn:hover {
    color: white;
}

.view-btn.active {
    background: var(--accent-color);
    color: white;
    box-shadow: 0 0 10px var(--accent-glow);
}

/* Grille de sélecteurs de couleur (T-shirts miniatures réactifs) */
.color-picker-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 8px;
}

.color-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.color-btn:hover {
    transform: translateY(-4px) scale(1.12);
}

.mini-tshirt-svg {
    width: 100%;
    height: auto;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.25));
    transition: filter 0.2s ease, color 0.2s ease;
    color: rgba(255, 255, 255, 0.12); /* Couleur de contour par défaut */
}

.color-btn:hover .mini-tshirt-svg {
    color: rgba(255, 255, 255, 0.4);
}

.color-btn.active .mini-tshirt-svg {
    color: var(--cyan-color);
    filter: drop-shadow(0 0 10px var(--cyan-glow)) drop-shadow(0 4px 6px rgba(0, 0, 0, 0.3));
}

/* Formulaires dans le panneau de commandes */
.form-group-custom {
    margin-bottom: 1.2rem;
}

.form-group-custom:last-child {
    margin-bottom: 0;
}

.form-group-custom label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.4rem;
}

.studio-input {
    width: 100%;
    padding: 12px;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: white;
    outline: none;
    transition: border-color 0.3s ease;
}

.studio-input:focus {
    border-color: var(--cyan-color);
}

.studio-select {
    width: 100%;
    padding: 12px;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    background: rgba(10, 8, 20, 0.9);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: white;
    outline: none;
    cursor: pointer;
}

.studio-select:focus {
    border-color: var(--cyan-color);
}

/* Color picker pour le texte */
.color-picker-text-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.studio-color-input {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 48px;
    height: 38px;
    background: transparent;
    border: none;
    cursor: pointer;
}

.studio-color-input::-webkit-color-swatch {
    border-radius: 8px;
    border: 1px solid var(--glass-border);
}

.color-code {
    font-size: 0.9rem;
    font-family: monospace;
    color: var(--text-secondary);
}

/* Sliders de taille */
.range-labels {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.4rem;
}

.range-labels label {
    margin-bottom: 0;
}

.range-value {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--cyan-color);
}

.studio-range {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    outline: none;
}

.studio-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--cyan-color);
    cursor: pointer;
    box-shadow: 0 0 10px var(--cyan-color);
    transition: transform 0.1s ease;
}

.studio-range::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

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

.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.1);
    transition: .3s;
    border-radius: 34px;
    border: 1px solid var(--glass-border);
}

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

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

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

/* File Upload Button */
.file-upload-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px dashed var(--glass-border);
    padding: 12px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
    color: var(--text-primary);
}

.file-upload-label:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--cyan-color);
}

.file-upload-label input[type="file"] {
    display: none;
}

.file-name-info {
    display: block;
    margin-top: 0.4rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Actions principales (Export) */
.studio-actions {
    margin-top: auto;
    padding-top: 1rem;
}

.btn-primary {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--accent-color) 100%);
    border: none;
    border-radius: 12px;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 4px 15px rgba(123, 44, 191, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(123, 44, 191, 0.5);
    filter: brightness(1.1);
}

.btn-primary:active {
    transform: translateY(1px);
}

/* ==========================================================================
   Ajustements pour Mobiles
   ========================================================================== */

@media (max-width: 900px) {
    .studio-workspace {
        flex-direction: column;
        overflow-y: auto;
        height: auto;
    }
    .preview-area {
        flex: none;
        height: auto;
        min-height: 300px;
        padding: 3.5rem 1.5rem 1.5rem;
    }
    .controls-area {
        flex: none;
        border-left: none;
        border-top: 1px solid var(--glass-border);
        padding: 1.5rem;
        overflow-y: visible;
        height: auto;
    }
    .canvas-container {
        max-width: 100%;
    }
}


