:root {
    --panel-border: #d8dee8;
    --ink: #141b2d;
    --muted: #667085;
    --surface: #ffffff;
    --soft: #f5f7fb;
    --blue: #2563eb;
    --blue-dark: #1d4ed8;
    --green: #0f8a4b;
    --red: #c4312b;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
    --shadow-md: 0 14px 34px rgba(16, 24, 40, 0.12);
}

html,
body {
    min-height: 100%;
    margin: 0;
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    color: var(--ink);
    background: #e9eef5;
}

button,
input,
select {
    letter-spacing: 0;
}

.btn {
    border-radius: 7px;
    font-weight: 650;
}

.btn:disabled,
.btn.disabled {
    opacity: 0.48;
}

.app-root {
    height: 100vh;
    display: grid;
    grid-template-columns: minmax(340px, 25vw) 1fr;
    overflow: hidden;
}

.left-panel {
    min-width: 0;
    padding: 18px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border-right: 1px solid var(--panel-border);
    overflow-y: auto;
}

.right-panel {
    min-width: 0;
    padding: 18px;
    overflow: hidden;
}

.panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.app-title {
    margin: 0;
    font-size: 1.4rem;
    line-height: 1.15;
    font-weight: 800;
}

.privacy-badge {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    padding: 5px 9px;
    border: 1px solid #b8c7dc;
    border-radius: 999px;
    color: #31517a;
    background: #eef5ff;
    font-size: 0.75rem;
    font-weight: 700;
}

.upload-zone {
    min-height: 152px;
    display: grid;
    place-items: center;
    gap: 7px;
    padding: 18px;
    border: 1.5px dashed #8ca0bd;
    border-radius: 8px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(246, 249, 253, 0.94)),
        radial-gradient(circle at 50% 0%, rgba(37, 99, 235, 0.13), transparent 58%);
    text-align: center;
    cursor: pointer;
    transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.upload-zone:hover {
    border-color: var(--blue);
    box-shadow: 0 10px 26px rgba(37, 99, 235, 0.12);
    transform: translateY(-1px);
}

.upload-plus {
    width: 56px;
    height: 56px;
    display: inline-grid;
    place-items: center;
    border-radius: 50%;
    background: var(--blue);
    color: white;
    font-size: 2.05rem;
    line-height: 1;
    box-shadow: 0 10px 22px rgba(37, 99, 235, 0.26);
}

.upload-title {
    font-weight: 800;
}

.upload-subtitle {
    max-width: 260px;
    color: var(--muted);
    font-size: 0.82rem;
}

.process-all-button {
    min-height: 42px;
    color: #fff;
    background: #1f2937;
    border-color: #1f2937;
    box-shadow: var(--shadow-sm);
}

.process-all-button:hover:not(:disabled) {
    color: #fff;
    background: #111827;
    border-color: #111827;
}

.image-list {
    display: grid;
    gap: 14px;
    margin-top: 16px;
    padding-bottom: 24px;
}

.empty-state {
    padding: 24px;
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    color: var(--muted);
    background: #ffffff;
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.image-card {
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    box-shadow: var(--shadow-sm);
    transition: transform 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
}

.image-card:hover {
    border-color: #c4cfdd;
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.image-card-body {
    padding: 14px;
}

.preview-frame {
    position: relative;
    height: 176px;
    overflow: hidden;
    background-color: #f5f6f8;
    background-image:
        linear-gradient(45deg, #e0e5ec 25%, transparent 25%),
        linear-gradient(-45deg, #e0e5ec 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #e0e5ec 75%),
        linear-gradient(-45deg, transparent 75%, #e0e5ec 75%);
    background-size: 24px 24px;
    background-position: 0 0, 0 12px, 12px -12px, -12px 0;
}

.preview-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.preview-original,
.preview-processed {
    position: absolute;
    inset: 0;
    transition: clip-path 650ms ease, opacity 650ms ease;
}

.preview-original {
    clip-path: inset(0 50% 0 0);
}

.preview-processed {
    clip-path: inset(0 0 0 50%);
}

.image-card:hover .preview-original {
    clip-path: inset(0 100% 0 0);
}

.image-card:hover .preview-processed {
    clip-path: inset(0 0 0 0);
}

.preview-label {
    position: absolute;
    right: 10px;
    bottom: 10px;
    padding: 4px 8px;
    border-radius: 999px;
    color: #344054;
    background: rgba(255, 255, 255, 0.86);
    border: 1px solid rgba(152, 162, 179, 0.35);
    font-size: 0.72rem;
    font-weight: 750;
    backdrop-filter: blur(6px);
}

.file-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.file-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.92rem;
    font-weight: 760;
}

.file-meta {
    margin-top: 2px;
    color: var(--muted);
    font-size: 0.8rem;
}

.status-block {
    margin-top: 13px;
}

.status-text {
    color: #344054;
    font-weight: 650;
}

.status-percent {
    color: var(--blue);
    font-weight: 750;
}

.image-progress {
    height: 8px;
    background: #e8edf3;
    border-radius: 999px;
}

.image-progress .progress-bar {
    background: linear-gradient(90deg, var(--blue), #38bdf8);
}

.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    flex: 0 0 auto;
    padding: 5px 8px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 800;
    line-height: 1;
}

.status-pill .spinner-border {
    width: 0.75rem;
    height: 0.75rem;
    border-width: 0.12em;
}

.status-success {
    color: #0f6b3f;
    background: #e7f8ee;
}

.status-danger {
    color: #a4231f;
    background: #fee8e6;
}

.status-active {
    color: #174ea6;
    background: #eaf2ff;
}

.status-muted {
    color: #526071;
    background: #edf1f6;
}

.action-stack {
    display: grid;
    gap: 9px;
    margin-top: 14px;
}

.primary-action {
    min-height: 38px;
    color: #fff;
    background: var(--blue);
    border-color: var(--blue);
}

.primary-action:hover:not(:disabled) {
    color: #fff;
    background: var(--blue-dark);
    border-color: var(--blue-dark);
}

.secondary-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.btn-soft {
    color: #344054;
    background: #f6f8fb;
    border: 1px solid #d4dce8;
}

.btn-soft:hover:not(:disabled) {
    background: #edf2f8;
    border-color: #c2cede;
}

.btn-soft-accent {
    color: #174ea6;
    background: #eef5ff;
    border: 1px solid #bdd4ff;
}

.btn-soft-accent:hover:not(:disabled) {
    color: #123f86;
    background: #e0edff;
    border-color: #93bbff;
}

.btn-soft-success {
    color: #0f6b3f;
    background: #f0fbf5;
    border: 1px solid #b9e7cd;
}

.btn-soft-success:hover:not(:disabled) {
    color: #0a5f37;
    background: #e1f7ea;
    border-color: #91dcb3;
}

.studio-shell {
    height: calc(100vh - 36px);
    display: grid;
    grid-template-rows: auto 1fr;
    gap: 14px;
    min-width: 0;
}

.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 10px;
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: var(--shadow-sm);
}

.tool-groups {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
    min-width: 0;
}

.tool-group {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px;
    border: 1px solid #d7dee8;
    border-radius: 8px;
    background: #f7f9fc;
}

.tool-button {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 36px;
    padding: 7px 10px;
    color: #344054;
    background: transparent;
    border: 1px solid transparent;
    font-size: 0.85rem;
}

.tool-button:hover {
    color: #182235;
    background: #fff;
    border-color: #d4dce8;
}

.tool-button.active {
    color: #fff;
    background: var(--blue);
    border-color: var(--blue);
}

.tool-button.danger {
    color: #a4231f;
}

.tool-button.danger:hover {
    color: #8c1d18;
    background: #fff5f4;
    border-color: #fecdc9;
}

.tool-symbol {
    width: 18px;
    display: inline-grid;
    place-items: center;
    font-weight: 900;
}

.export-button {
    min-height: 40px;
    padding-inline: 14px;
    color: #fff;
    background: var(--green);
    border-color: var(--green);
    box-shadow: 0 8px 18px rgba(15, 138, 75, 0.2);
}

.export-button:hover {
    color: #fff;
    background: #0b6f3c;
    border-color: #0b6f3c;
}

.export-options {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}

.export-options label {
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 650;
}

.bg-mode-select {
    width: 132px;
}

.canvas-viewport {
    min-height: 0;
    display: grid;
    place-items: center;
    overflow: auto;
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0)),
        #dfe5ec;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.studio-canvas {
    width: min(1500px, calc(100vw - 440px), calc(100vh - 128px));
    height: min(1500px, calc(100vw - 440px), calc(100vh - 128px));
    max-width: 100%;
    max-height: 100%;
    aspect-ratio: 1 / 1;
    box-shadow: 0 18px 46px rgba(16, 24, 40, 0.2);
    background: #fff;
}

.min-w-0 {
    min-width: 0;
}

#blazor-error-ui {
    background: #fff4cf;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem auto;
}

.loading-progress circle {
    fill: none;
    stroke: #e0e0e0;
    stroke-width: 0.6rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: #0d6efd;
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: 700;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

.loading-progress-text::after {
    content: var(--blazor-load-percentage-text, "Yukleniyor");
}

@media (max-width: 1180px) {
    .toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .export-options {
        justify-content: flex-end;
    }
}

@media (max-width: 992px) {
    .app-root {
        height: auto;
        min-height: 100vh;
        grid-template-columns: 1fr;
        overflow: visible;
    }

    .left-panel {
        border-right: 0;
        border-bottom: 1px solid var(--panel-border);
        overflow: visible;
    }

    .right-panel {
        overflow: visible;
    }

    .studio-shell {
        height: auto;
    }

    .canvas-viewport {
        min-height: 72vw;
    }

    .studio-canvas {
        width: min(1500px, calc(100vw - 38px));
        height: min(1500px, calc(100vw - 38px));
    }
}

@media (max-width: 560px) {
    .secondary-actions {
        grid-template-columns: 1fr;
    }

    .tool-button {
        flex: 1 1 auto;
        justify-content: center;
    }

    .tool-group,
    .tool-groups {
        width: 100%;
    }

    .export-button {
        width: 100%;
    }

    .export-options {
        align-items: stretch;
        flex-direction: column;
    }

    .bg-mode-select {
        width: 100%;
    }
}
