:root { --primary: #000; --bg: #f5f6f8; --card-bg: #fff; --border: #eee; --apple-blue: #007AFF; --apple-red: #FF3B30; --text-main: #1d1d1f; --text-muted: #86868b; }
* { box-sizing: border-box; font-family: -apple-system, BlinkMacSystemFont, sans-serif; }
body { background: var(--bg); margin: 0; padding: 40px 0; display: flex; justify-content: center; }
#app { width: 1100px; background: var(--card-bg); border-radius: 16px; padding: 24px; box-shadow: 0 20px 60px rgba(0,0,0,.08); }
.header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.workspace { display: flex; gap: 24px; align-items: flex-start; }
.left, .right { flex: 1; }
.card { background: #fafafa; border-radius: 12px; padding: 16px; margin-bottom: 16px; border: 1px solid var(--border); position: relative; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.drop { border: 2px dashed #ccc; border-radius: 12px; padding: 10px; text-align: center; cursor: pointer; position: relative; height: 500px; display: flex; align-items: center; justify-content: center; background: #fff; overflow: hidden; }
.preview { position: absolute; inset: 0; background: #fff; display: flex; align-items: center; justify-content: center; z-index: 5; }
.preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.modern-remove-btn { position: absolute; top: 15px; right: 15px; background: #fff; border: 1px solid #ddd; border-radius: 50%; width: 35px; height: 35px; cursor: pointer; display: flex; align-items: center; justify-content: center; z-index: 10; font-size: 20px; box-shadow: 0 4px 10px rgba(0,0,0,0.1); }
button { padding: 8px 16px; border-radius: 8px; border: 1px solid #ddd; background: #fff; cursor: pointer; font-weight: 500; }
button:hover { background: #f9f9f9; transform: translateY(-1px); }
button.primary-btn { background: var(--primary); color: #fff; border: none; }
button.secondary-btn { background: #fff; color: #333; }
button:disabled { opacity: 0.3; cursor: not-allowed; }
pre { white-space: pre-wrap; background: #fff; padding: 15px; border-radius: 8px; border: 1px solid var(--border); min-height: 50px; font-size: 14px; margin: 0; }

.hidden { display: none !important; }

/* MODALS */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.5); backdrop-filter: blur(8px); z-index: 9999; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-content { background: #fff; width: 100%; max-width: 850px; height: 85vh; border-radius: 24px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 20px 50px rgba(0,0,0,0.2); }
.modal-header { padding: 16px 24px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; }
.tabs { display: flex; background: #f9f9f9; border-bottom: 1px solid var(--border); padding: 6px; gap: 4px; flex-shrink: 0; overflow-x: auto; }
.tab-link { padding: 10px 15px; border: none; background: none; cursor: pointer; border-radius: 10px; font-size: 13px; color: var(--text-muted); white-space: nowrap; }
.tab-link.active { background: #fff; color: #000; font-weight: 600; box-shadow: 0 2px 6px rgba(0,0,0,0.05); }

.tab-container-scroll { flex: 1; overflow-y: auto; background: #fff; display: flex; flex-direction: column; }
.tab-content { padding: 24px; display: flex; flex-direction: column; gap: 20px; min-height: min-content; }

.dropdown { position: relative; display: inline-block; }
.dropdown-content { display: none; position: absolute; right: 0; background: #fff; min-width: 200px; box-shadow: 0 10px 30px rgba(0,0,0,0.15); border-radius: 12px; z-index: 100; padding: 10px; border: 1px solid #eee; }
.dropdown-content.show { display: block; }
.lang-opt { padding: 10px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.lang-opt:hover { background: #f5f5f7; }

.prompt-segment { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.prompt-segment label { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--text-muted); }
.prompt-segment textarea { width: 100%; border: 1px solid #d2d2d7; border-radius: 12px; padding: 14px; font-size: 13px; background: #fbfbfd; resize: vertical; outline: none; }

.style-selector { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 5px; flex-shrink: 0; }
.style-tag { padding: 6px 12px; border-radius: 20px; border: 1px solid #ddd; background: #fff; font-size: 11px; cursor: pointer; }
.style-tag.selected { background: var(--apple-blue); color: #fff; border-color: var(--apple-blue); }

.headlines-results { display: flex; flex-direction: column; gap: 8px; }
.headline-item { display: flex; align-items: center; gap: 12px; background: #f5f5f5; padding: 12px; border-radius: 14px; cursor: pointer; border: 2px solid transparent; }
.headline-item.selected { border-color: var(--apple-blue); background: #f0f7ff; }
.headline-text { flex: 1; font-size: 14px; line-height: 1.4; color: var(--text-main); }
.no-hover { cursor: default !important; }

.headlines-actions-wrapper { display: flex; flex-direction: column; gap: 10px; padding: 15px 0; border-top: 1px solid #f0f0f0; margin-top: 10px; }
.ads-info-block { margin-top: 20px; padding: 20px; background: #f5f5f7; border-radius: 18px; display: flex; flex-direction: column; gap: 10px; }
.ads-info-row { display: flex; justify-content: space-between; align-items: center; background: #fff; padding: 10px 15px; border-radius: 10px; border: 1px solid #eee; }
.ads-info-label { font-weight: bold; font-size: 10px; color: var(--apple-blue); margin-right: 10px; }

.chat-container { padding: 15px 24px; background: #fff; border-top: 1px solid var(--border); flex-shrink: 0; }
.chat-bar { display: flex; gap: 10px; background: #f5f5f7; padding: 6px; border-radius: 25px; border: 1px solid #e5e5e5; }
.chat-bar input { border: none; background: none; flex: 1; padding-left: 15px; outline: none; font-size: 14px; }
.chat-bar button { background: var(--apple-blue); color: #fff; border: none; width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; cursor: pointer; }

.modal-footer { border-top: 1px solid var(--border); padding: 16px 24px; flex-shrink: 0; }
.icon-btn-small { background: #f5f5f7; border: 1px solid #ddd; border-radius: 6px; padding: 4px 8px; cursor: pointer; font-size: 14px; }
.delete-hl { color: var(--apple-red); }

.history-item { display: flex; gap: 15px; background: #fff; border: 1px solid var(--border); padding: 10px; border-radius: 12px; align-items: center; margin-bottom: 10px; cursor: pointer; }
.history-item.active-history { border: 2px solid var(--primary); background: #f0f7ff; }
.history-img { width: 50px; height: 50px; object-fit: cover; border-radius: 8px; }
.pagination { display: flex; justify-content: center; gap: 5px; margin-top: 15px; }
.pagination button.active { background: var(--primary); color: #fff; }
.loading { position: fixed; inset: 0; background: rgba(255,255,255,0.8); z-index: 10000; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.spinner { width: 32px; height: 32px; border: 3px solid #eee; border-top-color: var(--primary); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* STYLES GENERATION IMAGES */
.image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.gen-image-card { border-radius: 12px; overflow: hidden; border: 2px solid transparent; cursor: pointer; position: relative; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,0.05); transition: opacity 0.2s, transform 0.2s; }
.gen-image-card.selected { border-color: var(--apple-blue); }
.gen-image-card img { width: 100%; height: 150px; object-fit: cover; display: block; }
.gen-image-overlay { padding: 8px; font-size: 11px; color: #666; background: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.settings-select { width: 100%; padding: 10px; border-radius: 8px; border: 1px solid #ddd; background: #f9f9f9; font-size: 13px; outline: none; margin-top: 5px; }
.input-images-bar { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; margin-bottom: 8px; border-bottom: 1px solid #f0f0f0; }
.input-img-thumb { width: 40px; height: 40px; border-radius: 6px; object-fit: cover; border: 1px solid #ddd; }
.input-img-wrapper { position: relative; }
.remove-input-img { position: absolute; top: -5px; right: -5px; background: #fff; border: 1px solid #ccc; border-radius: 50%; width: 16px; height: 16px; font-size: 10px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: red; }

/* DRAG & DROP ANIMATION */
.gen-image-card.dragging { opacity: 0.4; }
.gen-image-card.drag-over { transform: scale(1.05); box-shadow: 0 8px 20px rgba(0,0,0,0.15); z-index: 10; border: 2px solid var(--apple-blue); }
