/* Gift Designer Layout */
#gift-designer-app {
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.gd-layout {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.gd-sidebar-left {
    flex: 0 0 280px;
    background: #fff;
    padding: 15px;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.gd-sidebar-right {
    flex: 0 0 300px;
    background: #fff;
    padding: 20px;
    border-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.gd-canvas-area {
    flex: 1;
    min-width: 300px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #f0f2f5;
    border-radius: 4px;
    padding: 20px;
    position: relative;
    min-height: 500px;
    align-self: flex-start;
    /* Prevent stretching with sidebars */
}

.canvas-container {
    background: #fff;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    width: 100% !important;
}

/* Color Swatches & Layer Group */
.gd-color-group,
.gd-layer-group {
    margin-bottom: 20px;
    background: #fff;
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.gd-tool-group h3 {
    margin-top: 0;
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
    text-align: center;
}

.gd-color-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.gd-swatch {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid rgba(0, 0, 0, 0.1);
    transition: transform 0.1s;
}

.gd-swatch:hover,
.gd-swatch.active {
    transform: scale(1.1);
    box-shadow: 0 0 0 2px #007cba;
}

/* Menu Items */
.gd-menu-items {
    display: flex;
    flex-direction: column;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    padding: 0;
}

.gd-menu-item {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    background: #fff;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background 0.2s;
}

.gd-menu-item:last-child {
    border-bottom: none;
}

.gd-menu-item:hover {
    background: #f9f9f9;
}

.gd-menu-item.active {
    background: #007cba;
    color: #fff;
}

.gd-icon {
    margin-right: 10px;
    display: flex;
    align-items: center;
}

.gd-label {
    font-weight: 500;
}

/* Panels */
.gd-panel {
    display: none;
    animation: fadeIn 0.3s;
}

.gd-panel.active {
    display: block;
    margin-bottom: 20px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* UI Elements */
.gd-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 13px;
    line-height: 1.4;
    height: auto;
    box-shadow: none;
    background: #fff;
    margin: 0;
}

#gd-text-input {
    margin-bottom: 10px;
}

/* Override Hello Elementor Theme Buttons */
#gift-designer-app [type="button"],
#gift-designer-app [type="submit"],
#gift-designer-app button {
    background: #007cba;
    color: #fff;
    border: 1px solid #007cba;
    padding: 8px 16px;
    border-radius: 40x;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    box-shadow: none;
    text-transform: none;
    letter-spacing: normal;
    line-height: 1.4;
    margin: 0;
}

#gift-designer-app [type="button"]:hover,
#gift-designer-app [type="submit"]:hover,
#gift-designer-app button:hover {
    background: #006ba1;
    border-color: #006ba1;
    color: #fff;
}

button#gd-add-text-btn.button.gd-btn-primary {
    background: #007cba;
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    width: 100%;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
}

button#gd-add-text-btn.button.gd-btn-primary:hover {
    background: #006ba1;
}

.button.gd-btn-secondary {
    background: #f0f0f1;
    color: #333;
    border: 1px solid #ddd;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    width: 100%;
    text-align: center;
    font-size: 14px;
    font-weight: 500;
}

.button.gd-btn-secondary:hover {
    background: #e5e5e5;
}

/* Text Controls */
.gd-text-controls {
    margin-bottom: 15px;
}

.gd-control-row {
    margin-bottom: 10px;
    padding: 0;
}

.gd-control-row label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 4px;
    color: #333;
    text-transform: none;
    letter-spacing: normal;
    line-height: 1.4;
    padding: 0;
}

/* 2-Column Layout */
.gd-row-2col {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin-bottom: 10px;
}

.gd-row-2col .gd-col {
    flex: 1;
    min-width: 0;
}

.gd-row-2col .gd-col label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    margin-bottom: 4px;
    color: #333;
}

.gd-select {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    font-size: 13px;
    height: auto;
    line-height: normal;
    box-shadow: none;
    margin: 0;
}

.gd-color-input {
    width: 100%;
    height: 36px;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    padding: 2px;
    box-shadow: none;
    background: #fff;
    margin: 0;
}

.gd-color-input-small {
    width: 50px;
    height: 32px;
    border: 1px solid #ddd;
    border-radius: 4px;
    cursor: pointer;
    padding: 2px;
    box-shadow: none;
    background: #fff;
    margin: 0;
}

.gd-number-input {
    width: 60px;
    padding: 6px 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: center;
    font-size: 13px;
    height: auto;
    line-height: normal;
    box-shadow: none;
    background: #fff;
    margin: 0;
}

.gd-button-group {
    display: flex;
    gap: 5px;
    flex-wrap: nowrap;
}

/* Style & Align Buttons - Exception to override */
#gift-designer-app .gd-style-btn,
#gift-designer-app .gd-align-btn,
#gift-designer-app .gd-icon-btn,
#gift-designer-app .gd-flip-btn {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    box-shadow: none;
    font-size: 13px;
    font-weight: 500;
    line-height: 1;
    text-transform: none;
    letter-spacing: normal;
    margin: 0;
    color: #333;
    text-decoration: none;
}

#gift-designer-app .gd-style-btn:hover,
#gift-designer-app .gd-align-btn:hover,
#gift-designer-app .gd-icon-btn:hover,
#gift-designer-app .gd-flip-btn:hover {
    background: #f0f0f1;
    border-color: #999;
    color: #333;
}

#gift-designer-app .gd-style-btn.active,
#gift-designer-app .gd-align-btn.active {
    background: #007cba;
    color: #fff;
    border-color: #007cba;
}

.gd-style-btn svg,
.gd-align-btn svg,
.gd-icon-btn svg,
.gd-flip-btn svg {
    width: 16px;
    height: 16px;
    display: block;
    margin-right: 4px;
}

.gd-flip-btn svg {
    margin-right: 0;
}

.gd-inline-group {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: nowrap;
}

/* Grid List */
.gd-grid-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 10px;
    max-height: 300px;
    overflow-y: auto;
}

.gd-grid-list p {
    grid-column: 1 / -1;
    width: 100%;
}

.gd-grid-item {
    cursor: pointer;
    border: 1px solid #eee;
    border-radius: 4px;
    overflow: hidden;
    transition: border-color 0.2s;
}

.gd-grid-item:hover,
.gd-grid-item.active {
    border-color: #007cba;
}

.gd-grid-item img {
    width: 100%;
    height: auto;
    display: block;
}

/* Layer List */
#gd-layer-list {
    list-style: none;
    padding: 0;
    padding-left: 0;
    margin: 0;
}

#gd-layer-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border: 1px solid #ddd;
    background: #fff;
    margin-bottom: 8px;
    border-radius: 4px;
    transition: box-shadow 0.2s, border-color 0.2s;
}

#gd-layer-list li:hover {
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    border-color: #bbb;
}

#gd-layer-list li:last-child {
    margin-bottom: 0;
}

.gd-layer-info {
    display: flex;
    align-items: center;
    flex: 1;
    overflow: hidden;
    font-size: 14px;
    color: #333;
}

.gd-layer-handle {
    cursor: grab;
    margin-right: 10px;
    color: #666;
    display: flex;
    align-items: center;
    padding: 2px;
}

.gd-layer-handle:hover {
    color: #333;
}

.gd-layer-handle:active {
    cursor: grabbing;
}

/* Delete Icon */
#gift-designer-app .gd-remove-layer {
    background: none;
    border: none;
    cursor: pointer;
    color: #999;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    transition: all 0.2s ease;
    margin-left: 5px;
    width: 24px;
    height: 24px;
    min-width: 24px;
    box-shadow: none;
    text-decoration: none;
    font-size: 14px;
    line-height: 1;
}

#gift-designer-app .gd-remove-layer:hover {
    background: #fee;
    color: #d63638;
    box-shadow: none;
}

.gd-remove-layer svg {
    width: 16px;
    height: 16px;
    display: block;
}

/* Right Sidebar */
.gd-product-info h3 {
    margin-top: 0;
    font-size: 18px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.gd-sizes table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 15px;
}

.gd-sizes th,
.gd-sizes td {
    padding: 8px;
    text-align: center;
    border: 1px solid #eee;
}

.gd-sizes input[type="number"] {
    width: 50px;
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 4px;
}

.gd-pricing {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 4px;
    margin-top: 20px;
}

.gd-pricing p {
    margin: 5px 0;
    display: flex;
}

.gd-pricing p span {
    margin-left: auto;
}

.gd-pricing p.total strong {
    display: flex;
    width: 100%;
}

.gd-pricing .total {
    font-size: 18px;
    color: #d63638;
    margin-top: 10px;
    border-top: 1px solid #ddd;
    padding-top: 10px;
    font-weight: bold;
    display: block;
}

button#gd-add-to-cart {
    width: 100%;
    margin-top: 20px;
    font-size: 16px;
    padding: 12px;
    background: #d63638;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

button#gd-add-to-cart:hover {
    background: #a82a2c;
}

/* Responsive */
@media (max-width: 1024px) {
    .gd-layout {
        flex-direction: column;
    }

    .gd-sidebar-left,
    .gd-canvas-area,
    .gd-sidebar-right {
        flex: auto;
        width: 100%;
    }

    .gd-canvas-area {
        min-height: 300px;
    }
}

/* Specific Flip Button Styles */
#gd-text-flip-h,
#gd-text-flip-v {
    width: 100%;
    gap: 5px;
}

.gd-my-designs-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.gd-my-designs-actions button {
    flex: 1;
}

/* Canvas Controls (Undo/Redo) */
.gd-canvas-controls {
    position: absolute;
    top: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 1;
    background: rgba(255, 255, 255, 0.9);
    padding: 5px;
    border-radius: 20px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.gd-control-btn {
    background: transparent !important;
    border: none !important;
    padding: 5px 10px !important;
    cursor: pointer;
    color: #333 !important;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    min-width: auto !important;
}

.gd-control-btn:hover {
    background: rgba(0, 0, 0, 0.05) !important;
    color: #007cba !important;
}

.gd-control-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.gd-control-btn svg {
    width: 20px;
    height: 20px;
}

.gd-design-list {
    padding-left: 0;
    list-style: none;
}

.gd-design-list li {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.gd-design-list li img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    margin-right: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.gd-design-list li span {
    flex-grow: 1;
    font-size: 14px;
    font-weight: 500;
    margin-right: 10px;
}

.gd-design-list li .gd-design-actions {
    display: flex;
    gap: 5px;
}

#gift-designer-app .gd-design-list li button.gd-load-design,
#gift-designer-app .gd-design-list li button.gd-delete-design {
    background: transparent;
    border: none;
    padding: 0 4px;
    height: 24px;
    min-width: 24px;
    border-radius: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
    color: #a0a0a0;
    /* Grey color match remove-layer */
    box-shadow: none;
    margin: 0;
}

#gift-designer-app .gd-design-list li button.gd-load-design svg,
#gift-designer-app .gd-design-list li button.gd-delete-design svg {
    width: 16px;
    height: 16px;
    display: block;
    /* Ensure svg takes color from current color */
}

#gift-designer-app .gd-design-list li button.gd-load-design:hover {
    background: #e6f7ff;
    color: #007cba;
}

#gift-designer-app .gd-design-list li button.gd-delete-design:hover {
    background: #fee;
    color: #d63638;
}

.gd-close-modal {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 14px;
    color: #666;
    padding: 5px;
}

.gd-close-modal:hover {
    color: #d63638;
    background: #f0f0f1;
    border-radius: 4px;
}

/* Modal Buttons */
#gd-btn-login {
    background: #007cba;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
}

#gd-btn-login:hover {
    background: #006ba1 !important;
}

#gd-btn-register {
    background: #2271b1;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
}

#gd-btn-register:hover {
    background: #135e96 !important;
}

/* Custom Modal Styles */
.gd-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: none;
    /* Controlled by JS */
    align-items: center;
    justify-content: center;
}

.gd-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

.gd-modal-box {
    position: relative;
    background: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    max-width: 450px;
    width: 90%;
    z-index: 10001;
    text-align: center;
}

/* Material List Specifics */
#gd-material-list {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    /* Force 2 columns */
    gap: 10px;
}

#gd-material-list .gd-material-item {
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid #eee;
    /* default light border */
    border-radius: 4px;
    transition: all 0.2s;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

#gd-material-list .gd-material-item:hover,
#gd-material-list .gd-material-item.active {
    border-color: #007cba;
    /* Match the Blue theme */
    background: #e6f7ff;
}

/* Step Navigation Buttons */
.gd-step-nav button {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding-top: 10px;
    padding-bottom: 10px;
}