/**
 * ═══════════════════════════════════════════════════════════════
 * AK PRINT SEVA — Tedhi Medhi Pro Studio Styling
 * tools/tedhi-medhi-print/style.css
 * Compact Zero-Scroll Grid, Collapsing Animated Header & Bulk Queue
 * ═══════════════════════════════════════════════════════════════
 */

/* ═══════════ ANIMATED COLLAPSIBLE HERO ═══════════ */
.tm-hero-wrapper {
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.tm-collapsible-hero {
    max-height: 280px;
    opacity: 1;
    overflow: hidden;
    transform: translateY(0);
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.28s ease,
                margin 0.35s ease,
                padding 0.35s ease,
                transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 16px;
    padding: 8px 16px;
}

.tm-hero-wrapper.collapsed .tm-collapsible-hero {
    max-height: 0;
    opacity: 0;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
    transform: translateY(-20px);
    pointer-events: none;
}

.tm-hero-wrapper.collapsed .tool-breadcrumb {
    margin-bottom: 8px;
    font-size: 12px;
}

/* ═══════════ COMPACT PRO STUDIO GRID ═══════════ */
.tm-studio-grid {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 16px;
    align-items: start;
}

@media (max-width: 1024px) {
    .tm-studio-grid {
        grid-template-columns: 1fr;
    }
}

/* ═══════════ COMPACT CARDS & HEADINGS ═══════════ */
.tm-compact-card {
    padding: 14px 16px;
    margin-bottom: 12px;
}

.tm-card-title-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    position: relative;
}

.tm-step-badge {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    background: var(--gradient-primary);
    color: #FFFFFF;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 11px;
    box-shadow: 0 2px 6px rgba(255, 107, 0, 0.25);
    flex-shrink: 0;
}

.tm-card-heading {
    font-family: var(--font-heading);
    font-size: 13px;
    font-weight: 800;
    color: var(--text-primary);
    flex: 1;
}

.tm-count-tag {
    background: rgba(255, 107, 0, 0.12);
    color: var(--brand-orange);
    font-size: 11px;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 99px;
}

/* ═══════════ ULTRA-COMPACT DROPZONE ═══════════ */
.tm-compact-dropzone {
    border: 1.5px dashed rgba(255, 107, 0, 0.4);
    background: rgba(255, 107, 0, 0.025);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tm-compact-dropzone:hover,
.tm-compact-dropzone.dragover {
    border-color: var(--brand-orange);
    background: rgba(255, 107, 0, 0.08);
    transform: translateY(-1px);
}

.tm-dropzone-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.tm-dropzone-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tm-dropzone-text {
    font-size: 12px;
    color: var(--text-secondary);
}

.tm-dropzone-text b {
    color: var(--brand-orange);
}

.hidden-input {
    display: none;
}

/* ═══════════ THUMBNAIL FILMSTRIP QUEUE ═══════════ */
.tm-queue-box {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--border-color);
}

.tm-queue-strip {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    padding: 4px 2px 8px 2px;
    scroll-behavior: smooth;
}

.tm-queue-strip::-webkit-scrollbar {
    height: 4px;
}

.tm-queue-strip::-webkit-scrollbar-thumb {
    background: rgba(255, 107, 0, 0.3);
    border-radius: 4px;
}

.tm-thumb-item {
    position: relative;
    width: 52px;
    height: 52px;
    border-radius: 6px;
    border: 2px solid var(--border-color);
    overflow: hidden;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s ease;
    background: var(--bg-surface-raised);
}

.tm-thumb-item:hover {
    transform: scale(1.05);
    border-color: var(--brand-orange);
}

.tm-thumb-item.active {
    border-color: var(--brand-orange);
    box-shadow: 0 0 0 2px rgba(255, 107, 0, 0.35);
}

.tm-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.tm-thumb-badge {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10B981;
    border: 1px solid #FFF;
}

.tm-thumb-badge.processing {
    background: #F59E0B;
}

.tm-thumb-del {
    position: absolute;
    top: 1px;
    right: 1px;
    width: 16px;
    height: 16px;
    background: rgba(0, 0, 0, 0.7);
    color: #FFF;
    border-radius: 50%;
    border: none;
    font-size: 10px;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.tm-thumb-item:hover .tm-thumb-del {
    display: flex;
}

.tm-queue-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 4px;
}

.tm-btn-micro {
    background: none;
    border: none;
    font-size: 11px;
    font-weight: 700;
    color: #EF4444;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 4px;
}

.tm-btn-micro:hover {
    text-decoration: underline;
}

.tm-queue-hint {
    font-size: 11px;
    color: var(--text-muted);
}

/* ═══════════ COMPACT PRESETS & ROTATION ═══════════ */
.tm-presets-compact {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin-bottom: 10px;
}

.tm-preset-btn {
    background: var(--bg-surface-raised);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 4px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.tm-preset-btn:hover {
    border-color: var(--brand-orange);
    color: var(--brand-orange);
}

.tm-preset-btn.active {
    background: rgba(255, 107, 0, 0.12);
    border-color: var(--brand-orange);
    color: var(--brand-orange);
}

.tm-rot-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.tm-btn-compact {
    padding: 6px 8px;
    font-size: 12px;
    width: 100%;
}

/* ═══════════ BORDER & SETTINGS INLINE ═══════════ */
.tm-toggle-wrap {
    margin-bottom: 10px;
}

.tm-toggle-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-surface-raised);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    cursor: pointer;
    user-select: none;
    position: relative;
}

.tm-toggle-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.tm-label-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-primary);
}

.tm-label-sub {
    font-size: 10px;
    color: var(--text-muted);
}

.tm-switch-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.tm-switch-slider {
    position: relative;
    width: 38px;
    height: 20px;
    background-color: #CBD5E1;
    border-radius: 20px;
    transition: 0.25s ease;
    flex-shrink: 0;
}

[data-theme="dark"] .tm-switch-slider {
    background-color: #334155;
}

.tm-switch-slider:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: 0.25s ease;
}

.tm-switch-input:checked + .tm-switch-slider {
    background-color: var(--brand-orange);
}

.tm-switch-input:checked + .tm-switch-slider:before {
    transform: translateX(18px);
}

.tm-setting-inline {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.tm-mini-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    width: 50px;
    flex-shrink: 0;
}

.tm-radio-group {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
}

.tm-radio-item {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-surface-raised);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 4px 6px;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    cursor: pointer;
    text-align: center;
}

.tm-radio-item input {
    display: none;
}

.tm-radio-item:has(input:checked) {
    border-color: var(--brand-orange);
    background: rgba(255, 107, 0, 0.08);
    color: var(--brand-orange);
}

.tm-select-compact {
    padding: 6px 10px;
    font-size: 12px;
    flex: 1;
}

/* ═══════════ DUAL PRINT ACTIONS ═══════════ */
.tm-actions-grid {
    margin-top: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tm-action-btn {
    width: 100%;
    padding: 11px 16px;
    font-size: 14px;
    font-weight: 800;
    box-shadow: 0 4px 14px rgba(255, 107, 0, 0.3);
}

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

.tm-sub-btn {
    padding: 8px 10px;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.tm-status-box {
    margin-top: 8px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    background: rgba(255, 107, 0, 0.08);
    border: 1px solid rgba(255, 107, 0, 0.25);
    color: var(--brand-orange);
}

/* ═══════════ RIGHT COLUMN: LARGE VIEWPORT STAGE ═══════════ */
.tm-viewport-card {
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 170px);
    min-height: 480px;
    max-height: 640px;
    box-sizing: border-box;
}

@media (max-width: 1024px) {
    .tm-viewport-card {
        height: auto;
        min-height: 420px;
        max-height: none;
    }
}

.tm-viewport-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.tm-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tm-preview-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 107, 0, 0.12);
    color: var(--brand-orange);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 800;
}

.tm-active-filename {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-primary);
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tm-header-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

.tm-tag-badge {
    background: rgba(255, 107, 0, 0.1);
    border: 1px solid rgba(255, 107, 0, 0.25);
    color: var(--brand-orange);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
}

.tm-tag-success {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.25);
    color: #059669;
}

[data-theme="dark"] .tm-tag-success {
    color: #34D399;
}

.tm-viewport-stage {
    flex: 1;
    background: #090E17;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    padding: 12px;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.35);
}

[data-theme="light"] .tm-viewport-stage {
    background: #E8EEF5;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.05);
}

.tm-empty-stage {
    text-align: center;
    color: var(--text-muted);
    max-width: 300px;
    padding: 16px;
}

.tm-empty-icon {
    margin-bottom: 8px;
}

.tm-empty-title {
    font-size: 15px;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.tm-empty-desc {
    font-size: 12px;
    line-height: 1.4;
    color: var(--text-muted);
}

#tmCanvas {
    max-width: 100%;
    max-height: 100%;
    border-radius: 4px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
    background: #FFFFFF;
    transition: all 0.2s ease;
}

/* Nav arrows inside stage */
.tm-stage-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(15, 39, 68, 0.7);
    color: #FFFFFF;
    border: 1.5px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(4px);
}

.tm-stage-nav:hover {
    background: var(--brand-orange);
    border-color: var(--brand-orange);
    transform: translateY(-50%) scale(1.1);
}

.tm-nav-prev {
    left: 12px;
}

.tm-nav-next {
    right: 12px;
}

.tm-viewport-footer {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 600;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
}

.tm-viewport-footer span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* ═══════════ ADJUST CORNERS BUTTON ═══════════ */
.tm-btn-adjust {
    background: rgba(255, 107, 0, 0.12);
    border: 1px solid rgba(255, 107, 0, 0.3);
    color: var(--brand-orange);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.tm-btn-adjust:hover {
    background: var(--brand-orange);
    color: #FFFFFF;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(255, 107, 0, 0.35);
}

/* ═══════════ ADOBE SCAN-GRADE 4-CORNER MODAL ═══════════ */
.tm-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(5, 11, 20, 0.85);
    backdrop-filter: blur(8px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}

.tm-modal-box {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 860px;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
    overflow: hidden;
    animation: tmModalPop 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes tmModalPop {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.tm-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-surface-raised);
}

.tm-modal-title {
    font-size: 14px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
}

.tm-modal-close {
    background: none;
    border: none;
    font-size: 16px;
    font-weight: 800;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}

.tm-modal-close:hover {
    color: #EF4444;
}

.tm-modal-body {
    padding: 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    overflow: hidden;
    background: #090E17;
    position: relative;
}

.tm-canvas-container {
    position: relative;
    max-width: 100%;
    max-height: 56vh;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    touch-action: none;
}

#tmEditorCanvas {
    max-width: 100%;
    max-height: 56vh;
    border-radius: 4px;
    cursor: crosshair;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    display: block;
}

/* ═══════════ PINPOINT MAGNIFIER LOUPE ═══════════ */
.tm-loupe-lens {
    position: absolute;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 3px solid var(--brand-orange);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.75), inset 0 0 0 1px rgba(255, 255, 255, 0.3);
    overflow: hidden;
    pointer-events: none;
    z-index: 100;
    background: #000;
    transform: translate(-50%, -100%) translateY(-20px);
    transition: opacity 0.15s ease;
}

#tmLoupeCanvas {
    width: 100%;
    height: 100%;
    display: block;
}

.tm-loupe-crosshair {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.tm-loupe-crosshair::before,
.tm-loupe-crosshair::after {
    content: "";
    position: absolute;
    background: #EF4444;
}

.tm-loupe-crosshair::before {
    top: 50%;
    left: 0;
    width: 100%;
    height: 2px;
    transform: translateY(-50%);
}

.tm-loupe-crosshair::after {
    left: 50%;
    top: 0;
    width: 2px;
    height: 100%;
    transform: translateX(-50%);
}

.tm-modal-hint {
    margin-top: 10px;
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.tm-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 18px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-surface-raised);
}

.tm-footer-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tm-footer-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tm-chip-btn {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.tm-chip-btn:hover {
    border-color: var(--brand-orange);
    color: var(--brand-orange);
    transform: translateY(-1px);
}
