/* Palette Generator v3.0 - Minimal Design */

/* Header */
header {
    margin: 0 0 60px 0;
}

/* Logo */
.logo {
    display: flex;
    gap: 2px;
    margin: 20px 0 0 20px;
    width: fit-content;
}

.color-bar {
    width: 10px;
    height: 10px;
}

/* removed legacy btn-square animations in favor of iconoir */

body {
    font-family: Arial, sans-serif;
    margin: 40px;
    background: white;
    color: black;
}

/* Fixed top header */
.topbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    background: #fff;
    border-bottom: 1px solid #eee;
    z-index: 1000;
}
.topbar__inner { max-width: 800px; margin: 0 auto; padding: 8px 20px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: #333; }
.brand__title { font-weight: 600; }

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 68px 20px 180px 20px; /* top for header, bottom for log dock */
}

h1 {
    text-align: center;
    color: black;
    margin-bottom: 30px;
    font-weight: normal;
}

/* Version badge next to title */
.version-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    font-size: 12px;
    color: #555;
    background: #f2f2f2;
    border: 1px solid #e0e0e0;
    border-radius: 999px;
    vertical-align: middle;
}

/* Tabs - Solo linea orizzontale */
.tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 1px solid #ccc;
}

.tab {
    flex: 1;
    padding: 12px 0;
    cursor: pointer;
    color: #666;
    background: none;
    border: none;
    display: inline-flex;
    align-items: center; /* vertical alignment icon/text */
    justify-content: center;
    gap: 6px;
}

.tab.active {
    color: black;
    font-weight: bold;
}

.sub-tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.sub-tab {
    flex: 1;
    padding: 8px 0;
    text-align: center;
    cursor: pointer;
    color: #666;
    font-size: 14px;
    background: none;
    border: none;
}

.sub-tab.active {
    color: black;
}

.sub-tab.disabled {
    color: #ccc;
    cursor: not-allowed;
}

/* Content */
.batch-mode {
    display: none;
}

.batch-mode.active {
    display: block;
}

.tab-content { display: none; }
.tab-content.active {
    display: flex;
    flex-direction: column;
    gap: 10px; /* breathing space between elements */
    padding: 8px 0; /* vertical padding inside panel */
    min-height: 240px; /* consistent panel height across tabs */
}

/* Keep action buttons anchored at the bottom of the tab panel */
.tab-content .button-group { margin-top: auto; }

/* Form Elements */
input, textarea {
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    background: white;
    color: black;
    font-size: 14px;
    margin: 10px 0;
    box-sizing: border-box;
}

.hidden-file {
    position: absolute;
    left: -9999px;
    width: 1px; height: 1px;
    opacity: 0;
}
.input-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.input-status { font-size: 12px; color: #777; }

input:focus, textarea:focus {
    border-color: black;
    outline: none;
}

textarea {
    height: 80px;
    resize: vertical;
}

/* Button System - Unified Design */
/* Minimal buttons */
.btn {
    background: transparent;
    border: 1px solid #e0e0e0;
    color: #333;
    font-size: 14px;
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    font-family: inherit;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 6px;
}

.btn:hover { background: #f7f7f7; }
.btn:focus-visible { outline: 0; box-shadow: 0 0 0 2px #fff, 0 0 0 4px #111; }
.btn:disabled { color: #bbb; border-color: #eee; cursor: not-allowed; background: transparent; }

/* Button sizes */
.btn--sm {
    font-size: 12px;
    padding: 4px 8px;
}

.btn--md {
    font-size: 14px;
    padding: 8px 12px;
}

.btn--lg {
    font-size: 16px;
    padding: 12px 16px;
}

/* Primary action buttons */
.btn--primary {
    color: #111;
    border-color: #ddd;
}

/* Danger variant */
.btn--danger { color: #d93025; border-color: #efb3ad; }
.btn--danger:hover { background: #fdf3f2; }

/* Icon-only buttons (square) */
.btn--icon-only { padding: 8px; width: 34px; height: 34px; justify-content: center; }

/* Icon sizing for inline SVG or iconoir webfont */
.icon { width: 16px; height: 16px; vertical-align: text-bottom; }
.btn i[class^="iconoir-"] { font-size: 16px; line-height: 1; }

/* (progress fill removed) */

/* Legacy button styles for compatibility */
button {
    background: none;
    color: #333;
    border: none;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 14px;
    margin: 10px 0;
    font-family: inherit;
}

button:hover {
    color: black;
}

button:disabled {
    color: #ccc;
    cursor: not-allowed;
}

/* Progress - Hidden */
.progress {
    display: none !important;
}

/* Button animations with percentage */
.btn-loading {
    position: relative;
    margin-right: 40px; /* Space for percentage */
}

.btn-loading::after {
    content: attr(data-progress);
    position: absolute;
    right: -35px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    color: #666;
    min-width: 30px;
}

/* Log - Solo testo */
.log {
    font-family: monospace;
    font-size: 12px;
    color: #666;
    margin: 15px 0;
    display: none;
    white-space: pre-wrap;
}

/* Results */
.result {
    margin: 20px 0;
    text-align: center;
}

/* Images */
img {
    max-width: 400px;
    cursor: pointer;
    margin: 10px;
    border: 1px solid #eee;
}

/* Carousel */
.carousel {
    margin: 20px 0;
    display: none;
    overflow-x: auto;
    white-space: nowrap;
    padding: 10px 0;
}

.batch-item {
    display: inline-block;
    margin-right: 15px;
    text-align: center;
    vertical-align: top;
    white-space: normal;
}

.batch-item img {
    width: 200px;
    height: auto;
    cursor: pointer;
    margin-bottom: 5px;
}

.batch-item button {
    display: block;
    margin: 5px auto 0;
}

/* Modal */
/* Modal (single definition) */

/* Crop Editor */
.crop-editor {
    background: #1a1a1a;
    padding: 20px;
    border-radius: 12px;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.8);
}

.close-crop {
    position: absolute;
    top: 10px;
    right: 15px;
    color: #666;
    font-size: 24px;
    cursor: pointer;
    z-index: 10;
}

.close-crop:hover {
    color: #999;
}

#croppieContainer {
    width: 600px;
    height: 450px;
}

.croppie-controls {
    height: 40px;
    width: 600px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.crop-controls {
    display: flex;
    gap: 20px;
    margin-top: 10px;
}

/* Batch Controls */
.batch-controls {
    display: flex;
    gap: 10px;
    margin-top: 5px;
}

.zip-download {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #333;
}

small {
    display: block;
    color: #666;
    font-size: 11px;
    margin-top: 5px;
    margin-bottom: 10px;
}

input[type="file"] {
    margin-bottom: 5px;
}

textarea {
    margin-bottom: 5px;
}

/* Carousel */
#carousel {
    /* Full-bleed section: spans entire viewport width from centered container */
    margin: 20px 0;
    padding: 12px 20px;
    background: transparent; /* remove gray background */
    border: none;
    border-radius: 0;
    width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    overflow: hidden; /* hide any horizontal overflow */
}

.carousel-container {
    display: flex;
    flex-wrap: nowrap; /* single line */
    gap: 6px; /* reduced by ~50% */
    margin-top: 10px;
    overflow-x: auto; /* horizontal scrolling inside strip */
    cursor: grab;
    user-select: none;
    /* Hide scrollbars cross-browser */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}
.carousel-container.dragging { cursor: grabbing; }
.carousel-container::-webkit-scrollbar { display: none; } /* WebKit */

/* Inner wrapper to align controls like the main container */
.carousel-inner {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Optional strip wrapper (full width), used for clarity */
.carousel-strip { width: 100%; }

.carousel-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0; /* no inner padding */
    background: transparent; /* transparent background */
    border: none; /* no card border */
    border-radius: 0;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    min-width: 360px; /* increased ~20% to fit larger image */
}

.carousel-item:hover { transform: translateY(-1px); }

.carousel-item img {
    width: 326px; /* +20% from 272px */
    height: 192px; /* +20% from 160px */
    object-fit: cover;
    border: none; /* remove border in gallery */
    border-radius: 4px;
}

.carousel-controls {
    display: flex; justify-content: flex-end; align-items: center; gap: 8px;
    margin-top: 12px;
}

/* Modal */
#modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    justify-content: center;
    align-items: center;
}

#modal img {
    max-width: 90vw;
    max-height: 80vh;
    object-fit: contain;
}

.modal-controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    align-items: center;
    background: rgba(0,0,0,0.7);
    padding: 10px 20px;
    border-radius: 25px;
}

.modal-controls button {
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.modal-controls button:hover:not(:disabled) {
    background: rgba(255,255,255,0.3);
}

.modal-controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.modal-controls span {
    color: white;
    font-size: 14px;
    margin: 0 10px;
}

input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #f5f5f5;
}

/* Button groups */
.button-group {
    display: flex;
    gap: 10px;
    align-items: center;
    margin: 10px 0;
}

/* Results fade-in animation */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

#result img {
    animation: fadeIn 0.3s ease-out;
}

.result-item {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.result-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.batch-item {
    animation: fadeIn 0.3s ease-out;
}

/* Log panel - simple fixed window */
.log-panel {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    background: #fff;
    border-top: 1px solid #eee;
    box-shadow: 0 -6px 24px rgba(0,0,0,0.04);
    z-index: 999;
}

#log {
    background: transparent;
    border: none;
    padding: 4px 10px 4px 20px;
    height: 54px; /* ~3 lines at 12px * 1.5 line-height */
    overflow-y: auto;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    margin: 8px 0 0 0;
    color: #aaa;
    line-height: 1.5;
    display: block;
}

.log-entry { margin: 2px 0; padding: 0; color: #aaa; }
.log-entry.active { color: #555; position: relative; }
.log-entry.active::before {
    content: '';
    position: absolute;
    left: -10px; top: 50%; transform: translateY(-50%);
    width: 6px; height: 6px; border-radius: 50%;
    background: #555; opacity: 0.4; animation: pulse 1.4s ease-in-out infinite;
}
.dots { opacity: 0.6; }

@keyframes pulse { 0%{ transform: translateY(-50%) scale(0.9); opacity: .2 } 50%{ transform: translateY(-50%) scale(1); opacity: .5 } 100%{ transform: translateY(-50%) scale(0.9); opacity: .2 } }
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
}

.modal img {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%,-50%);
    max-width: 90%;
    max-height: 90%;
}

.close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 30px;
    cursor: pointer;
}
