/* image.css - Corporate Brutalist UI */

.image-tool-app {
    display: flex;
    flex-direction: column;
    gap: 30px;
    margin: 20px 0;
    background: var(--bg-light);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 8px 30px rgba(0,0,0,0.04);
}

@media (min-width: 992px) {
    .image-tool-app {
        flex-direction: row;
        align-items: stretch;
        min-height: 600px;
    }
}

/* Left Panel: Preview */
.app-left {
    flex: 1 1 55%;
    background: var(--bg-alt);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    border-right: 1px solid var(--border);
}

.preview-container {
    flex-grow: 1;
    min-height: 300px;
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    background: repeating-conic-gradient(#f0f0f0 0% 25%, transparent 0% 50%) 50% / 20px 20px;
    background-color: #fff;
}

#previewImage {
    max-width: 100%;
    max-height: 60vh;
    object-fit: contain;
    display: none;
    transition: transform 0.2s ease-out;
}

.upload-placeholder {
    text-align: center;
    color: var(--text-muted);
}

.upload-placeholder h3 { margin-bottom: 5px; color: var(--text-main); }

.file-input-wrapper { display: flex; justify-content: center; }
.file-input-wrapper input[type="file"] { display: none; }

/* Right Panel: Controls */
.app-right {
    flex: 1 1 45%;
    display: flex;
    flex-direction: column;
    background: var(--bg-light);
}

/* Tabs */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    background: var(--bg-alt);
}

.tab-btn {
    flex: 1;
    padding: 16px 10px;
    background: transparent;
    border: none;
    border-right: 1px solid var(--border);
    font-family: inherit;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-muted);
    cursor: pointer;
    transition: 0.2s;
}

.tab-btn:last-child { border-right: none; }
.tab-btn:hover { color: var(--text-main); background: #eaeaea; }
.tab-btn.active { background: var(--bg-light); color: var(--primary); box-shadow: inset 0 3px 0 var(--primary); }

.tab-content-wrapper {
    flex-grow: 1;
    padding: 24px;
    max-height: 500px;
    overflow-y: auto;
}

.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.3s ease; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* Form Controls */
.panel-section { margin-bottom: 24px; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); margin-bottom: 12px; }

.input-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.button-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.input-group { display: flex; flex-direction: column; gap: 8px; }
.input-group label { font-size: 14px; font-weight: 500; color: var(--text-main); }

input[type="number"], select {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 14px;
    color: var(--text-main);
    background: var(--bg-light);
    transition: 0.2s;
}

input[type="number"]:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 82, 204, 0.1);
}

.checkbox-group { display: flex; align-items: center; gap: 8px; margin-top: 15px; font-size: 14px; font-weight: 500; }

/* Filter Sliders UI */
.filter-row { margin-bottom: 16px; }
.filter-header { display: flex; justify-content: space-between; margin-bottom: 6px; font-size: 13px; font-weight: 500; }
.filter-controls { display: flex; align-items: center; gap: 12px; }

input[type="range"] {
    flex-grow: 1;
    accent-color: var(--primary);
    height: 6px;
    background: var(--border);
    border-radius: 4px;
    outline: none;
    -webkit-appearance: none;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
}

.filter-number {
    width: 70px !important;
    padding: 6px !important;
    text-align: right;
}

/* Buttons */
.btn-primary, .btn-secondary, .btn-outline, .btn-success {
    display: inline-block;
    padding: 12px 20px;
    font-family: inherit;
    font-weight: 600;
    font-size: 14px;
    text-align: center;
    border-radius: var(--radius);
    cursor: pointer;
    transition: 0.2s;
    border: none;
}

.btn-primary { background: var(--primary); color: #fff; width: 100%; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-primary:disabled { background: var(--border); cursor: not-allowed; }

.btn-secondary { background: #1d1d1f; color: #fff; border: 1px solid #1d1d1f; }
.btn-secondary:hover { background: #333; }

.btn-outline { background: transparent; color: var(--text-main); border: 1px solid var(--border); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--bg-alt); }

.btn-success { background: #0b875b; color: #fff; width: 100%; text-decoration: none; margin-top: 10px; }
.btn-success:hover { background: #096a47; color: #fff;}

.btn-text { background: transparent; color: var(--text-muted); border: none; font-size: 13px; font-weight: 600; cursor: pointer; padding: 10px 0; width: 100%; text-align: left;}
.btn-text:hover { color: var(--primary); text-decoration: underline; }

/* Action Footer */
.action-footer {
    padding: 24px;
    background: var(--bg-alt);
    border-top: 1px solid var(--border);
}

.status-bar { margin-bottom: 15px; }
progress {
    width: 100%;
    height: 6px;
    border-radius: 4px;
    border: none;
    background: var(--border);
    margin-bottom: 5px;
}
progress::-webkit-progress-bar { background: var(--border); border-radius: 4px; }
progress::-webkit-progress-value { background: var(--primary); border-radius: 4px; }
#statusText { font-size: 13px; color: var(--text-muted); font-weight: 500; }