/* === Reset & Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; line-height: 1.6; color: #1a1a2e; background: #f8f9fa; }

/* === Layout === */
.container { max-width: 1100px; margin: 0 auto; padding: 0 1.5rem; }
.main-content { min-height: calc(100vh - 140px); padding: 2rem 0; }
.text-center { text-align: center; }
.text-right { text-align: right; }

/* === Header === */
.site-header { background: #1a1a2e; color: #fff; padding: 1rem 0; }
.header-inner { display: flex; justify-content: space-between; align-items: center; }
.logo { color: #fff; text-decoration: none; font-size: 1.5rem; font-weight: 700; letter-spacing: -0.5px; }
.nav { display: flex; align-items: center; gap: 1rem; }
.nav a { color: rgba(255,255,255,0.85); text-decoration: none; font-size: 0.9rem; }
.nav a:hover { color: #fff; }
.lang-switcher { display: flex; gap: 0.3rem; margin-left: 0.5rem; }
.lang-link { padding: 0.2rem 0.4rem; border-radius: 3px; font-size: 0.8rem; }
.lang-link.active { background: rgba(255,255,255,0.2); color: #fff !important; }

/* === Footer === */
.site-footer { background: #1a1a2e; color: rgba(255,255,255,0.6); text-align: center; padding: 1.5rem 0; font-size: 0.85rem; }

/* === Buttons === */
.btn { display: inline-block; padding: 0.6rem 1.2rem; border-radius: 6px; font-size: 0.95rem; font-weight: 500; text-decoration: none; border: none; cursor: pointer; transition: all 0.2s; }
.btn-sm { padding: 0.35rem 0.7rem; font-size: 0.85rem; }
.btn-lg { padding: 0.8rem 2rem; font-size: 1.1rem; }
.btn-primary { background: #4361ee; color: #fff; }
.btn-primary:hover { background: #3651d4; }
.btn-secondary { background: #6c757d; color: #fff; }
.btn-secondary:hover { background: #5a6268; }
.btn-outline { background: transparent; border: 2px solid #4361ee; color: #4361ee; }
.btn-outline:hover { background: #4361ee; color: #fff; }
.btn-google { background: #fff; color: #333; border: 2px solid #ddd; display: inline-flex; align-items: center; gap: 0.5rem; }
.btn-google:hover { border-color: #4285F4; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* === Forms === */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-weight: 500; margin-bottom: 0.3rem; font-size: 0.9rem; }
.form-control { width: 100%; padding: 0.6rem 0.8rem; border: 2px solid #dee2e6; border-radius: 6px; font-size: 0.95rem; transition: border-color 0.2s; }
.form-control:focus { outline: none; border-color: #4361ee; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.input-group { display: flex; gap: 0.5rem; }
.input-group .form-control { flex: 1; }
.phone-input-group { display: flex; gap: 0; }
.phone-input-group .phone-country { width: 5.5rem; flex-shrink: 0; padding: 0.6rem 0.4rem; border: 2px solid #dee2e6; border-right: none; border-radius: 6px 0 0 6px; font-size: 0.95rem; background: #f8f9fa; cursor: pointer; }
.phone-input-group .phone-country:focus { outline: none; border-color: #4361ee; }
.phone-input-group .form-control { border-radius: 0 6px 6px 0; }
.form-help { font-size: 0.8rem; color: #6c757d; margin-top: 0.3rem; }
.maps-autocomplete-wrap { position: relative; }
.maps-autocomplete-list {
    position: absolute; z-index: 100; left: 0; right: 0;
    margin: 0; padding: 0; list-style: none;
    background: #fff; border: 1px solid #ced4da; border-top: none;
    border-radius: 0 0 6px 6px; max-height: 220px; overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,.12);
    display: none;
}
.maps-autocomplete-list.active { display: block; }
.maps-autocomplete-list li {
    padding: 0.55rem 0.75rem; cursor: pointer; font-size: 0.9rem;
    border-bottom: 1px solid #f0f0f0;
}
.maps-autocomplete-list li:last-child { border-bottom: none; }
.maps-autocomplete-list li:hover, .maps-autocomplete-list li.selected { background: #e9ecef; }
.maps-status { font-size: 0.8rem; margin-top: 0.3rem; min-height: 1.1em; }
.maps-status--ok { color: #198754; }
.maps-status--error { color: #dc3545; }
.maps-status--loading { color: #6c757d; }
.form-inline { display: flex; gap: 1rem; align-items: flex-end; flex-wrap: wrap; }
.help-text { color: #6c757d; font-size: 0.85rem; }

/* === Tables === */
.table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.table th { background: #f1f3f5; font-weight: 600; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.5px; }
.table th, .table td { padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid #eee; }
.table tbody tr:hover { background: #f8f9fa; }

/* === Cart Grid === */
.cart-grid-wrap { max-height: 340px; overflow-y: auto; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.cart-table .cart-actions { display: flex; gap: 0.4rem; justify-content: flex-end; }

/* === Hero === */
.hero { background: linear-gradient(135deg, #1a1a2e 0%, #4361ee 100%); color: #fff; padding: 5rem 0; text-align: center; }
.hero h1 { font-size: 2.5rem; margin-bottom: 1rem; }
.hero-subtitle { font-size: 1.2rem; opacity: 0.9; margin-bottom: 2rem; max-width: 600px; margin-left: auto; margin-right: auto; }

/* === Steps Grid (landing) === */
.steps-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2rem; margin-top: 2rem; }
.step-card { background: #fff; border-radius: 12px; padding: 2rem; text-align: center; box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.step-number { width: 50px; height: 50px; background: #4361ee; color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; font-weight: 700; margin: 0 auto 1rem; }
.how-it-works { padding: 4rem 0; }
.how-it-works h2 { text-align: center; font-size: 1.8rem; }

/* === Wizard === */
.wizard { padding: 2rem 0; }
.wizard h1 { margin-bottom: 2rem; }
.wizard-progress { display: flex; gap: 0.5rem; margin-bottom: 2rem; justify-content: center; }
.wizard-progress .step { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 600; background: #dee2e6; color: #6c757d; font-size: 0.9rem; }
.wizard-progress .step.active { background: #4361ee; color: #fff; }
.wizard-progress .step.done { background: #28a745; color: #fff; }
.wizard-form { max-width: 600px; }
.wizard-actions { display: flex; gap: 1rem; margin-top: 2rem; justify-content: space-between; }
.wizard-content { display: grid; grid-template-columns: 1fr auto 1fr; gap: 2rem; align-items: start; }
.divider { display: flex; align-items: center; justify-content: center; }
.divider span { background: #f8f9fa; padding: 0.5rem 1rem; color: #6c757d; font-size: 0.85rem; }

/* === File Upload === */
.file-drop-zone { border: 2px dashed #dee2e6; border-radius: 12px; padding: 3rem 2rem; text-align: center; cursor: pointer; transition: all 0.2s; }
.file-drop-zone:hover, .file-drop-zone.dragover { border-color: #4361ee; background: rgba(67,97,238,0.05); }
.logo-preview { margin-top: 1rem; }
.logo-preview img { max-width: 200px; max-height: 200px; border-radius: 8px; border: 2px solid #dee2e6; }

/* === Image Cropper === */
.crop-phase { width: 100%; }
.crop-header { margin-bottom: 1rem; }
.cropper-container { width: 100%; }
.cropper-root { width: 100%; }
.cropper-canvas-wrap {
    position: relative;
    width: 100%;
    height: 500px;
    background: #1a1a2e;
    border-radius: 12px;
    overflow: hidden;
}
.cropper-canvas, .cropper-overlay {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    touch-action: none;
}
.cropper-overlay { z-index: 2; }
.cropper-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.cropper-rot-slider { flex: 1; accent-color: #4361ee; }
.cropper-rot-label { font-size: 0.9rem; font-weight: 600; min-width: 3rem; text-align: center; }
.crop-actions { margin-top: 0.75rem; }

.ai-attempts-label {
    display: inline-block;
    margin-left: 0.75rem;
    font-size: 0.85rem;
    color: #6c757d;
}

.improve-section {
    margin-top: 1.5rem;
    padding: 1rem;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
}
.improve-section h3 { margin-top: 0; margin-bottom: 0.25rem; font-size: 1.05rem; }
.improve-section .help-text { margin-top: 0; margin-bottom: 0.75rem; }
.improve-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}
.improve-section textarea.form-control { resize: vertical; }

@media (max-width: 768px) {
    .cropper-canvas-wrap { height: 350px; }
}

/* === Card Preview (portrait credit card 54×85.6mm) === */
.preview-container { display: flex; justify-content: center; gap: 3rem; margin: 2rem 0; flex-wrap: wrap; }
.card-preview { flex: 0 0 auto; }
.card-preview h3 { text-align: center; margin-bottom: 0.75rem; color: #6c757d; font-size: 0.9rem; }
.card-mockup {
    position: relative;
    width: 260px;
    aspect-ratio: 54 / 85.6;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.12), 0 0 0 1px rgba(0,0,0,0.04);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Three-zone layout for both front and back */
.card-zone { display: flex; align-items: center; justify-content: center; }
.card-zone-logo { height: 33.3%; background: #f8f9fa; overflow: hidden; }
.card-zone-logo img { width: 100%; height: 100%; object-fit: cover; }
.card-zone-info { flex: 1; padding: 0.75rem; text-align: center; }
.card-zone-qr { flex: 1; padding: 1rem; }
.card-zone-qr img { max-width: 100%; max-height: 100%; border-radius: 4px; }
.card-zone-url { padding: 0 0.75rem 0.25rem; text-align: center; }
.card-zone-brand { height: 15%; border-top: 1px solid #f0f0f0; }
.linkatap-logo { height: 18px; width: auto; }
.card-front .card-name { font-weight: 600; font-size: 1rem; color: #1a1a2e; word-break: break-word; }
.card-back .qr-placeholder {
    width: 80px; height: 80px;
    background: #f1f3f5; border: 2px dashed #dee2e6; border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    color: #adb5bd; font-size: 0.8rem; font-weight: 600;
}
.card-back .card-url { font-size: 0.65rem; color: #6c757d; word-break: break-all; line-height: 1.3; }

/* === Link Type Chooser === */
.linktype-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }
.linktype-option { cursor: pointer; }
.linktype-option input[type="radio"] { display: none; }
.linktype-card {
    display: flex; flex-direction: column; align-items: center; gap: 0.4rem;
    padding: 1rem 0.75rem; border: 2px solid #dee2e6; border-radius: 10px;
    background: #fff; text-align: center; transition: all 0.2s;
}
.linktype-option:hover .linktype-card { border-color: #4361ee; }
.linktype-option input:checked ~ .linktype-card {
    border-color: #4361ee; background: rgba(67,97,238,0.06); box-shadow: 0 0 0 1px #4361ee;
}
.linktype-icon { width: 28px; height: 28px; color: #4361ee; }
.linktype-card strong { font-size: 0.85rem; color: #1a1a2e; }
.linktype-desc { font-size: 0.72rem; color: #6c757d; line-height: 1.3; }

/* === Orientation Chooser === */
.orientation-options { display: flex; gap: 1rem; }
.orientation-option { cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 0.4rem; }
.orientation-option input[type="radio"] { display: none; }
.orientation-card {
    padding: 0.75rem 1.5rem; border: 2px solid #dee2e6; border-radius: 10px;
    background: #fff; transition: all 0.2s; color: #6c757d;
}
.orientation-option:hover .orientation-card { border-color: #4361ee; }
.orientation-option input:checked ~ .orientation-card {
    border-color: #4361ee; background: rgba(67,97,238,0.06); color: #4361ee;
}
.orientation-option.selected .orientation-card { border-color: #4361ee; background: rgba(67,97,238,0.06); color: #4361ee; }
.orientation-icon { width: 48px; height: auto; }
.orientation-option span { font-size: 0.85rem; font-weight: 500; }

/* === Link Fields === */
.link-fields { margin-top: 0.5rem; padding: 1.25rem; background: #fff; border: 2px solid #dee2e6; border-radius: 10px; }

/* === Icon Upload === */
.icon-upload-zone { display: flex; align-items: center; gap: 1rem; }
.icon-preview { width: 64px; height: 64px; border-radius: 8px; overflow: hidden; border: 2px solid #dee2e6; flex-shrink: 0; }
.icon-preview img { width: 100%; height: 100%; object-fit: cover; }
.icon-placeholder { width: 100%; height: 100%; padding: 8px; }
.icon-upload-actions { display: flex; flex-direction: column; gap: 0.3rem; }

/* === Fieldset === */
.wizard-form fieldset { border: none; padding: 0; margin-top: 1.5rem; }
.wizard-form fieldset legend { font-weight: 600; font-size: 0.95rem; margin-bottom: 0.75rem; color: #1a1a2e; }

/* === Card Preview - Landscape (85.6×54mm) === */
.card-mockup.card-landscape {
    width: 340px;
    aspect-ratio: 85.6 / 54;
}
.card-landscape .card-front-content {
    display: grid; grid-template-columns: 1fr 1fr; height: 100%;
}
.card-landscape .card-qr-side {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 0.75rem; border-right: 1px solid #f0f0f0;
}
.card-landscape .card-qr-side img { max-width: 100px; max-height: 100px; border-radius: 4px; }
.card-landscape .card-info-side {
    display: flex; flex-direction: column; justify-content: center; align-items: flex-end;
    padding: 0.75rem; text-align: right; gap: 0.15rem;
}
.card-landscape .card-info-line {
    display: flex; align-items: center; gap: 0.3rem; font-size: 0.65rem; color: #1a1a2e; justify-content: flex-end;
}
.card-landscape .card-info-line svg { width: 10px; height: 10px; color: #4361ee; flex-shrink: 0; order: 1; }
.card-landscape .card-info-line span { order: 0; }
.card-landscape .card-info-name { font-weight: 700; font-size: 0.8rem; color: #1a1a2e; margin-bottom: 0.15rem; }
.card-landscape .card-info-title { font-size: 0.65rem; color: #6c757d; margin-bottom: 0.3rem; }
.card-landscape .card-icon-area {
    position: absolute; bottom: 18%; left: 0.5rem;
    width: 32px; height: 32px; border-radius: 4px; overflow: hidden;
}
.card-landscape .card-icon-area img { width: 100%; height: 100%; object-fit: cover; }

/* === Card Preview - Portrait (54×85.6mm) === */
.card-mockup.card-portrait {
    width: 260px;
    aspect-ratio: 54 / 85.6;
}
.card-portrait .card-front-content {
    display: flex; flex-direction: column; height: 100%;
}
.card-portrait .card-logo-area {
    height: 25%; display: flex; align-items: center; justify-content: center;
    padding: 0.5rem; background: #f8f9fa;
}
.card-portrait .card-logo-area img { max-height: 100%; max-width: 80%; object-fit: contain; }
.card-portrait .card-info-area {
    flex: 1; display: flex; flex-direction: column; justify-content: center;
    padding: 0.5rem 0.75rem; gap: 0.15rem;
}
.card-portrait .card-info-name { font-weight: 700; font-size: 0.85rem; text-align: center; }
.card-portrait .card-info-title { font-size: 0.65rem; color: #6c757d; text-align: center; margin-bottom: 0.3rem; }
.card-portrait .card-info-line {
    display: flex; align-items: center; gap: 0.3rem; font-size: 0.6rem; color: #1a1a2e;
}
.card-portrait .card-info-line svg { width: 10px; height: 10px; color: #4361ee; flex-shrink: 0; }
.card-portrait .card-qr-area {
    display: flex; align-items: center; justify-content: center; padding: 0.5rem;
}
.card-portrait .card-qr-area img { max-width: 70px; max-height: 70px; border-radius: 4px; }

.card-info-muted span { color: #6c757d; font-style: italic; }

/* === Card Brand Zone (shared) === */
.card-brand-zone {
    height: 12%; border-top: 1px solid #f0f0f0;
    display: flex; align-items: center; justify-content: center;
}

/* === Alerts === */
.alert { padding: 1rem 1.5rem; border-radius: 8px; margin: 1rem 0; }
.alert-warning { background: #fff3cd; border: 1px solid #ffc107; color: #856404; }

/* === Badges === */
.badge { display: inline-block; padding: 0.2rem 0.6rem; border-radius: 4px; font-size: 0.8rem; font-weight: 500; }
.badge-Paid { background: #d4edda; color: #155724; }
.badge-Shipped { background: #cce5ff; color: #004085; }
.badge-Fulfilled { background: #d1ecf1; color: #0c5460; }
.badge-Pending { background: #fff3cd; color: #856404; }
.badge-Cancelled { background: #f8d7da; color: #721c24; }

/* === Dashboard === */
.dashboard-actions { display: flex; gap: 1rem; margin: 1.5rem 0; }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.5rem; margin: 2rem 0; }
.stat-card { background: #fff; border-radius: 12px; padding: 1.5rem; text-align: center; box-shadow: 0 2px 8px rgba(0,0,0,0.08); }
.stat-value { font-size: 2rem; font-weight: 700; color: #4361ee; }
.stat-label { color: #6c757d; font-size: 0.85rem; margin-top: 0.3rem; }
.empty-state { color: #6c757d; padding: 2rem; text-align: center; }

/* === Order Confirmation === */
.confirmation { padding: 4rem 0; }
.confirmation-icon { font-size: 4rem; color: #28a745; margin-bottom: 1rem; }
.order-number { font-size: 1.2rem; margin: 1rem 0; }

/* === Order Detail === */
.order-meta { background: #fff; border-radius: 8px; padding: 1.5rem; margin: 1rem 0; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.order-totals { background: #fff; border-radius: 8px; padding: 1.5rem; margin: 1rem 0; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.order-totals .total { font-size: 1.2rem; margin-top: 0.5rem; }
.reverse-charge { color: #856404; font-style: italic; }
.order-actions { display: flex; gap: 1rem; margin: 1.5rem 0; }

/* === Payment === */
.summary-box { background: #fff; border-radius: 8px; padding: 1.5rem; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.mgmt-links { margin-top: 2rem; }

/* === Responsive === */
@media (max-width: 768px) {
    .hero h1 { font-size: 1.8rem; }
    .steps-grid { grid-template-columns: 1fr; }
    .wizard-content { grid-template-columns: 1fr; }
    .preview-container { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: 1fr; }
    .linktype-grid { grid-template-columns: repeat(2, 1fr); }
    .card-mockup.card-landscape { width: 100%; max-width: 340px; }
}
