/* ========================================
   ÉDITEUR DE JEUX DE CARTES - CSS MODERNE CORRIGÉ
   ======================================== */

/* Reset et base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    color: #ffffff;
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}
body, html {
    width: 100vw;
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

.container {
    display: flex;
    flex-direction: row;
    height: 100vh;
    width: 100vw;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

/* ========== PANNEAU GAUCHE ========== */
.left-panel {
    background: #181a22;
    color: #fff;
    min-width: 260px;
    max-width: 380px;
    width: 22vw;
    flex: 0 0 22vw;
    display: flex;
    flex-direction: column;
    border-right: 2px solid #ffd700;
    overflow-y: auto;
    box-sizing: border-box;
}


.left-panel::-webkit-scrollbar {
    width: 6px;
}
.left-panel::-webkit-scrollbar-thumb {
    background: #ffd700;
    border-radius: 3px;
}

/* Header Section */
.header-section {
    text-align: center;
    margin-bottom: 30px;
    padding: 20px 0;
    border-bottom: 2px solid rgba(255, 215, 0, 0.3);
}
.header-section h1 {
    font-size: 1.8em;
    background: linear-gradient(45deg, #ffd700, #ffed4e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}
.subtitle {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9em;
}

/* Tool Groups */
.tool-group {
    margin-bottom: 25px;
}
.tool-group h3 {
    color: #ffd700;
    font-size: 1.1em;
    margin-bottom: 15px;
    padding-left: 10px;
    border-left: 3px solid #ffd700;
}

/* Tool Buttons */
.tool-btn {
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 10px;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
	justify-content: space-between;
    align-items: center;
    gap: 12px;
    position: relative;
    overflow: hidden;
}
.tool-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 215, 0, 0.3);
    border-color: rgba(255, 215, 0, 0.5);
}
.tool-btn.primary { background: linear-gradient(135deg, rgba(255,215,0,0.2), rgba(255,215,0,0.1)); border-color: rgba(255,215,0,0.4);}
.tool-btn.secondary { background: linear-gradient(135deg, rgba(102,103,234,0.2), rgba(102,103,234,0.1)); border-color: rgba(102,103,234,0.4);}
.tool-btn.accent { background: linear-gradient(135deg, rgba(220,53,69,0.2), rgba(220,53,69,0.1)); border-color: rgba(220,53,69,0.4);}
.tool-btn.success { background: linear-gradient(135deg, rgba(40,167,69,0.2), rgba(40,167,69,0.1)); border-color: rgba(40,167,69,0.4);}
.tool-btn.info { background: linear-gradient(135deg, rgba(23,162,184,0.2), rgba(23,162,184,0.1)); border-color: rgba(23,162,184,0.4);}
.language-option { background: linear-gradient(135deg, rgba(23,162,184,0.2), rgba(23,162,184,0.1)); border-color: rgba(23,162,184,0.4);}
.count-option { background: linear-gradient(135deg, rgba(23,162,184,0.2), rgba(23,162,184,0.1)); border-color: rgba(23,162,184,0.4);height: 50px;color: #ffffff;}

/* DropDown (menu déroulant sous les boutons) */
.dropdown-menu {
    display: none;
    position: absolute;
    left: 0; top: 450px;
    background: #222;
    border: 1px solid #ffd700;
    z-index: 200;
    border-radius: 10px;
    padding: 10px;
    min-width: 220px;
	max-height: 350px;
    box-shadow: 0 6px 24px rgba(0,0,0,0.3);
	overflow: auto;
	width: 450px;
}
.dropdown-menu.active { display: block; }
.dropdown-menu img {
    width: 40px;
    margin: 6px;
    cursor: pointer;
    border-radius: 6px;
    border: 2px solid transparent;
    background: #222;
}
.dropdown-menu img:hover { border: 2px solid #ffd700; background: #333; }
.dropdown-menu button { margin: 5px; }

/* ========== TEMPLATES ========== */
.template-select {
    width: 100%;
    padding: 10px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: #ffffff;
    font-size: 0.9em;
    cursor: pointer;
    margin-top: 8px;
    margin-bottom: 8px;
}
.template-preview-area {
    margin-top: 10px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    display: flex;
    gap: 10px;
    align-items: center;
}
.template-mini-preview {
    width: 40px;
    height: 60px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7em;
    color: rgba(255, 255, 255, 0.7);
}

/* ========== CALQUES ========== */
.layers-section {
    margin-bottom: 25px;
}
.layers-section h3 {
    color: #ffd700;
    font-size: 1.1em;
    margin-bottom: 15px;
    padding-left: 10px;
    border-left: 3px solid #ffd700;
}
.layers-list {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 10px;
    min-height: 100px;
}
.layer-item {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    padding: 8px 10px;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.3s ease;
}
.layer-item:hover {
    background: rgba(255, 255, 255, 0.2);
}
.layer-item.selected {
    background: rgba(255, 215, 0, 0.2);
    border: 1px solid rgba(255, 215, 0, 0.5);
}
.layer-name {
    font-size: 0.9em;
    color: #ffffff;
}
.layer-controls {
    display: flex;
    gap: 5px;
}
.layer-control-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 4px;
    width: 25px;
    height: 25px;
    color: #ffffff;
    cursor: pointer;
    font-size: 0.8em;
    transition: all 0.3s ease;
}
.layer-control-btn:hover {
    background: rgba(255, 215, 0, 0.3);
}

/* ========== PANIER ========== */
.cart-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 215, 0, 0.3);
}
.cart-btn {
    width: 100%;
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    border: none;
    border-radius: 12px;
    padding: 15px;
    color: #1a1a2e;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 10px;
}
.cart-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 215, 0, 0.4);
}
#order-form-btn {
    width: 100%;
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    border: none;
    border-radius: 12px;
    padding: 15px;
    color: #1a1a2e;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 10px;
}
#order-form-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 215, 0, 0.4);
}
.cart-count {
    background: #1a1a2e;
    color: #ffd700;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.9em;
    min-width: 20px;
}

/* ========== PANNEAU DROIT ========== */
.right-panel {
    background: #1d2335;
    flex: 1 1 56vw;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: auto;
    box-sizing: border-box;
}
.canvas-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(255, 215, 0, 0.3);
}
.canvas-header h2 {
    color: #ffd700;
    font-size: 1.5em;
}
.canvas-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 5px;
}
.canvas-info span {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9em;
}
.canvas-container {
    flex: 1;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: inset 0 0 50px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    width: 100%;
    height: 750px;
    overflow: hidden;
}
#card-canvas {
    border: 2px solid #ffd700;
    border-radius: 10px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    max-width: 100%;
    max-height: 100%;
    display: block;
}
.canvas-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
}
.control-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}
.control-btn.danger {
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: white;
}
.control-btn.success {
    background: linear-gradient(135deg, #28a745, #218838);
    color: white;
}
.control-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

/* ========== POPUPS ========== */
.popup-overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.4);
    z-index: 1000;
    display: none;
}
.popup-overlay.active { display: block; }
.popup-content {
    position: fixed;
    top: 50%;
    left: 50%;
    min-width: 520px;
    max-width: 96vw;
    max-height: 96vh;
    background: #0a0909;
    z-index: 1001;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.25);
    transform: translate(-50%, -50%);
    display: none;
    padding: 1.5em 1.2em;
    overflow: auto;
}
.popup-content.active { display: block; }

.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}
.game-card {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
	color: #ffffff;
}
#language-options {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 15px 10px;
    color: #ffffff;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
}
.game-card:hover {
    background: rgba(255, 215, 0, 0.1);
    border-color: rgba(255, 215, 0, 0.5);
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(255, 215, 0, 0.2);
}

/* ========== RESPONSIVE ========== */
/* @media (max-width: 1200px) { */
    /* .container { grid-template-columns: 280px 1fr; } */
    /* .left-panel { min-width: 280px; padding: 10px; } */
/* } */
/* @media (max-width: 900px) { */
    /* .container { grid-template-columns: 200px 1fr; } */
    /* .left-panel { min-width: 200px; padding: 6px; } */
/* } */
/* @media (max-width: 700px) { */
    /* .container { grid-template-columns: 1fr; grid-template-rows: auto 1fr; } */
    /* .left-panel { max-height: 40vh; min-width: 0; padding: 6px; } */
    /* .right-panel { height: 60vh; min-width: 0; } */
    /* .games-grid { grid-template-columns: 1fr; } */
/* } */
/* Style du bouton "Bon de commande" */

/* Style général du popup bon de commande */
#order-form-popup {
    display: none;
    position: fixed;
    top: 6%;
    left: 58vw; /* Décalé à droite, ajuste si besoin (ex: 60vw) */
    transform: translateX(-10%); /* Pour que la popin s'avance un peu au centre de la zone blanche */
    width: 420px;
    max-width: 98vw;
    max-height: 86vh;
    overflow-y: auto;
    background: #181b1e;
    border: 3px solid #FFD700;
    border-radius: 16px;
    box-shadow: 0 6px 60px 0 rgba(0,0,0,0.40);
    color: #fff;
    z-index: 9999;
    padding: 28px 32px 28px 32px;
    font-family: inherit;
}

#order-form-popup h2, #order-form-popup legend {
    color: #FFD700;
    margin-bottom: 14px;
    letter-spacing: 0.01em;
}

#order-form-popup input,
#order-form-popup select,
#order-form-popup button {
    background: #21242a;
    color: #fff;
    border: 1px solid #FFD700;
    border-radius: 6px;
    padding: 7px 10px;
    margin-bottom: 10px;
    font-size: 1em;
    width: 100%;
    box-sizing: border-box;
    outline: none;
    transition: border 0.18s, background 0.16s;
}

#order-form-popup input:focus,
#order-form-popup select:focus {
    border: 2px solid #FFD700;
    background: #25282f;
}

#order-form-popup button[type="submit"] {
    background: linear-gradient(90deg,#FFD700 0%,#ffdb58 100%);
    color: #222;
    font-weight: bold;
    font-size: 1.08em;
    border: 0;
    border-radius: 7px;
    padding: 12px 24px;
    margin-right: 12px;
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.11);
    cursor: pointer;
    transition: background 0.18s, box-shadow 0.15s, color 0.15s;
    width: auto;
    min-width: 160px;
}

#order-form-popup button[type="submit"]:hover {
    background: linear-gradient(90deg, #FFD700 0%, #ffe066 100%);
    color: #000;
}

#order-form-popup button[type="button"] {
    background: #222;
    color: #FFD700;
    border: 1.5px solid #FFD700;
    margin-left: 8px;
    min-width: 100px;
}

#order-form-popup a {
    color: #FFD700;
    text-decoration: underline;
}

#order-form-popup label {
    color: #FFD700;
    font-weight: 500;
    margin-bottom: 3px;
    display: block;
}

#order-form-popup fieldset {
    border-radius: 8px;
    border: 1.5px solid #FFD700;
    margin-bottom: 13px;
    background: #20232a;
}

#order-form-popup input[type="checkbox"],
#order-form-popup input[type="radio"] {
    width: auto;
    margin-right: 7px;
    accent-color: #FFD700;
    vertical-align: middle;
}

#order-designs-list img {
    border: 1.2px solid #FFD700;
    border-radius: 4px;
    margin-top: 4px;
    margin-bottom: 6px;
}

/* Pour les champs de carte de crédit côte à côte */
#credit-card-fields input[type="text"] {
    display: inline-block;
    width: 48%;
}

#credit-card-fields input[name="cc_exp"] {
    margin-right: 2%;
}

#credit-card-fields input[name="cc_cvc"] {
    float: right;
}

/* Scrollbar stylée (optionnel) */
#order-form-popup {
    display: none;
    position: fixed;
    top: 6%;
    left: 58vw; /* Décalé à droite, ajuste si besoin (ex: 60vw) */
    transform: translateX(-10%); /* Pour que la popin s'avance un peu au centre de la zone blanche */
    width: 420px;
    max-width: 98vw;
    max-height: 86vh;
    overflow-y: auto;
    background: #181b1e !important;
    border: 3px solid #FFD700;
    border-radius: 16px;
    box-shadow: 0 6px 60px 0 rgba(0,0,0,0.40);
    color: #fff;
    z-index: 9999;
    padding: 28px 32px 28px 32px;
    font-family: inherit;
}

#order-form-popup h2, #order-form-popup legend {
    color: #FFD700;
    margin-bottom: 14px;
    letter-spacing: 0.01em;
}

#order-form-popup input,
#order-form-popup select,
#order-form-popup button {
    background: #21242a;
    color: #fff;
    border: 1px solid #FFD700;
    border-radius: 6px;
    padding: 7px 10px;
    margin-bottom: 10px;
    font-size: 1em;
    width: 100%;
    box-sizing: border-box;
    outline: none;
    transition: border 0.18s, background 0.16s;
}

#order-form-popup input:focus,
#order-form-popup select:focus {
    border: 2px solid #FFD700;
    background: #25282f;
}

#order-form-popup button[type="submit"] {
    background: linear-gradient(90deg,#FFD700 0%,#ffdb58 100%);
    color: #222;
    font-weight: bold;
    font-size: 1.08em;
    border: 0;
    border-radius: 7px;
    padding: 12px 24px;
    margin-right: 12px;
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.11);
    cursor: pointer;
    transition: background 0.18s, box-shadow 0.15s, color 0.15s;
    width: auto;
    min-width: 160px;
}

#order-form-popup button[type="submit"]:hover {
    background: linear-gradient(90deg, #FFD700 0%, #ffe066 100%);
    color: #000;
}

#order-form-popup button[type="button"] {
    background: #222;
    color: #FFD700;
    border: 1.5px solid #FFD700;
    margin-left: 8px;
    min-width: 100px;
}

#order-form-popup a {
    color: #FFD700;
    text-decoration: underline;
}

#order-form-popup label {
    color: #FFD700;
    font-weight: 500;
    margin-bottom: 3px;
    display: block;
}

#order-form-popup fieldset {
    border-radius: 8px;
    border: 1.5px solid #FFD700;
    margin-bottom: 13px;
    background: #20232a;
}

#order-form-popup input[type="checkbox"],
#order-form-popup input[type="radio"] {
    width: auto;
    margin-right: 7px;
    accent-color: #FFD700;
    vertical-align: middle;
}

#order-designs-list img {
    border: 1.2px solid #FFD700;
    border-radius: 4px;
    margin-top: 4px;
    margin-bottom: 6px;
}

/* Pour les champs de carte de crédit côte à côte */
#credit-card-fields input[type="text"] {
    display: inline-block;
    width: 48%;
}

#credit-card-fields input[name="cc_exp"] {
    margin-right: 2%;
}

#credit-card-fields input[name="cc_cvc"] {
    float: right;
}

/* Scrollbar stylée (optionnel) */
#order-form-popup::-webkit-scrollbar {
    width: 10px;
    background: #222;
}
#order-form-popup::-webkit-scrollbar-thumb {
    background: #FFD700;
    border-radius: 7px;
}

@media (max-width: 800px) {
    #order-form-popup {
        left: 50vw;
        width: 95vw;
        min-width: 0;
        padding: 12px 5vw;
        top: 2%;
    }
}
.btn-number {
    background: #ffd700;
    color: #1a1a2e;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9em;
}
/* COLONNE IA à droite */
.ia-panel {
    background: #24273a;
    color: #fff;
    min-width: 560px;
    max-width: 380px;
    width: 22vw;
    flex: 0 0 22vw;
    display: flex;
    flex-direction: column;
    border-left: 2px solid #ffd700;
    overflow-y: auto;
    box-sizing: border-box;
	padding-left: 32px;   /* décale tout le contenu vers la droite */
    padding-right: 18px;  /* pour l'esthétique, optionnel */
}
.ia-help {
    margin-bottom: 26px;
}
.ia-gen-zone {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 18px;
}
#ia-prompt-input {
    width: 100%;
    min-height: 40px;
    padding: 8px;
    font-size: 1.05em;
    border-radius: 6px;
    border: 1px solid #FFD700;
    background: #191d2b;
    color: #fff;
    margin-bottom: 6px;
    resize: vertical;
}
.btn-ia-gen {
    width: 100%;
    padding: 10px;
    font-size: 1.09em;
    background: #ffd700;
    color: #24273a;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: bold;
}
.ia-gallery-zone {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
}
.ia-gallery-zone h4 {
    margin: 0 0 8px 0;
    font-size: 1.1em;
    color: #FFD700;
}
.ia-gallery {
    flex: 1 1 auto;
    min-height: 120px;
    overflow-y: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.ia-img-card {
    background: #fff;
    border-radius: 7px;
    padding: 6px 6px 4px 6px; /* Tu peux réduire le padding bas ici si besoin, ex: 6px 6px 0 6px */
    box-shadow: 0 2px 12px #0002;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 80px;
    position: relative;
    min-height: unset !important; /* Ajoute cette ligne pour enlever toute hauteur minimale héritée */
    height: 140px !important;      /* Ajoute cette ligne pour forcer l'ajustement à la hauteur du contenu */
    margin-bottom: 10px;          /* Optionnel : espace entre les cartes, ajuste si besoin */
}
.ia-img-card img {
    width: 68px;
    height: 96px;
    object-fit: contain;
    border-radius: 4px;
    margin-bottom: 3px;
    background: #eee;
    cursor: pointer;
}
.ia-img-card .del-btn {
    position: absolute;
    top: 3px;
    right: 5px;
    background: #d22;
    color: #fff;
    border-radius: 50%;
    border: none;
    width: 18px;
    height: 18px;
    font-size: 1em;
    cursor: pointer;
    line-height: 1;
}
.ia-img-card .dl-btn {
    position: absolute;
    top: 3px;
    left: 5px;
    background: #FFD700;
    color: #24273a;
    border-radius: 50%;
    border: none;
    width: 18px;
    height: 18px;
    font-size: 1em;
    cursor: pointer;
    line-height: 1;
}
.ia-img-card .add-btn {
    font-size: 0.8em;
    margin-top: 2px;
    background: #FFD700;
    color: #24273a;
    border: none;
    border-radius: 5px;
    padding: 2px 6px;
    cursor: pointer;
}
.ia-img-card .prompt {
    font-size: 0.75em;
    color: #444;
    margin-top: 2px;
    text-align: center;
    word-break: break-word;
}
@media (max-width: 950px) {
    .container {
        flex-direction: column;
        height: auto;
        width: 100vw;
    }
    .left-panel,
    .right-panel,
    .ia-panel {
        width: 100vw !important;
        min-width: 0;
        max-width: 100vw;
        height: auto;
        flex: none;
    }
}
.prompt { display: none !important; }
.btn-del-all {
    display: block;
    margin: 0 0 8px 0;
    padding: 5px 10px;
    background: #d22;
    color: #fff;
    border: none;
    border-radius: 5px;
    font-size: 0.98em;
    cursor: pointer;
    font-weight: bold;
}
