/* Color Palette Generator: page styles on top of css/apps.css */

.cg-layout {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

/* ---------- Controls ---------- */
.cg-picker { display: flex; gap: 10px; align-items: stretch; }
.cg-picker .input { flex: 1; min-width: 0; text-transform: uppercase; }

.cg-swatch-input {
    flex: none;
    width: 46px;
    height: 44px;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: rgba(7, 11, 22, 0.75);
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.cg-swatch-input:hover { border-color: rgba(var(--signal-rgb), 0.5); }
.cg-swatch-input:focus-visible { outline: none; border-color: var(--signal); box-shadow: 0 0 0 3px rgba(var(--signal-rgb), 0.15); }
.cg-swatch-input::-webkit-color-swatch-wrapper { padding: 0; }
.cg-swatch-input::-webkit-color-swatch { border: 0; border-radius: 8px; }
.cg-swatch-input::-moz-color-swatch { border: 0; border-radius: 8px; }

.cg-count { display: flex; align-items: center; justify-content: space-between; }
.cg-count b {
    min-width: 40px;
    padding: 3px 10px;
    border-radius: 8px;
    border: 1px solid rgba(var(--signal-rgb), 0.45);
    background: rgba(var(--signal-rgb), 0.1);
    color: var(--signal);
    text-align: center;
    font-size: 0.95rem;
}
.cg-range { width: 100%; margin: 6px 0 0; accent-color: var(--signal); cursor: pointer; }
.cg-ticks { display: flex; justify-content: space-between; font-size: 0.74rem; color: var(--fg-3); }
.cg-ticks i { font-style: normal; }

.cg-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.cg-actions .btn { justify-content: center; }

/* ---------- Results ---------- */
.cg-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cg-head .panel__title { margin-right: 4px; }
.cg-head .chip { font-size: 0.8rem; }
#currentType { color: var(--signal); border-color: rgba(var(--signal-rgb), 0.4); }

.cg-palette {
    display: grid;
    grid-template-columns: repeat(var(--cols, 5), minmax(0, 1fr));
    gap: 12px;
}

.color-item {
    display: flex;
    flex-direction: column;
    border-radius: 14px;
    border: 1px solid var(--line-soft);
    background: rgba(7, 11, 22, 0.5);
    overflow: hidden;
    animation: cg-in 0.45s var(--ease-out) both;
    animation-delay: calc(var(--i, 0) * 35ms);
    transition: border-color 0.2s, transform 0.25s var(--ease-out);
}
.color-item:hover { border-color: rgba(var(--signal-rgb), 0.45); transform: translateY(-2px); }
@keyframes cg-in { from { opacity: 0; transform: translateY(8px); } }

.color-swatch {
    display: grid;
    place-items: center;
    height: 180px;
    width: 100%;
    border: 0;
    border-bottom: 1px solid var(--line-soft);
    cursor: pointer;
}
.color-swatch i { opacity: 0; transform: scale(0.8); transition: opacity 0.2s, transform 0.25s var(--ease-out); font-size: 1.1rem; }
.color-swatch:hover i, .color-swatch:focus-visible i { opacity: 0.85; transform: none; }
.color-swatch:focus-visible { outline: 2px solid var(--signal); outline-offset: -4px; }

.color-details {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 6px;
    position: relative;
    padding: 10px 10px 12px 12px;
}
.color-text { display: grid; gap: 2px; min-width: 0; }
.color-hex { padding-right: 30px; font-family: var(--font-code); font-size: 0.95rem; font-weight: 600; color: var(--fg); }
.color-sub { font-family: var(--font-code); font-size: 0.7rem; color: var(--fg-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.color-details .copy { position: absolute; top: 6px; right: 6px; }

/* fallback notification (only used if the site toast is unavailable) */
.notification {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--ink-2);
    color: var(--fg);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.25s, transform 0.3s var(--ease-out);
}
.notification.show { opacity: 1; transform: none; }
.notification i { color: var(--mint); }
.notification.error i { color: var(--rose); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
    .cg-palette { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}
@media (max-width: 900px) {
    .cg-layout { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
    .cg-palette { grid-template-columns: 1fr; gap: 8px; }
    .color-item { flex-direction: row; }
    .color-swatch { width: 96px; height: auto; min-height: 76px; flex: none; border-bottom: 0; border-right: 1px solid var(--line-soft); }
    .color-details { flex: 1; min-width: 0; align-items: center; }
    .color-details .copy { top: 50%; transform: translateY(-50%); }
    .cg-results .panel__actions { width: 100%; }
    .cg-results .panel__actions .btn { flex: 1; justify-content: center; }
}
@media (hover: none) {
    .color-swatch i { opacity: 0.6; transform: none; }
}
