/* ============================================
   Shared Tool Layout & Components
   Used by all tool pages (QR, barcode, compressor, converter, etc.)
   ============================================ */

/* Two-column tool layout */
.generator-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    width: 100%;
    margin: 0 auto;
}

@media (max-width: 768px) {
    .generator-grid {
        grid-template-columns: 1fr;
    }
}

/* Form inputs */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
}

/* Range slider */
.slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: var(--border-color);
    border-radius: 3px;
    outline: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: #FF6B6B;
    cursor: pointer;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Preview area (right column) */
.preview-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-body);
    border-radius: 12px;
    padding: 30px;
    border: 2px dashed var(--border-color);
    overflow: hidden;
}

/* Drag & drop zone */
.drop-zone {
    background: var(--input-bg);
    border: 2px dashed var(--border-color);
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: #FF8E53;
    background: var(--bg-surface-hover);
}

.drop-zone-content {
    pointer-events: none;
}

.drop-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 12px;
}

.drop-zone p {
    margin: 0 0 8px;
    color: var(--text-muted);
    font-size: 1rem;
}

.drop-zone small {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.browse-link {
    color: #FF6B6B;
    font-weight: 600;
    cursor: pointer;
}

/* Size comparison bar */
.size-comparison {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--input-bg);
    border-radius: 12px;
    padding: 16px 20px;
    gap: 12px;
    position: relative;
    margin-top: 20px;
}

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

.size-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.size-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
}

.size-value.compressed {
    color: #38a169;
}

.size-arrow {
    font-size: 1.5rem;
    color: var(--border-color);
    transform: rotate(0deg);
}

.savings {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    padding: 8px 12px;
    border-radius: 8px;
}

.savings .size-label {
    color: rgba(255, 255, 255, 0.8);
}

.savings .size-value {
    color: white;
}

/* Placeholder text */
#placeholder-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--text-muted);
    z-index: 1;
    pointer-events: none;
    display: block;
}

.preview-placeholder {
    color: #a0aec0;
    font-size: 0.95rem;
}

/* Loading spinner */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

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

/* Loading state for size comparison */
.size-comparison.loading {
    opacity: 0.5;
    pointer-events: none;
}

.size-comparison.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #e2e8f0;
    border-top-color: #FF6B6B;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Status colors */
.text-success {
    color: #38a169;
}

.text-error {
    color: #e53e3e;
}

/* Responsive */
@media (max-width: 768px) {
    .size-comparison {
        flex-wrap: wrap;
        justify-content: center;
    }

    .size-arrow {
        transform: rotate(90deg);
    }
}
