/* ============================================================================
   CARD DESIGNER - REACT COMPONENTS STYLES
   Matches HappyDay design with coral pink primary color
   ============================================================================ */

:root {
    --hd-primary: #E64367;
    --hd-primary-dark: #C4395A;
    --hd-primary-light: #F0A0B3;
    --hd-secondary: #FFF5E1;
    --hd-dark: #2D3748;
    --hd-gray: #E2E8F0;
    --hd-gray-dark: #CBD5E0;
    --hd-white: #FFFFFF;
    --hd-text: #1A202C;
    --hd-text-light: #718096;
    --hd-border: #E2E8F0;
    --hd-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --hd-shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
    --hd-radius: 12px;
    --hd-radius-sm: 8px;
    --hd-radius-lg: 16px;
}

/* Override GeneratePress button hover/focus/active backgrounds (dark grey #3f4047) */
.hd-card-designer button:hover,
.hd-card-designer button:focus,
.hd-card-designer button:active,
.hd-card-designer button.active,
.hd-card-designer button.selected,
.hd-modal button:hover,
.hd-modal button:focus,
.hd-modal button:active,
.hd-modal button.active {
    background-color: #F7F8FA !important;
}

/* Restore explicit backgrounds for buttons that have their own colour */
.hd-card-designer .hd-btn-primary:hover,
.hd-card-designer .hd-btn-primary:focus,
.hd-card-designer .hd-btn-primary:active {
    background-color: var(--hd-primary-dark) !important;
}

.hd-card-designer .hd-btn-generate:hover,
.hd-card-designer .hd-btn-generate:focus,
.hd-card-designer .hd-btn-generate:active {
    background-color: #16A34A !important;
}

.hd-card-designer .hd-btn-delete-image:hover,
.hd-card-designer .hd-ft-delete:hover {
    background-color: #c53030 !important;
}

.hd-modal .hd-btn-primary:hover,
.hd-modal .hd-btn-primary:focus,
.hd-modal .hd-btn-primary:active {
    background-color: var(--hd-primary-dark) !important;
}

/* Prevent theme from changing button/link text colour on hover.
   Exclude primary/active buttons that genuinely need white text. */
.hd-card-designer button:not(.hd-btn-primary):not(.hd-ft-btn.active):not(.hd-btn-add-to-cart):hover,
.hd-card-designer a:not(.hd-btn-primary):not(.hd-btn-add-to-cart):hover {
    color: inherit !important;
}

/* Buttons with primary-coloured active/selected states */
.hd-card-designer .hd-page-btn.active,
.hd-card-designer .hd-ft-btn.active,
.hd-card-designer .hd-align-btn.active,
.hd-card-designer .hd-font-picker-option.active,
.hd-card-designer .hd-btn-sm:hover {
    background-color: var(--hd-primary) !important;
}

/* Secondary/subtle hover backgrounds */
.hd-card-designer .hd-btn-secondary:hover,
.hd-card-designer .hd-template-btn:hover,
.hd-card-designer .hd-btn-upload-inside:hover,
.hd-card-designer .hd-btn-add-text:hover {
    background-color: var(--hd-secondary) !important;
}

.hd-card-designer .hd-insert-chip:hover {
    background-color: #E0E7FF !important;
}

.hd-card-designer .hd-upload-dropzone:hover {
    background-color: #FFF5F6 !important;
}

/* Tab buttons should stay transparent */
.hd-modal .hd-tab-btn:hover,
.hd-modal .hd-tab-btn:focus,
.hd-modal .hd-tab-btn.active {
    background-color: transparent !important;
}

/* ============================================================================
   MAIN LAYOUT
   ============================================================================ */

.hd-card-designer {
    min-height: 100vh;
    background: none;
    font-family: 'Montserrat', sans-serif;
}

.hd-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 0 80px;
}

.hd-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 0;
    margin-bottom: 30px;
}

.hd-header-left {
    display: flex;
    align-items: center;
    gap: 24px;
}

.hd-header-title {
    font-family: 'Montserrat', sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: var(--hd-text);
    white-space: nowrap;
}

.hd-header-divider {
    width: 1px;
    height: 24px;
    background: var(--hd-border);
    flex-shrink: 0;
}

.hd-header-next {
    font-size: 14px;
    padding: 10px 20px;
    white-space: nowrap;
}

/* ============================================================================
   STEPS INDICATOR
   ============================================================================ */

.hd-steps {
    display: flex;
    align-items: center;
    gap: 12px;
}

.hd-step-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.hd-step-connector {
    width: 24px;
    height: 2px;
    background: var(--hd-border);
    border-radius: 1px;
    flex-shrink: 0;
}

.hd-step-connector.completed {
    background: #22C55E;
}

.hd-step {
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0.5;
    transition: opacity 0.3s;
}

.hd-step.active,
.hd-step.completed {
    opacity: 1;
}

.hd-step-number {
    width: 28px;
    height: 28px;
    border-radius: 14px;
    background: var(--hd-gray);
    color: var(--hd-text-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    transition: all 0.3s;
    flex-shrink: 0;
}

.hd-step.active .hd-step-number {
    background: var(--hd-primary);
    color: var(--hd-white);
}

.hd-step.completed .hd-step-number {
    background: #22C55E;
    color: var(--hd-white);
}

.hd-step.completed .hd-step-number-text {
    display: none;
}

.hd-step.completed .hd-step-check {
    display: block;
}

.hd-step-check {
    display: none;
}

.hd-step-label {
    font-family: 'Montserrat', sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: var(--hd-text);
    white-space: nowrap;
}

.hd-step:not(.active):not(.completed) .hd-step-label {
    font-weight: 500;
    color: var(--hd-text-light);
}

/* ============================================================================
   GENERATE ROW & CREDIT DISPLAY
   ============================================================================ */

.hd-generate-row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
}

.hd-generate-row .hd-btn-generate {
    flex: 1;
}

.hd-credit-inline {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
}

.hd-credit-count {
    font-family: 'Montserrat', sans-serif;
    font-size: 13px;
    font-weight: 700;
    color: var(--hd-primary);
}

.hd-credit-label {
    font-family: 'Montserrat', sans-serif;
    font-size: 11px;
    font-weight: 400;
    color: var(--hd-text-light);
}

.hd-generations-bonus {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 10px;
    background: linear-gradient(90deg, #FFF7ED 0%, #FFFBEB 50%, #F0FDF4 100%);
    font-family: 'Montserrat', sans-serif;
    font-size: 12px;
    font-weight: 700;
    color: var(--hd-text);
}

.hd-generations-bonus svg {
    flex-shrink: 0;
    color: var(--hd-primary);
}

/* ============================================================================
   STEP CONTENT
   ============================================================================ */

.hd-step-content {
}

.hd-section-header {
    text-align: center;
    margin-bottom: 40px;
}

.hd-section-header h2 {
    margin: 0 0 10px;
    font-size: 32px;
    color: var(--hd-dark);
}

.hd-section-header p {
    margin: 0;
    font-size: 16px;
    color: var(--hd-text-light);
}

.hd-step-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid var(--hd-border);
}

.hd-step-actions-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.hd-step-actions-row {
    display: flex;
    gap: 16px;
    justify-content: center;
}

.hd-step-helper {
    margin: 0;
    font-size: 13px;
    color: var(--hd-text-light);
}

.hd-step-helper-small {
    font-size: 12px;
}

/* ============================================================================
   SIZE SELECTION
   ============================================================================ */

.hd-size-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.hd-size-card {
    background: var(--hd-white);
    border: 1px solid var(--hd-border);
    border-radius: 12px;
    padding: 24px 20px;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    height: 260px;
    box-sizing: border-box;
}

.hd-size-card:hover {
    border-color: var(--hd-primary);
    transform: translateY(-3px);
    box-shadow: var(--hd-shadow-lg);
}

.hd-size-card.selected {
    border: 2px solid var(--hd-primary);
    background: var(--hd-white);
}

.hd-size-icon {
    margin-bottom: 12px;
    display: flex;
    justify-content: center;
}

.hd-size-preview {
    background: linear-gradient(180deg, #FFD4A0 0%, #FFBE76 50%, #FFA347 100%);
    border-radius: 4px;
}

.hd-size-card-img {
    border-radius: 4px;
    object-fit: cover;
    display: block;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.hd-phone-mockup {
    width: 56px;
    height: 90px;
    background: #1A1A1A;
    border-radius: 8px;
    padding: 6px 3px 10px 3px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.hd-phone-mockup img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
    display: block;
}

.hd-phone-screen {
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, #FFD4A0 0%, #FFBE76 50%, #FFA347 100%);
    border-radius: 4px;
}

.hd-size-info h3 {
    margin: 0;
    font-family: 'Montserrat', sans-serif;
    font-size: 17px;
    font-weight: 700;
    color: var(--hd-text);
}

.hd-size-dimensions {
    margin: 0;
    font-family: 'Montserrat', sans-serif;
    font-size: 13px;
    color: var(--hd-text-light);
    font-weight: 400;
}

.hd-size-popular-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--hd-primary);
    color: #fff;
    font-family: 'Montserrat', sans-serif;
    font-size: 10px;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 10px;
    white-space: nowrap;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.hd-size-price {
    margin: 0;
    font-family: 'Montserrat', sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: var(--hd-primary);
}

.hd-size-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.hd-order-preview {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
    gap: 40px;
    margin-bottom: 30px;
    padding: 20px 0;
}

.hd-order-preview-panel {
    text-align: center;
}

.hd-order-preview-panel h4,
.hd-inside-spread h4 {
    margin: 0 0 10px;
    font-size: 13px;
    color: var(--hd-text-light);
}

.hd-inside-spread {
    text-align: center;
}


/* Front card with fold wedge */
.hd-front-card-wrapper {
    position: relative;
    width: 140px;
    margin-top: 20px;
}

.hd-front-wedge {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 15px;
    background: linear-gradient(to left, transparent 0%, rgba(0, 0, 0, 0.1) 100%);
    clip-path: polygon(96% 0%, 0% 100%, 100% 100%);
    z-index: 1;
    transform: translateY(-100%);
}

.hd-order-preview-card {
    border-radius: var(--hd-radius-sm);
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.15);
    background: #ffffff;
    border: 1px solid #333333;
    overflow: hidden;
}

.hd-order-preview-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Inside spread - two pages joined */
.hd-inside-pages {
    display: flex;
    perspective: 600px;
    margin-top: 22px;
}

.hd-inside-page {
    width: 130px;
    height: 197px;
    overflow: hidden;
    background: #ffffff;
    border: 1px solid #333333;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.12);
}

.hd-inside-page img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

.hd-inside-left {
    border-radius: var(--hd-radius-sm) 0 0 var(--hd-radius-sm);
    border-right: none;
    transform: rotateY(8deg);
    transform-origin: right center;
}

.hd-inside-right {
    border-radius: 0 var(--hd-radius-sm) var(--hd-radius-sm) 0;
    border-left: 1px solid #ddd;
    transform: rotateY(-8deg);
    transform-origin: left center;
}

.hd-size-selected-badge {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 24px;
    height: 24px;
    background: #22C55E;
    color: var(--hd-white);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================================================
   IMAGE GENERATION
   ============================================================================ */

.hd-image-generation-layout {
    display: grid;
    grid-template-columns: 7fr 3fr;
    gap: 40px;
}

.hd-generation-controls {
    display: flex;
    flex-direction: column;
    gap: 25px;
    min-width: 0;
}

.hd-control-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.hd-label {
    font-weight: 700;
    color: var(--hd-dark);
    font-size: 14px;
}

.hd-required {
    color: var(--hd-primary);
    font-weight: 700;
}

.hd-label-hint {
    font-weight: 400;
    font-style: italic;
    color: #9CA3AF;
    font-size: 13px;
}

/* Reference Photos */
.hd-upload-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 140px;
    border: 2px dashed #E5E7EB;
    border-radius: 12px;
    background: transparent;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    padding: 0;
}

.hd-upload-dropzone:hover {
    border-color: var(--hd-primary);
    background: #FFF5F6;
}

.hd-dropzone-text {
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: #6B7280;
}

.hd-dropzone-hint {
    font-family: 'Montserrat', sans-serif;
    font-size: 12px;
    color: #9CA3AF;
}

.hd-uploaded-images-row {
    display: flex;
    align-items: center;
    gap: 16px;
}

.hd-uploaded-image-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.hd-uploaded-image {
    position: relative;
    border-radius: 10px !important;
    overflow: hidden;
    width: 100px;
    height: 100px;
}

.hd-uploaded-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.hd-image-badge {
    position: absolute !important;
    top: 6px !important;
    left: 6px !important;
    width: 24px;
    height: 24px;
    border-radius: 12px;
    background: #6366F1;
    color: #fff;
    font-family: 'Montserrat', sans-serif;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.hd-image-label {
    font-family: 'Montserrat', sans-serif;
    font-size: 12px;
    color: var(--hd-text-secondary, #666);
}

.hd-remove-image {
    position: absolute !important;
    top: 4px !important;
    right: 4px !important;
    width: 20px;
    height: 20px;
    border-radius: 10px;
    background: #EF4444;
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 14px;
    font-weight: 400;
    line-height: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 0 1px 0;
}

.hd-add-images-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: transparent;
    border: none;
    color: #6366F1;
    font-family: 'Montserrat', sans-serif;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    padding: 0;
    align-self: center;
    appearance: none;
    -webkit-appearance: none;
}

/* Template Grid */
.hd-template-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

/* Style selector */
.hd-style-scroll-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.hd-style-scroll-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--hd-border);
    background: var(--hd-white);
    color: var(--hd-text-light);
    cursor: pointer;
    flex-shrink: 0;
    transition: border-color 0.2s, color 0.2s;
    padding: 0;
    appearance: none;
}

.hd-style-scroll-btn:hover:not(:disabled) {
    border-color: var(--hd-primary-light);
    color: var(--hd-text);
}

.hd-style-scroll-btn:disabled {
    opacity: 0.3;
    cursor: default;
}

.hd-style-grid {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 4px;
    flex-wrap: nowrap;
    scrollbar-width: none;
    -ms-overflow-style: none;
    min-width: 0;
}

.hd-style-grid::-webkit-scrollbar {
    display: none;
}

.hd-style-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    background: var(--hd-white);
    border: 2px solid var(--hd-border);
    border-radius: var(--hd-radius-sm);
    padding: 8px;
    cursor: pointer;
    transition: all 0.3s;
    appearance: none;
    flex-shrink: 0;
}

.hd-style-img-wrap {
    position: relative;
    width: 56px;
    height: 56px;
}

.hd-style-btn img {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
}

.hd-style-tick {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 20px;
    height: 20px;
    background: #22C55E;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
}

.hd-style-btn span {
    font-size: 11px;
    font-weight: 500;
    color: var(--hd-text);
}

.hd-style-btn:hover {
    border-color: var(--hd-primary-light);
}

.hd-style-btn.selected {
    border-color: var(--hd-primary);
}

.hd-template-btn {
    background: var(--hd-white);
    border: 2px solid var(--hd-border);
    border-radius: var(--hd-radius-sm);
    padding: 12px 10px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s;
    color: var(--hd-text);
    font-weight: 500;
}

.hd-template-btn:hover {
    border-color: var(--hd-primary);
    background: var(--hd-secondary);
}

.hd-template-btn.selected {
    border-color: var(--hd-primary);
    background: var(--hd-primary);
    color: var(--hd-white);
}

/* Preview Area */
.hd-preview-area {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.hd-current-image {
    position: relative;
    border-radius: var(--hd-radius);
    overflow: hidden;
    box-shadow: var(--hd-shadow-lg);
}

.hd-current-image img {
    width: 100%;
    height: auto;
    display: block;
}

.hd-empty-preview {
    background: linear-gradient(135deg, #FFFFBB 0%, #FFA600 100%);
    border-radius: var(--hd-radius-lg);
    aspect-ratio: 1 / 1.414;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 40px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hd-empty-preview::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('../images/confetti.png') repeat;
    background-size: 140px 74px;
    opacity: 0.4;
    pointer-events: none;
}

.hd-empty-preview > * {
    position: relative;
}

.hd-empty-preview svg {
    stroke: #000000B3;
}

.hd-empty-preview-title {
    margin: 0;
    font-family: 'Montserrat', sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: #000000B3;
}

.hd-empty-preview-sub {
    margin: 0;
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: #000000B3;
}

/* Recent designs in empty preview */
.hd-recent-designs {
    margin-top: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.hd-recent-designs-label {
    margin: 0;
    font-family: 'Montserrat', sans-serif;
    font-size: 12px;
    font-weight: 700;
    color: #000000B3;
}

.hd-recent-designs-row {
    display: flex;
    gap: 10px;
}

.hd-recent-design-thumb {
    display: block;
    width: 70px;
    height: 99px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s, box-shadow 0.2s;
}

.hd-recent-design-thumb:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.hd-recent-design-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Generating preview */
.hd-generating-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hd-generating-card-silhouette {
    width: 100%;
    aspect-ratio: 1 / 1.414;
    border-radius: var(--hd-radius);
    background: linear-gradient(135deg, #FBDCE3 0%, #F4C4CE 30%, #FFEADF 70%, #FFE0F0 100%);
    position: relative;
    overflow: hidden;
}

.hd-generating-shimmer {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.7) 50%,
        transparent 100%
    );
    animation: hd-shimmer 1.8s ease-in-out infinite;
}

@keyframes hd-shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.hd-generating-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.hd-generating-dots {
    display: flex;
    gap: 8px;
}

.hd-generating-dots span {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--hd-primary);
    animation: hd-dot-bounce 1.4s ease-in-out infinite;
}

.hd-generating-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.hd-generating-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes hd-dot-bounce {
    0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
    40% { opacity: 1; transform: scale(1.2); }
}

.hd-generating-message {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--hd-primary-dark);
    animation: hd-fade-in 0.4s ease-out;
}

@keyframes hd-fade-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Image History */
.hd-image-history {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.hd-history-row {
    display: flex;
    gap: 12px;
}

.hd-history-item {
    position: relative;
    width: 85px;
    height: 120px;
    flex-shrink: 0;
    border: 1px solid #E5E7EB;
    border-radius: 10px;
    overflow: visible;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0;
    background: none;
}

.hd-history-item.selected {
    border: 2px solid #1A1A1A;
}

.hd-history-item:hover {
    transform: scale(1.05);
}

.hd-history-check {
    position: absolute !important;
    top: -5px !important;
    left: -5px !important;
    width: 22px;
    height: 22px;
    border-radius: 11px;
    background: #22C55E;
    border: 2px solid #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.hd-history-refine {
    position: absolute !important;
    bottom: 6px !important;
    left: 6px !important;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-family: 'Montserrat', sans-serif;
    font-size: 8px;
    font-weight: 700;
    padding: 2px 4px;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    z-index: 1;
    white-space: nowrap;
    transition: background 0.2s;
}

.hd-history-refine:hover {
    background: rgba(0, 0, 0, 1);
}

.hd-preview-refine {
    position: absolute !important;
    bottom: 12px !important;
    left: 12px !important;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-family: 'Montserrat', sans-serif;
    font-size: 13px;
    font-weight: 700;
    padding: 8px 14px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    z-index: 1;
    white-space: nowrap;
    transition: background 0.2s;
}

.hd-preview-refine:hover {
    background: rgba(0, 0, 0, 1) !important;
    color: #fff !important;
}

.hd-history-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 9px;
}

.hd-history-tip {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 10px;
    background: #EEF2FF;
    font-family: 'Montserrat', sans-serif;
    font-size: 12px;
    line-height: 1.4;
    color: #6B7280;
}

.hd-history-tip svg {
    flex-shrink: 0;
    color: #6366F1;
}

/* ============================================================================
   TEXT EDITOR
   ============================================================================ */

.hd-text-editor-layout {
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
    max-width: 100%;
    overflow: hidden;
    padding: 0 10px;
    box-sizing: border-box;
}

.hd-page-diagram-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.hd-page-diagram {
    display: flex;
    perspective: 600px;
    padding: 4px;
}

.hd-page-thumb {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    width: 120px;
    height: 170px;
    background: var(--hd-white);
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.12);
    border: 1px solid var(--hd-border);
    cursor: pointer;
    font-family: 'Montserrat', sans-serif;
    font-size: 10px;
    font-weight: 500;
    color: var(--hd-text-light);
    transition: all 0.2s;
    padding: 0;
    appearance: none;
}

.hd-page-thumb-left {
    border-radius: 8px 0 0 8px;
    border-right: none;
    transform: rotateY(8deg);
    transform-origin: right center;
}

.hd-page-thumb-right {
    border-radius: 0 8px 8px 0;
    border-left: 1px solid #ddd;
    transform: rotateY(-8deg);
    transform-origin: left center;
}

.hd-page-thumb.active {
    border: 2px solid var(--hd-primary);
    background: var(--hd-white);
    color: var(--hd-primary);
    font-weight: 700;
}

.hd-page-thumb-preview {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    border-radius: inherit;
}

.hd-page-thumb:hover:not(.active) {
    border-color: var(--hd-primary-light);
}

.hd-page-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--hd-primary);
}

.hd-editing-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: 'Montserrat', sans-serif;
    font-size: 12px;
    font-weight: 500;
    color: var(--hd-text-light);
}

.hd-editing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--hd-primary);
}

/* Legacy page selector (kept for compatibility) */
.hd-page-selector {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.hd-page-btn {
    padding: 12px 30px;
    background: var(--hd-white);
    border: 2px solid var(--hd-border);
    border-radius: 25px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    color: var(--hd-text);
}

.hd-page-btn:hover {
    border-color: var(--hd-primary);
}

.hd-page-btn.active {
    background: var(--hd-primary);
    border-color: var(--hd-primary);
    color: var(--hd-white);
}

/* Add buttons bar (centred above canvas) */
.hd-add-buttons-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

/* Canvas area — positions floating toolbar */
.hd-canvas-area {
    position: relative;
    display: flex;
    justify-content: center;
    max-width: 100%;
}

/* Canvas empty state overlay */
.hd-canvas-empty-state {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    z-index: 10;
    pointer-events: none;
    color: var(--hd-text-light);
}

.hd-canvas-empty-state svg {
    opacity: 0.4;
    margin-bottom: 4px;
}

.hd-canvas-empty-state p {
    margin: 0;
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    text-align: center;
}

.hd-canvas-empty-hint {
    font-size: 13px !important;
    opacity: 0.8;
}

/* Inline textarea below canvas */
.hd-inline-textarea {
    max-width: 540px;
    margin: 0 auto;
    width: 100%;
}

/* ---- Floating Toolbar ---- */
.hd-floating-toolbar {
    position: absolute;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 2px;
    background: #fff;
    border: 1px solid var(--hd-border);
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    padding: 4px 6px;
    pointer-events: auto;
    overflow: visible;
}

.hd-ft-row {
    display: flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.hd-ft-group {
    display: flex;
    align-items: center;
    gap: 2px;
    padding: 0 3px;
    border-right: 1px solid var(--hd-border);
}

.hd-ft-group:last-child {
    border-right: none;
}

.hd-ft-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: 1px solid transparent;
    border-radius: 4px;
    background: transparent;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    color: #333 !important;
    padding: 0;
    transition: background 0.15s, border-color 0.15s;
}

.hd-ft-btn:hover {
    background: #f0f0f0;
    color: #333 !important;
}

.hd-ft-btn.active {
    background: var(--hd-primary);
    color: #fff;
    border-color: var(--hd-primary);
}

.hd-ft-delete {
    color: #c53030;
}

.hd-ft-delete:hover {
    background: #c53030;
    color: #fff;
}

.hd-ft-size {
    gap: 0;
}

.hd-ft-size-label {
    font-size: 11px;
    font-weight: 700;
    min-width: 24px;
    text-align: center;
    color: var(--hd-text);
}

.hd-ft-font {
    width: 130px;
    min-width: 0;
    position: relative;
}

.hd-ft-font .hd-font-picker {
    width: 100%;
}

.hd-ft-font .hd-font-picker-trigger {
    padding: 4px 8px;
    font-size: 12px;
    border: none;
    background: transparent;
    color: #333 !important;
    gap: 4px;
    width: 100%;
    box-sizing: border-box;
    min-width: 0;
}

.hd-ft-font .hd-font-picker-trigger span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.hd-ft-font .hd-font-picker-trigger svg {
    flex-shrink: 0;
}

.hd-ft-font .hd-font-picker-dropdown {
    min-width: 180px;
}

.hd-ft-colour-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.hd-ft-colour-swatch {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    border: 1px solid #ccc;
    cursor: pointer;
    pointer-events: none;
}

.hd-ft-colour-select {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.hd-slider {
    width: 100%;
}

.hd-align-buttons {
    display: flex;
    gap: 8px;
}

.hd-align-btn {
    flex: 1;
    padding: 8px 12px;
    background: var(--hd-white);
    border: 2px solid var(--hd-border);
    border-radius: var(--hd-radius-sm);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    color: var(--hd-text);
}

.hd-align-btn:hover {
    border-color: var(--hd-primary);
}

.hd-align-btn.active {
    background: var(--hd-primary);
    border-color: var(--hd-primary);
    color: var(--hd-white);
}

.hd-text-preview {
    background: var(--hd-white);
    border: 2px solid var(--hd-border);
    border-radius: var(--hd-radius);
    padding: 20px;
    min-width: 0;
    overflow: hidden;
}

.hd-text-preview h4 {
    margin: 0 0 15px;
    font-size: 16px;
    color: var(--hd-dark);
}

/* Inside page canvas wrapper */
.hd-inside-canvas-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 500px;
}

/* Inline text edit overlay */
.hd-inline-edit-overlay {
    box-sizing: border-box;
    background: rgba(255, 255, 255, 0.05);
    border: 1.5px solid var(--hd-primary, #E64367);
    border-radius: 2px;
    outline: none;
    resize: none;
    overflow: hidden;
    padding: 0;
    margin: 0;
    z-index: 150;
    word-wrap: break-word;
    white-space: pre-wrap;
}


.hd-btn-delete-image {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    font-size: 13px;
    background: #fff;
    color: #c53030;
    border: 1px solid #c53030;
    border-radius: var(--hd-radius-sm);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.hd-btn-delete-image:hover {
    background: #c53030;
    color: #fff;
}

/* Canvas action buttons (Add Message / Add Photo) */
.hd-btn-canvas-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: #333 !important;
    background: var(--hd-white);
    border: 1px solid var(--hd-border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    appearance: none;
}

.hd-btn-canvas-action:hover {
    border-color: var(--hd-primary);
    background: #fafafa;
    color: #333 !important;
}

.hd-btn-canvas-icon {
    font-weight: 700;
    font-size: 14px;
}

/* Legacy add buttons (kept for compatibility) */
.hd-add-buttons {
    flex-direction: row !important;
    flex-wrap: wrap;
    gap: 10px !important;
}

.hd-add-buttons .hd-btn {
    flex: 1;
}

.hd-btn-add-text,
.hd-btn-upload-inside {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 500;
    background: transparent;
    color: var(--hd-primary);
    border: 1px solid var(--hd-primary);
    border-radius: var(--hd-radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.hd-btn-add-text:hover,
.hd-btn-upload-inside:hover {
    color: var(--hd-primary);
    border-color: var(--hd-primary);
    background: var(--hd-secondary);
}

/* Contextual text block controls */
.hd-text-block-controls {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px;
    background: #f8f9fa;
    border: 1px solid #e0e0e0;
    border-left: 3px solid var(--hd-primary, #E64367);
    border-radius: var(--hd-radius-sm);
}

.hd-outline-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.hd-outline-toggle input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* Font picker dropdown */
.hd-font-picker {
    position: relative;
}

.hd-font-picker-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    text-align: left;
}

.hd-font-picker-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 100;
    background: #fff;
    border: 1px solid var(--hd-border);
    border-radius: var(--hd-radius-sm);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    max-height: 240px;
    overflow-y: auto;
    list-style: none;
    margin: 4px 0 0;
    padding: 4px 0;
}

.hd-font-picker-option {
    padding: 8px 12px;
    font-size: 16px;
    cursor: pointer;
    color: #333 !important;
    transition: background 0.1s;
}

.hd-font-picker-option:hover {
    background: #f0f0f0;
    color: #333 !important;
}

.hd-font-picker-option.active {
    background: var(--hd-primary);
    color: #fff;
}

.hd-text-block-hint {
    padding: 12px;
    text-align: center;
}

.hd-preview-card {
    background: #ffffff;
    border: 1px solid #333333;
    border-radius: var(--hd-radius-sm);
    word-wrap: break-word;
    box-sizing: border-box;
}

.hd-aspect-a-series {
    aspect-ratio: 1 / 1.414;
    overflow: hidden;
}

/* ============================================================================
   PREVIEW & CHECKOUT
   ============================================================================ */

.hd-preview-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 40px;
}

.hd-card-preview-full {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.hd-preview-page {
    background: var(--hd-white);
    border: 2px solid var(--hd-border);
    border-radius: var(--hd-radius);
    padding: 20px;
}

.hd-preview-page h4 {
    margin: 0 0 15px;
    font-size: 14px;
    color: var(--hd-text-light);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.hd-preview-page img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: var(--hd-radius-sm);
}

.hd-preview-pages-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.hd-preview-text-page {
    background: var(--hd-secondary);
    border-radius: var(--hd-radius-sm);
    padding: 20px;
    min-height: 200px;
}

.hd-preview-text-page p {
    margin: 0 0 10px;
}

/* Order Options */
.hd-order-options {
    position: sticky;
    top: 100px;
}

.hd-order-options h3 {
    margin: 0 0 20px;
    font-size: 24px;
    color: var(--hd-dark);
}

.hd-product-options {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
}

.hd-product-option {
    background: var(--hd-white);
    border: 2px solid var(--hd-border);
    border-radius: var(--hd-radius);
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    gap: 15px;
    align-items: flex-start;
    text-align: left;
}

.hd-product-option:hover {
    border-color: var(--hd-primary);
    transform: translateY(-2px);
    box-shadow: var(--hd-shadow);
}

.hd-product-option.selected {
    border-color: var(--hd-primary);
    background: linear-gradient(135deg, var(--hd-white) 0%, #FFF5F7 100%);
}

.hd-product-icon {
    font-size: 32px;
}

.hd-product-info h4 {
    margin: 0 0 5px;
    font-size: 18px;
    color: var(--hd-dark);
}

.hd-product-info p {
    margin: 0 0 5px;
    font-size: 14px;
    color: var(--hd-text-light);
}

.hd-product-price {
    color: var(--hd-primary);
    font-weight: 700;
    font-size: 16px;
}

.hd-bonus-notice {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--hd-secondary);
    padding: 15px;
    border-radius: var(--hd-radius-sm);
    font-size: 14px;
    color: var(--hd-text);
    margin-top: 15px;
}

.hd-bonus-notice svg {
    color: var(--hd-primary);
    flex-shrink: 0;
}

.hd-bonus-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: linear-gradient(90deg, #FFF7ED 0%, #FFFBEB 50%, #F0FDF4 100%);
    padding: 16px 40px;
    margin-top: 40px;
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    font-weight: 700;
    color: #1A1A1A;
}

.hd-bonus-banner svg {
    flex-shrink: 0;
}

/* ============================================================================
   FORM ELEMENTS
   ============================================================================ */

.hd-input,
.hd-textarea,
.hd-select {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 16px;
    border: 2px solid var(--hd-border);
    border-radius: 10px;
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: #1A1A1A;
    background: #fff;
    transition: border-color 0.2s;
}

.hd-input:focus,
.hd-textarea:focus,
.hd-select:focus {
    outline: none;
    border-color: var(--hd-primary);
}

.hd-textarea {
    resize: vertical;
    min-height: 80px;
}

.hd-description-editable {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 16px;
    border: 2px solid var(--hd-border);
    border-radius: 10px;
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: #1A1A1A;
    background: #fff;
    min-height: 120px;
    max-height: 200px;
    overflow-y: auto;
    outline: none;
    cursor: text;
    white-space: pre-wrap;
    word-wrap: break-word;
    transition: border-color 0.2s;
}

.hd-description-editable:focus {
    border-color: var(--hd-primary);
}

.hd-description-wrapper {
    position: relative;
}

.hd-description-placeholder {
    position: absolute;
    top: 12px;
    left: 16px;
    right: 16px;
    color: #9CA3AF;
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    line-height: 1.6;
    pointer-events: none;
    user-select: none;
}

.hd-description-placeholder .hd-image-tag {
    pointer-events: none;
    opacity: 0.7;
}

.hd-description-editable.hd-textarea-active {
    border-color: #6366F1;
    border-width: 1.5px;
}

.hd-description-editable.hd-textarea-active:focus {
    border-color: #6366F1;
}

.hd-image-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    border-radius: 4px;
    background: #EEF2FF;
    color: #6366F1;
    font-family: 'Montserrat', sans-serif;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    vertical-align: baseline;
    user-select: all;
}

.hd-image-tag svg {
    flex-shrink: 0;
}

.hd-textarea.hd-textarea-active {
    border-color: #6366F1;
    border-width: 1.5px;
}

.hd-insert-chips {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.hd-insert-label {
    font-family: 'Montserrat', sans-serif;
    font-size: 12px;
    font-weight: 500;
    color: #9CA3AF;
}

.hd-insert-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 12px;
    background: #EEF2FF;
    border: 1px solid #6366F1;
    color: #6366F1;
    font-family: 'Montserrat', sans-serif;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.2s;
    appearance: none;
    -webkit-appearance: none;
}

.hd-insert-chip:hover {
    background: #E0E7FF;
}

.hd-color-picker {
    width: 60px;
    height: 40px;
    border: 2px solid var(--hd-border);
    border-radius: var(--hd-radius-sm);
    cursor: pointer;
}

/* ============================================================================
   BUTTONS
   ============================================================================ */

.hd-btn {
    padding: 14px 28px;
    border: none;
    border-radius: 25px;
    text-decoration: none !important;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    font-family: inherit;
}

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

.hd-btn-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: hd-spin 0.6s linear infinite;
    vertical-align: middle;
    margin-right: 4px;
}

@keyframes hd-spin {
    to { transform: rotate(360deg); }
}

.hd-btn-primary {
    background: var(--hd-primary);
    color: var(--hd-white);
}

.hd-btn-primary:hover:not(:disabled) {
    background: var(--hd-primary-dark);
    color: #fff !important;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(230, 67, 103, 0.4);
}

.hd-btn-secondary {
    background: var(--hd-white);
    color: var(--hd-text);
    border: 2px solid var(--hd-border);
}

.hd-btn-secondary:hover:not(:disabled) {
    border-color: var(--hd-primary);
    background: var(--hd-secondary);
}

.hd-btn-block {
    width: 100%;
}

.hd-btn-generate {
    font-size: 14px;
    padding: 10px 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: #22C55E;
    border-color: #22C55E;
    color: #fff;
}

.hd-btn-generate:hover:not(:disabled) {
    background: #16A34A;
    border-color: #16A34A;
    box-shadow: 0 5px 15px rgba(34, 197, 94, 0.4);
}

.hd-btn-generate:active:not(:disabled),
.hd-btn-generate:focus:not(:disabled) {
    background: #15803D;
    border-color: #15803D;
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.4);
}

/* Lightbox */
.hd-lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    cursor: pointer;
    padding: 40px;
}

.hd-lightbox img {
    max-width: 100%;
    max-height: 100%;
    border-radius: var(--hd-radius);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    object-fit: contain;
}

.hd-error-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.hd-error-popup {
    background: #fff;
    border-radius: var(--hd-radius-lg);
    padding: 30px;
    max-width: 400px;
    width: 90%;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.hd-error-popup p {
    margin: 0 0 20px;
    font-size: 15px;
    color: var(--hd-text);
    line-height: 1.5;
}

.hd-error-popup .hd-error-hint {
    font-size: 13px;
    color: #6B7280;
    margin: 16px 0 12px;
}

.hd-error-popup .hd-btn + .hd-error-hint {
    margin-top: 16px;
}

.hd-error-popup .hd-btn-secondary {
    font-size: 13px;
    padding: 6px 16px;
}

/* ============================================================================
   LOADING & ERROR STATES
   ============================================================================ */

.hd-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    text-align: center;
    gap: 32px;
}

.hd-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    text-align: center;
}

/* Card open animation */
.hd-loading-card {
    position: relative;
    width: 120px;
    height: 170px;
    perspective: 800px;
}

.hd-loading-card-back {
    position: absolute;
    inset: 0;
    border-radius: 0 12px 12px 0;
    background: linear-gradient(135deg, #FBDCE3, #F4C4CE 50%, #F0A0B3);
    box-shadow: 0 4px 20px rgba(230, 67, 103, 0.2);
}

.hd-loading-card-front {
    position: absolute;
    inset: 0;
    border-radius: 0 12px 12px 0;
    background: linear-gradient(135deg, #F0A0B3, #ED8B9A 50%, #ED7A8E);
    box-shadow: 0 4px 20px rgba(230, 67, 103, 0.25);
    transform-origin: left center;
    animation: hd-card-open 2.4s ease-in-out infinite;
}

@keyframes hd-card-open {
    0%, 100% { transform: rotateY(0deg); }
    40%, 60% { transform: rotateY(-140deg); }
}

.hd-loading-status {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.hd-loading-message {
    margin: 0;
    font-size: 15px;
    font-weight: 500;
    color: var(--hd-text-light);
}

.hd-spinner,
.hd-spinner-large {
    border: 3px solid var(--hd-gray);
    border-top-color: var(--hd-primary);
    border-radius: 50%;
    animation: hd-spin 0.8s linear infinite;
}

.hd-spinner {
    width: 20px;
    height: 20px;
}

.hd-spinner-large {
    width: 50px;
    height: 50px;
    border-width: 4px;
}

@keyframes hd-spin {
    to { transform: rotate(360deg); }
}

.hd-error h2 {
    margin: 20px 0 10px;
    color: var(--hd-primary);
}

.hd-error p {
    margin: 0 0 20px;
    color: var(--hd-text-light);
}

/* ============================================================================
   MY CARDS SHORTCODE
   ============================================================================ */

.hd-my-cards {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px 60px;
    font-family: 'Montserrat', sans-serif;
}

.hd-my-cards-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 40px 0 24px;
    margin-bottom: 0;
}

.hd-my-cards-header h2 {
    font-size: 32px;
    font-weight: 700;
    color: #263661;
    margin: 0;
    letter-spacing: -0.5px;
}

.hd-my-cards-header .hd-btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    border: none;
    border-radius: 24px;
    background: linear-gradient(180deg, #FF7B64 0%, #E64367 100%);
    color: #fff !important;
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none !important;
    white-space: nowrap;
    transition: transform 0.2s, box-shadow 0.2s;
}

.hd-my-cards-header .hd-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(230, 67, 103, 0.4);
    color: #fff !important;
}

.hd-my-cards-subtitle {
    font-size: 15px;
    font-weight: 500;
    color: #6B7280;
    margin: 4px 0 0;
}

.hd-my-cards-empty {
    text-align: center;
    padding: 48px 0;
    color: #6B7280;
    font-size: 15px;
}

.hd-my-cards-new-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    border: none;
    border-radius: 24px;
    background: linear-gradient(180deg, #FF7B64 0%, #E64367 100%);
    color: #fff !important;
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    font-weight: 700;
    text-decoration: none !important;
    white-space: nowrap;
    margin-top: 16px;
    transition: transform 0.2s, box-shadow 0.2s;
}

.hd-my-cards-new-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(230, 67, 103, 0.4);
    color: #fff !important;
}

.hd-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.hd-card-item {
    display: block;
    border-radius: var(--hd-radius);
    overflow: hidden;
    box-shadow: var(--hd-shadow);
    background: var(--hd-white);
    text-decoration: none !important;
    color: inherit !important;
    transition: transform 0.2s, box-shadow 0.2s;
}

.hd-card-item:hover {
    transform: translateY(-3px);
    box-shadow: var(--hd-shadow-lg);
}

.hd-card-image {
    overflow: hidden;
    background: var(--hd-bg);
}

.hd-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.hd-btn-sm {
    padding: 8px 20px;
    background: var(--hd-white);
    color: var(--hd-dark);
    border-radius: var(--hd-radius);
    text-decoration: none;
    font-weight: 700;
    font-size: 14px;
}

.hd-btn-sm:hover {
    background: var(--hd-primary);
    color: var(--hd-white);
}

.hd-card-info {
    padding: 12px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.hd-card-size {
    font-weight: 700;
    color: var(--hd-dark);
}

.hd-card-date {
    font-size: 13px;
    color: var(--hd-text-light);
}

.hd-empty-state {
    text-align: center;
    padding: 60px 20px;
}

/* ============================================================================
   RESPONSIVE
   ============================================================================ */

@media (max-width: 768px) {
    .hd-header-bar {
        flex-direction: column;
        gap: 15px;
        padding: 15px 0;
    }

    .hd-header-left {
        flex-direction: column;
        gap: 12px;
        width: 100%;
    }

    .hd-header-divider {
        display: none;
    }

    .hd-header-title {
        display: none;
    }

    .hd-steps {
        overflow-x: auto;
        width: 100%;
    }

    .hd-step-label {
        display: none;
    }

    .hd-step-connector {
        width: 16px;
    }

    .hd-main {
        padding: 0 15px;
        margin: 20px auto;
    }

    .hd-step-content {
        padding: 25px 20px;
    }

    .hd-size-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .hd-image-generation-layout,
    .hd-preview-layout {
        grid-template-columns: 1fr;
    }

    .hd-template-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .hd-style-grid {
        gap: 8px;
    }

    .hd-preview-pages-grid {
        grid-template-columns: 1fr;
    }

    .hd-step-actions {
        flex-direction: column;
    }

    .hd-btn {
        width: 100%;
    }
}


/* ============================================================================
   AUTH MODAL (login/signup popup for guests with no generations)
   ============================================================================ */

.hd-modal {
    position: fixed;
    inset: 0;
    z-index: 999999;
    justify-content: center;
    align-items: center;
}

.hd-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
}

.hd-modal-content {
    position: relative;
    background: var(--hd-white);
    border-radius: var(--hd-radius);
    box-shadow: var(--hd-shadow-lg);
    padding: 32px;
    max-width: 420px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    z-index: 1;
}

.hd-modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--hd-text-light);
    line-height: 1;
    padding: 4px 8px;
}

.hd-modal-close:hover {
    color: var(--hd-text);
}

.hd-modal-body h2 {
    margin: 0 0 8px;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--hd-text);
    font-family: 'Montserrat', sans-serif;
}

.hd-modal-body > p {
    margin: 0 0 20px;
    color: var(--hd-text-light);
    font-size: 0.95rem;
}

/* Tabs */
.hd-auth-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--hd-gray);
}

.hd-tab-btn {
    flex: 1;
    padding: 10px 16px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--hd-text-light);
    font-family: 'Montserrat', sans-serif;
    transition: color 0.2s, border-color 0.2s;
}

.hd-tab-btn:hover {
    color: var(--hd-text);
}

.hd-tab-btn.active {
    color: var(--hd-primary);
    border-bottom-color: var(--hd-primary);
    font-weight: 700;
}

/* Tab content */
.hd-tab-content {
    display: none;
}

.hd-tab-content.active {
    display: block;
}

/* Form fields */
.hd-modal-body form p {
    margin: 0 0 16px;
}

.hd-modal-body form label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--hd-text);
}

.hd-modal-body form input[type="email"],
.hd-modal-body form input[type="password"],
.hd-modal-body form input[type="text"] {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--hd-gray-dark);
    border-radius: 8px;
    font-size: 0.95rem;
    font-family: 'Montserrat', sans-serif;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.hd-modal-body form input:focus {
    outline: none;
    border-color: var(--hd-primary);
}

.hd-modal-body form .hd-btn {
    width: 100%;
}

/* Remember me checkbox */
.hd-modal-body form label input[type="checkbox"] {
    margin-right: 6px;
}

/* Lost password link */
.hd-modal-body form a {
    color: var(--hd-primary);
    text-decoration: none;
    font-size: 0.85rem;
}

.hd-modal-body form a:hover {
    text-decoration: underline;
}
