@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700&display=swap');

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

body {
    font-family: 'Montserrat', sans-serif;
    background: #000;
    color: #fff;
    min-height: 100vh;
    padding: 2rem;
}

h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #FFC407;
}

h2 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #FFC407;
}

.subtitle {
    color: #888;
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

/* Upload Zone */
.upload-zone {
    border: 2px dashed #FFC407;
    border-radius: 12px;
    padding: 3rem;
    text-align: center;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    margin-bottom: 2rem;
}

.upload-zone:hover,
.upload-zone.dragover {
    background: rgba(255, 196, 7, 0.08);
    border-color: #fff;
}

.upload-zone p {
    font-size: 1.1rem;
    color: #ccc;
}

.upload-zone .icon {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    color: #FFC407;
}

/* Settings Bar */
.settings-bar {
    display: flex;
    gap: 2rem;
    align-items: center;
    background: #111;
    border: 1px solid #222;
    border-radius: 10px;
    padding: 1.2rem 1.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.setting-group {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.setting-group label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #888;
    font-weight: 600;
}

.setting-group input[type="range"] {
    accent-color: #FFC407;
    width: 180px;
}

.setting-group input[type="number"] {
    background: #000;
    border: 1px solid #333;
    color: #fff;
    font-family: 'Montserrat', sans-serif;
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    width: 100px;
    font-size: 0.9rem;
}

.setting-group input[type="number"]:focus {
    outline: none;
    border-color: #FFC407;
}

.setting-value {
    font-size: 0.85rem;
    color: #FFC407;
    font-weight: 600;
}

/* Buttons */
.btn {
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.7rem 1.5rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.btn-primary {
    background: #FFC407;
    color: #000;
}

.btn-primary:hover {
    background: #e6b006;
    transform: translateY(-1px);
}

.btn-primary:disabled {
    background: #555;
    color: #999;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: transparent;
    color: #FFC407;
    border: 1px solid #FFC407;
}

.btn-secondary:hover {
    background: rgba(255, 196, 7, 0.1);
}

.btn-danger {
    background: transparent;
    color: #ff4444;
    border: 1px solid #ff4444;
    font-size: 0.75rem;
    padding: 0.4rem 0.8rem;
}

.btn-danger:hover {
    background: rgba(255, 68, 68, 0.1);
}

/* File Pool */
.file-pool {
    background: #111;
    border: 1px solid #222;
    border-radius: 10px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    min-height: 100px;
}

.file-pool h3 {
    font-size: 0.85rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
}

.file-pool .thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
}

.thumb {
    width: 100px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #333;
    cursor: grab;
    position: relative;
    transition: border-color 0.2s;
}

.thumb:hover {
    border-color: #FFC407;
}

.thumb.dragging {
    opacity: 0.4;
}

.thumb img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
}

.thumb .name {
    background: rgba(0, 0, 0, 0.85);
    font-size: 0.7rem;
    padding: 4px 5px;
    word-break: break-all;
    line-height: 1.2;
}

/* GIF Groups */
.groups-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.gif-group {
    background: #111;
    border: 1px solid #222;
    border-radius: 10px;
    padding: 1.2rem;
    min-height: 160px;
    transition: border-color 0.2s;
}

.gif-group.dragover {
    border-color: #FFC407;
    background: rgba(255, 196, 7, 0.04);
}

.gif-group .group-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.8rem;
}

.gif-group .group-delay {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.8rem;
}

.gif-group .group-delay label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #666;
    font-weight: 600;
}

.gif-group .group-delay input {
    background: #000;
    border: 1px solid #333;
    color: #fff;
    font-family: 'Montserrat', sans-serif;
    padding: 0.3rem 0.5rem;
    border-radius: 6px;
    width: 80px;
    font-size: 0.8rem;
}

.gif-group .group-delay input:focus {
    outline: none;
    border-color: #FFC407;
}

.gif-group .group-header input {
    background: transparent;
    border: none;
    border-bottom: 1px solid #333;
    color: #FFC407;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    padding: 0.2rem 0;
    width: 60%;
}

.gif-group .group-header input:focus {
    outline: none;
    border-color: #FFC407;
}

.gif-group .frames {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    min-height: 80px;
    padding: 0.5rem;
    border: 1px dashed #333;
    border-radius: 8px;
}

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

.frame-delay-input {
    width: 70px;
    background: #000;
    border: 1px solid #333;
    color: #fff;
    font-family: 'Montserrat', sans-serif;
    font-size: 0.7rem;
    padding: 3px 5px;
    border-radius: 4px;
    text-align: center;
}

.frame-delay-input:focus {
    outline: none;
    border-color: #FFC407;
}

.gif-group .frames.empty::after {
    content: 'Drop frames here';
    color: #555;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.gif-group .frame-count {
    font-size: 0.75rem;
    color: #666;
}

/* Results */
.results-container {
    margin-top: 2rem;
}

.result-card {
    background: #111;
    border: 1px solid #222;
    border-radius: 10px;
    padding: 1.2rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.result-card img {
    width: 120px;
    height: 120px;
    object-fit: contain;
    border-radius: 8px;
    background: #1a1a1a;
}

.result-card .info {
    flex: 1;
}

.result-card .info h4 {
    color: #FFC407;
    margin-bottom: 0.3rem;
}

.result-card .info p {
    color: #888;
    font-size: 0.85rem;
}

.result-card .btn {
    flex-shrink: 0;
}

/* Actions Bar */
.actions-bar {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

/* Loading */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #333;
    border-top-color: #FFC407;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-right: 0.5rem;
    vertical-align: middle;
}

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

.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 768px) {
    body { padding: 1rem; }
    .settings-bar { flex-direction: column; gap: 1rem; }
    .groups-container { grid-template-columns: 1fr; }
}
