/*
 * Gradient from Image ([gradient_from_image]). Loaded after tools.css, which
 * supplies the type scale, inputs, sliders and button icons; this is only what
 * this tool adds. Radius scale as everywhere: 28px stages, 24px cards, 20px
 * outputs, 14px swatches, pills for controls.
 */

.gi-layout { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 20px; align-items: start; margin-bottom: 20px; }

/* Drop zone */
.gi-drop {
	position: relative;
	display: flex; align-items: center; justify-content: center;
	min-height: 300px;
	border: 2px dashed #DCDCE4; border-radius: 28px;
	background: #FAFAFC;
	cursor: pointer; overflow: hidden;
	transition: border-color .15s, background .15s;
}
.gi-drop:hover, .gi-drop.is-over { border-color: #7B5CFF; background: #F6F3FF; }
.gi-drop.has-image { border-style: solid; border-color: #EFEFF4; background: #fff; }
.gi-drop img { display: block; max-width: 100%; max-height: 420px; object-fit: contain; }
.gi-drop img[hidden], .gi-drop-empty[hidden] { display: none !important; }  /* display:flex would beat [hidden] */
.gi-drop-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; color: #6E6E78; padding: 24px; }
.gi-drop-empty .tg-i { width: 28px; height: 28px; color: #7B5CFF; transform: rotate(180deg); margin-bottom: 4px; }
.gi-drop-empty strong { font-size: 17px; color: #111; }
.gi-drop-empty span { font-size: 13px; }
.gi-drop-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 12px 0 18px; }
.gi-privacy { font-size: 13px; color: #6E6E78; }

/* Gradient preview */
.gi-preview {
	position: relative;
	height: 220px; border-radius: 28px;
	background: repeating-conic-gradient(#F2F2F6 0% 25%, #fff 0% 50%) 0 0 / 20px 20px;
	display: flex; align-items: flex-end; justify-content: center;
	padding: 16px;
	box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .05);
}
.gi-preview span { font-size: 12px; font-weight: 600; color: #6E6E78; background: rgba(255, 255, 255, .85); padding: 5px 12px; border-radius: 999px; }
.gi-preview.has-gradient span { color: #fff; background: rgba(0, 0, 0, .35); }

/* Side cards */
.gi-side { display: grid; gap: 14px; }
.gi-card { background: #fff; border: 1px solid #F0F0F0; border-radius: 24px; padding: 18px 20px; box-shadow: 0 1px 3px rgba(0, 0, 0, .04); }
.gi-card-title { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #6E6E78; margin-bottom: 10px; }
.gi-hint { font-size: 13px; line-height: 1.55; color: #6E6E78; margin: 0 0 12px; }
.gi-card .tg-grain { border: 0; background: none; padding: 0; }

.gi-palette { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; }
.gi-palette-empty { grid-column: 1 / -1; font-size: 13px; color: #6E6E78; padding: 8px 0; }
.gi-swatch {
	display: flex !important; flex-direction: column; align-items: center; gap: 4px;
	padding: 8px 4px !important; border: 1px solid #EFEFF4 !important; border-radius: 16px !important;
	background: #fff !important; cursor: pointer; transition: border-color .15s, box-shadow .15s;
}
.gi-swatch:hover { border-color: #C9C9D3 !important; }
.gi-swatch[aria-pressed="true"] { border-color: #111 !important; box-shadow: 0 0 0 1px #111; }
.gi-swatch-chip { position: relative; width: 44px; height: 44px; border-radius: 14px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08); display: flex; align-items: center; justify-content: center; }
.gi-swatch-chip b { width: 20px; height: 20px; border-radius: 50%; background: #111; color: #fff; font-size: 11px; display: flex; align-items: center; justify-content: center; box-shadow: 0 0 0 2px #fff; }
.gi-swatch code { font-family: 'SF Mono', 'Fira Code', ui-monospace, monospace; font-size: 11px; color: #222; background: none; padding: 0; }
.gi-swatch small { font-size: 11px; color: #6E6E78; }

.gi-picked-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; min-height: 30px; }
.gi-picked { display: flex; align-items: center; gap: 6px; }
.gi-picked span { width: 26px; height: 26px; border-radius: 9px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08); }
.gi-picked i { font-style: normal; color: #6E6E78; font-size: 12px; }

.gi-angle-row { display: flex; align-items: center; gap: 12px; }
.gi-angle-val { min-width: 44px; text-align: right; font-family: 'SF Mono', 'Fira Code', ui-monospace, monospace; font-size: 13px; color: #55555F; }
.gi-angle-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.gi-preset { padding: 5px 11px !important; border-radius: 999px !important; border: 1px solid #E8E8EE !important; background: #fff !important; font-size: 12px; font-weight: 600; color: #45454F !important; cursor: pointer; }
.gi-preset.on { background: #111 !important; border-color: #111 !important; color: #fff !important; }

/* Outputs and actions */
.gi-outputs { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.gi-output { position: relative; background: #F7F7FA; border: 1px solid #EFEFF4; border-radius: 20px; padding: 16px 18px 18px; }
.gi-output-label { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #6E6E78; margin-bottom: 10px; }
.gi-output pre {
	margin: 0 !important; padding: 0 64px 0 0 !important; background: transparent !important; border: 0 !important; border-radius: 0 !important; box-shadow: none !important;
	font-family: 'SF Mono', 'Fira Code', ui-monospace, monospace; font-size: 13px; line-height: 1.6; color: #1A1A22;
	white-space: pre-wrap; word-break: normal; overflow-wrap: anywhere;
}
.gi-copy { position: absolute; top: 12px; right: 12px; padding: 5px 14px !important; border-radius: 999px !important; border: 1px solid #DDDDE4 !important; background: #fff !important; font-size: 12px; font-weight: 600; color: #222 !important; cursor: pointer; }
.gi-copy:hover { background: #111 !important; color: #fff !important; border-color: #111 !important; }
.gi-copy.ok { background: #E6F4EA !important; border-color: #A8D5B5 !important; color: #2D7A4F !important; }

.gi-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.gi-btn { display: inline-flex; align-items: center; gap: 7px; padding: 11px 20px; border-radius: 999px; font-size: 14px; font-weight: 600; text-decoration: none !important; cursor: pointer; border: 1px solid transparent; transition: background .15s, transform .15s; }
.gi-btn:hover { transform: translateY(-1px); }
.gi-btn-primary { background: #111; color: #fff !important; }
.gi-btn-primary[aria-disabled="true"] { opacity: .4; pointer-events: none; }
.gi-btn-ghost { background: #fff; border-color: #E2E2E8; color: #222 !important; }
.gi-btn-ghost:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.gi-btn-sm { padding: 6px 14px; font-size: 13px; }

@media (max-width: 860px) {
	.gi-layout { grid-template-columns: 1fr; }
	.gi-outputs { grid-template-columns: 1fr; }
	.gi-drop { min-height: 220px; }
}
