/* Reset a základní styly */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');

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

:root {
    --primary: #ff005c;
    --primary-hover: #d6004f;
    --background: #ffffff;
    --foreground: #0f172a;
    --muted: #f1f5f9;
    --muted-foreground: #64748b;
    --border: #e2e8f0;
    --card: #ffffff;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
}

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--foreground);
    background: var(--background);
    min-height: 100vh;
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Page header */
.page-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0 8px;
    margin-bottom: 8px;
}

.page-title h1 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}

.header-subtitle {
    color: var(--muted-foreground);
    font-size: 14px;
}

/* Step flow */
.step-flow {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 12px;
    margin: 8px 0 16px;
}

.step-card {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    position: relative;
}

.step-number {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--primary);
    color: white;
    display: grid;
    place-items: center;
    font-weight: 700;
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.15);
}

.step-card h3 {
    margin-bottom: 4px;
    font-size: 16px;
}

.step-card p {
    color: var(--muted-foreground);
    font-size: 14px;
    line-height: 1.5;
}
.step-card.active {
    border-color: var(--primary);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.12);
}

.step-card.locked {
    opacity: 0.55;
    background: linear-gradient(135deg, #f8fafc, #e2e8f0);
    pointer-events: none;
}

.step-card.complete::after {
    content: '✓';
    position: absolute;
    top: 10px;
    right: 12px;
    background: #dcfce7;
    color: #15803d;
    border-radius: 999px;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 700;
}

.step-actions {
    margin-top: 12px;
    padding: 12px;
    border: 1px dashed var(--border);
    border-radius: 8px;
    background: rgba(241, 245, 249, 0.5);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.step-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.step-note {
    color: var(--muted-foreground);
    font-size: 14px;
}

.header-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.preview-header h2 {
    margin-bottom: 0;
}

.locked-panel {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 16px;
    align-items: center;
    padding: 20px;
    border: 1px dashed var(--border);
    border-radius: 12px;
    background: #f8fafc;
}

.locked-icon {
    width: 54px;
    height: 54px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: #e2e8f0;
    color: #0f172a;
}

.locked-icon svg {
    width: 28px;
    height: 28px;
}

.locked-kicker {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted-foreground);
    font-weight: 700;
    font-size: 12px;
    margin-bottom: 4px;
}

.locked-text {
    color: var(--muted-foreground);
    margin-top: 4px;
    margin-bottom: 10px;
}

.locked-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.step-hint {
    margin-top: -4px;
    margin-bottom: 12px;
    color: var(--muted-foreground);
    font-size: 14px;
}


/* Main */
.main-content {
    padding: 32px 24px;
}

/* Grid layout */
.grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 32px;
}

.grid-2col.single-column {
    grid-template-columns: 1fr;
}

@media (max-width: 1024px) {
    .grid-2col {
        grid-template-columns: 1fr;
    }
}

/* Panel */
.panel-left,
.panel-right {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Section */
.section {
    margin-bottom: 24px;
}

h2 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 16px;
}

h3 {
    font-size: 18px;
    font-weight: 600;
}

h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

/* Card */
.card {
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--card);
    overflow: hidden;
}

.card-header {
    padding: 16px 24px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--border);
}

.card-body {
    padding: 24px;
}

/* Upload area */
.upload-area {
    border: 2px dashed var(--border);
    border-radius: 8px;
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--card);
}

.upload-area:hover {
    border-color: var(--primary);
    background: var(--muted);
}

.upload-area.drag-over {
    border-color: var(--primary);
    background: rgba(37, 99, 235, 0.05);
}

.upload-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 16px;
    color: var(--muted-foreground);
}

.upload-formats {
    color: var(--muted-foreground);
    font-size: 14px;
    margin-top: 8px;
}

.upload-preview {
    margin-top: 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--card);
    padding: 16px;
}

.upload-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 12px;
}

.upload-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.upload-preview-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    align-items: center;
    background: var(--muted);
}

.upload-preview-thumb {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    object-fit: cover;
    background: #fff;
    border: 1px solid var(--border);
}

.upload-preview-info {
    flex: 1;
    min-width: 0;
}

.upload-preview-name {
    font-weight: 600;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.upload-preview-meta {
    font-size: 13px;
    color: var(--muted-foreground);
}

.upload-remove {
    border: 1px solid var(--border);
    background: #fff;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.upload-remove:hover {
    background: #fee2e2;
    border-color: #ef4444;
    color: #b91c1c;
}

/* Form */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    font-size: 14px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
}

.spacing-static {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--muted);
    font-weight: 600;
    color: var(--foreground);
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-hint {
    color: var(--muted-foreground);
    font-size: 12px;
    margin-top: 4px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--card);
    color: var(--foreground);
}

.btn:hover {
    background: var(--muted);
}

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

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

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-lg {
    width: 100%;
    padding: 12px 24px;
    font-size: 16px;
}

.btn-icon {
    width: 20px;
    height: 20px;
}

.btn-icon.spin {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Icon */
.icon {
    width: 20px;
    height: 20px;
}

/* File editor */
.file-item {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    background: var(--card);
}

.file-item-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.file-thumbnail {
    width: 60px;
    height: 60px;
    object-fit: contain;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--muted);
}

.file-info {
    flex: 1;
}

.file-name {
    font-weight: 500;
    margin-bottom: 4px;
}

.file-size {
    color: var(--muted-foreground);
    font-size: 12px;
}

@media (max-width: 768px) {
    .file-item {
        padding: 14px 12px;
    }

    .file-item-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .file-thumbnail {
        width: 100%;
        max-width: 180px;
        height: auto;
    }
}

.file-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
}

@media (max-width: 900px) {
    .file-controls {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 10px;
    }
}


.preset-select {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.preset-dropdown {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--muted);
    font-weight: 600;
    cursor: pointer;
}

.preset-dropdown:focus {
    outline: 2px solid #4f46e5;
    outline-offset: 2px;
    border-color: #4f46e5;
}

.preset-note {
    color: var(--muted-foreground);
    font-size: 12px;
    line-height: 1.5;
}

.aspect-controls {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    font-size: 14px;
}

.checkbox-label input {
    width: auto;
}

.aspect-note {
    color: var(--muted-foreground);
    font-size: 12px;
    line-height: 1.5;
}

/* Generate section */
.generate-section {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.generate-hint {
    text-align: center;
    color: var(--muted-foreground);
    font-size: 14px;
    margin-top: 8px;
}

/* Empty states */
.empty-state,
.preview-empty {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 64px 32px;
    text-align: center;
    background: rgba(241, 245, 249, 0.3);
}

.empty-icon,
.preview-empty-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    color: var(--muted-foreground);
}

.empty-state p,
.preview-empty p {
    color: var(--muted-foreground);
    margin-top: 8px;
}

/* Preview */
.preview-controls {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 8px;
}

.optimize-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--card);
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.optimize-actions .step-hint {
    margin: 0;
    color: var(--muted-foreground);
}

.optimize-actions .preview-controls {
    margin: 0;
}

#previewContainer {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    background: var(--card);
    overflow: auto;
}

#previewCanvas {
    max-width: 100%;
    border: 1px solid var(--border);
    display: block;
}

/* Summary */
.summary-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.summary-item:last-child {
    border-bottom: none;
}

.summary-item span:first-child {
    color: var(--muted-foreground);
}

.summary-item span:last-child {
    font-weight: 500;
}

.efficiency-excellent { color: #10b981; }
.efficiency-good { color: #84cc16; }
.efficiency-average { color: #f59e0b; }
.efficiency-low { color: #ef4444; }

.muted {
    color: var(--muted-foreground);
}

.visually-hidden-block {
    visibility: hidden;
    height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    overflow: hidden;
}

.error {
    color: #b91c1c;
}

.recommendation-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.summary-pill {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    background: var(--card);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.summary-pill span {
    color: var(--muted-foreground);
    font-size: 13px;
}

.summary-pill strong {
    font-size: 16px;
}

.summary-pill.success {
    border-color: #bbf7d0;
    background: #f0fdf4;
}

.summary-pill.warning {
    border-color: #fed7aa;
    background: #fff7ed;
}

.summary-pill.price {
    border-color: #bfdbfe;
    background: #eff6ff;
}

.recommendation-list ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.recommendation-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    gap: 12px;
}

.recommendation-item:last-child {
    border-bottom: none;
}

.item-title {
    font-weight: 600;
}

.item-meta {
    color: var(--muted-foreground);
    font-size: 13px;
    margin-top: 4px;
}

.item-price {
    font-weight: 600;
    white-space: nowrap;
}

.list-header {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 8px;
}

.empty-recommendation {
    border: 1px dashed var(--border);
    border-radius: 8px;
    padding: 12px;
    background: var(--muted);
}

.recommendation-json {
    margin-top: 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    background: var(--muted);
}

.purchase-actions {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.upload-progress {
    margin-top: 6px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--muted);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.upload-progress-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
    color: var(--text-primary);
}

.upload-progress-value {
    font-variant-numeric: tabular-nums;
}

.upload-progress-bar {
    width: 100%;
    height: 8px;
    border-radius: 999px;
    background: #e5e7eb;
    overflow: hidden;
}

.upload-progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #ff66a3);
    transition: width 0.2s ease;
}

.json-preview {
    margin: 0;
    padding: 12px;
    background: #0b1424;
    color: #e5e7eb;
    border-radius: 8px;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 13px;
    overflow-x: auto;
}

.warning-box {
    margin-top: 16px;
    padding: 12px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    color: #991b1b;
    font-size: 14px;
}

.warning-box strong {
    display: block;
    margin-bottom: 4px;
}

/* Help section */
.help-section {
    margin-top: 48px;
}

.help-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin-top: 24px;
}

@media (max-width: 1024px) {
    .help-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .help-grid {
        grid-template-columns: 1fr;
    }
}

.help-item {
    text-align: left;
}

.help-number {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 20px;
    margin-bottom: 12px;
}

.help-item p {
    color: var(--muted-foreground);
    font-size: 14px;
}

.help-features {
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.help-features ul {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 16px;
}

@media (max-width: 640px) {
    .help-features ul {
        grid-template-columns: 1fr;
    }
}

.help-features li {
    color: var(--muted-foreground);
    font-size: 14px;
}

/* Footer */
.footer {
    margin-top: 48px;
    padding: 32px 24px;
    background: linear-gradient(90deg, rgba(37, 99, 235, 0.05), rgba(15, 23, 42, 0.05));
    border-top: 1px solid var(--border);
    text-align: center;
}

.footer-content {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 24px;
    flex-wrap: wrap;
    text-align: center;
}

.footer-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.footer-brand h3 {
    margin-bottom: 6px;
}

.footer-brand p {
    color: var(--muted-foreground);
}

.footer-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.footer-chip {
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: white;
    color: var(--muted-foreground);
    font-size: 13px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

/* Toast notifications */
#toastContainer {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 400px;
}

.toast {
    padding: 16px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast-success {
    background: #10b981;
    color: white;
}

.toast-error {
    background: #ef4444;
    color: white;
}

.toast-warning {
    background: #f59e0b;
    color: white;
}

.toast-info {
    background: #3b82f6;
    color: white;
}

.toast-content {
    flex: 1;
    font-size: 14px;
}

/* Responsivita */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .header-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .header-buttons {
        width: 100%;
    }

    .main-content {
        padding-top: 16px;
    }
}
