/* =============================================
   Image to PDF Tool v2
   Complete styles including target size inputs
   ============================================= */

/* ── Layout ── */
.tool-page__content { display: grid; grid-template-columns: 1fr 380px; gap: var(--space-6); align-items: start; }
.tool-right-col { display: flex; flex-direction: column; gap: var(--space-5); position: sticky; top: var(--space-4); }

/* ── Ads ── */
.tc-ad { border-radius: var(--radius-lg); overflow: hidden; }
.tc-ad__inner { display: flex; align-items: center; justify-content: center; background: var(--bg-tertiary); border: 1px dashed var(--gray-300); border-radius: var(--radius-lg); }
.tc-ad__label { font-size: 11px; font-weight: 500; color: var(--text-tertiary); letter-spacing: 0.3px; }
.tc-ad--horizontal .tc-ad__inner { min-height: 100px; padding: 12px; }
.tc-ad--full .tc-ad__inner { min-height: 120px; }
.tc-ad--sidebar .tc-ad__inner { min-height: 280px; flex-direction: column; gap: 8px; padding: 16px; }
.tc-ad__inner:has(ins.adsbygoogle) { border: none; background: transparent; }
.tc-ad__inner:has(ins.adsbygoogle) .tc-ad__label { display: none; }
.tc-result__ad { margin: var(--space-4) 0; min-height: 100px; max-height: 280px; overflow: hidden; border-radius: var(--radius-lg); }

/* ══════════════════════════════════════
   IMAGE GRID (upload area)
   ══════════════════════════════════════ */
.itp-grid-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
}
.itp-grid-header__title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}
.itp-grid-header__add {
    border: none;
    background: var(--primary-100);
    color: var(--primary-700);
    padding: 5px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s;
}
.itp-grid-header__add:hover { background: var(--primary-200); }

.itp-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 8px;
    padding: 0 16px;
    max-height: 320px;
    overflow-y: auto;
}

.itp-grid-hint {
    font-size: 11px;
    color: var(--text-tertiary);
    padding: 8px 16px 12px;
}

/* Image Item (draggable) */
.itp-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 2px solid var(--gray-200);
    cursor: grab;
    transition: all 0.2s;
    background: var(--bg-tertiary);
}
.itp-item:hover {
    border-color: var(--primary-400);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.itp-item.dragging {
    opacity: 0.4;
    border-color: var(--primary-500);
}
.itp-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.itp-item__remove {
    position: absolute;
    top: 3px;
    right: 3px;
    width: 20px;
    height: 20px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    line-height: 1;
    opacity: 0;
    transition: opacity 0.15s;
}
.itp-item:hover .itp-item__remove { opacity: 1; }
.itp-item__num {
    position: absolute;
    bottom: 3px;
    left: 3px;
    background: rgba(0, 0, 0, 0.75);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 4px;
}

/* ── File Count ── */
.itp-file-count {
    display: flex;
    align-items: center;
    padding: 8px 14px;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--gray-100);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

/* ── Orientation Toggle ── */
.itp-orient-group {
    display: flex;
    gap: 6px;
}
.itp-orient {
    flex: 1;
    padding: 8px 6px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    background: var(--bg-tertiary);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.15s;
    color: var(--text-secondary);
}
.itp-orient:hover {
    background: var(--gray-100);
    color: var(--text-primary);
}
.itp-orient.active {
    background: var(--primary-100);
    border-color: var(--primary-500);
    color: var(--primary-700);
}

/* ── Select ── */
.itp-select {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: border-color 0.2s;
    cursor: pointer;
}
.itp-select:focus {
    outline: none;
    border-color: var(--primary-400);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

/* ── Overlay ── */
.itp-overlay {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.8); backdrop-filter: blur(4px);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    border-radius: var(--radius-lg); z-index: 10; gap: 12px;
}
.itp-overlay.hidden { display: none; }
.itp-overlay__text { color: #fff; font-size: var(--text-sm); font-weight: 500; }
.itp-spinner {
    width: 44px; height: 44px;
    border: 4px solid rgba(255, 255, 255, 0.25); border-top-color: #fff;
    border-radius: 50%; animation: itp-spin 0.8s linear infinite;
}
@keyframes itp-spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════
   SIZE DISPLAY
   ══════════════════════════════════════ */
.tc-sizes {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}
.tc-sizes__box {
    flex: 1;
    text-align: center;
    padding: var(--space-3);
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-100);
}
.tc-sizes__box--output {
    background: var(--primary-50);
    border-color: var(--primary-200);
}
.tc-sizes__label {
    font-size: 10px;
    font-weight: 700;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}
.tc-sizes__value {
    font-size: var(--text-lg);
    font-weight: 700;
    color: var(--text-primary);
}
.tc-sizes__box--output .tc-sizes__value {
    color: var(--primary-700);
}
.tc-sizes__arrow {
    font-size: var(--text-xl);
    color: var(--text-tertiary);
    flex-shrink: 0;
}

/* ══════════════════════════════════════
   TARGET SIZE INPUTS
   ══════════════════════════════════════ */
.tc-target {
    display: flex;
    gap: 8px;
}
.tc-target__field {
    flex: 1;
    display: flex;
    border: 1.5px solid var(--gray-200);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: border-color 0.2s;
}
.tc-target__field:focus-within {
    border-color: var(--primary-400);
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}
.tc-target__input {
    flex: 1;
    border: none;
    padding: 10px 12px;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    background: var(--bg-primary);
    color: var(--text-primary);
    outline: none;
    min-width: 0;
}
.tc-target__input::placeholder {
    font-weight: 400;
    color: var(--text-tertiary);
}
.tc-target__unit {
    padding: 10px 14px;
    font-size: 12px;
    font-weight: 700;
    border: none;
    border-left: 1.5px solid var(--gray-200);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
}
.tc-target__unit.active {
    background: var(--primary-100);
    color: var(--primary-700);
}
.tc-hint {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-top: 6px;
}

/* ══════════════════════════════════════
   SHARED: Breadcrumb, Header, Actions, Note, Result, FAQ
   ══════════════════════════════════════ */
.tc-breadcrumb { font-size: var(--text-xs); color: var(--text-tertiary); margin-bottom: var(--space-4); }
.tc-breadcrumb a { color: var(--text-tertiary); text-decoration: none; }
.tc-breadcrumb a:hover { color: var(--primary-600); }
.tc-breadcrumb span { margin: 0 var(--space-1); }
.tc-breadcrumb span:last-child { color: var(--text-primary); font-weight: 500; }

.tc-header { display: flex; align-items: flex-start; gap: var(--space-4); margin-bottom: var(--space-6); }
.tc-header__icon { font-size: 36px; flex-shrink: 0; margin-top: 2px; }
.tc-header__title { font-size: var(--text-2xl); font-weight: 700; margin: 0 0 var(--space-1); }
.tc-header__desc { font-size: var(--text-sm); color: var(--text-secondary); margin: 0; line-height: 1.5; }

.tc-actions { padding: 12px; display: flex; gap: 8px; background: var(--bg-secondary); border-top: 1px solid var(--gray-100); }
.tc-actions .btn { flex: 1; font-size: 12px; }

.tc-note { margin-top: var(--space-4); padding: 10px 14px; background: var(--bg-tertiary); border-radius: var(--radius-md); font-size: 12px; color: var(--text-tertiary); line-height: 1.5; }

/* Result */
.tc-result { max-width: 480px; margin: 0 auto; padding: var(--space-6); }
.tc-result__header { text-align: center; margin-bottom: var(--space-6); }
.tc-result__icon { font-size: 52px; margin-bottom: var(--space-2); }
.tc-result__title { font-size: var(--text-xl); font-weight: 700; color: var(--success); margin: 0 0 var(--space-2); }
.tc-result__meta { font-size: var(--text-sm); color: var(--text-secondary); margin: 0; }
.tc-result__file { display: flex; align-items: center; gap: 12px; padding: var(--space-4); background: var(--bg-tertiary); border-radius: var(--radius-lg); margin-bottom: var(--space-4); border: 1px solid var(--gray-100); }
.tc-result__file-icon { font-size: 32px; flex-shrink: 0; }
.tc-result__filename { font-weight: 600; font-size: 14px; word-break: break-all; }
.tc-result__filesize { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.tc-result__rename { margin-bottom: var(--space-4); }
.tc-result__rename label { font-size: 12px; font-weight: 600; color: var(--text-secondary); display: block; margin-bottom: 6px; }
.tc-result__rename input { width: 100%; padding: 10px 12px; border: 1.5px solid var(--gray-200); border-radius: var(--radius-md); font-size: 14px; background: var(--bg-primary); box-sizing: border-box; transition: border-color 0.2s; }
.tc-result__rename input:focus { outline: none; border-color: var(--primary-400); box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1); }
.tc-result__actions { display: flex; gap: 10px; margin-bottom: var(--space-4); }
.tc-result__actions .btn { flex: 1; text-align: center; }

/* Related */
.tc-related { padding-top: var(--space-4); border-top: 1px solid var(--gray-100); }
.tc-related__title { font-size: 11px; font-weight: 700; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: var(--space-3); }
.tc-related__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tc-related__grid a { display: block; padding: 10px; background: var(--bg-tertiary); border-radius: var(--radius-md); font-size: 13px; font-weight: 500; color: var(--text-secondary); text-decoration: none; text-align: center; transition: all 0.15s; border: 1px solid transparent; }
.tc-related__grid a:hover { background: var(--primary-50); color: var(--primary-700); border-color: var(--primary-200); }

/* FAQ */
.tc-faq { display: flex; flex-direction: column; gap: var(--space-3); }
.tc-faq details { background: var(--bg-secondary); border-radius: var(--radius-lg); border: 1px solid var(--gray-100); padding: var(--space-4); }
.tc-faq details[open] { border-color: var(--primary-200); }
.tc-faq summary { font-weight: 500; cursor: pointer; font-size: var(--text-sm); }
.tc-faq p { margin-top: var(--space-3); font-size: var(--text-sm); color: var(--text-secondary); line-height: 1.6; }

/* ── Responsive ── */
@media (max-width: 768px) {
    .tool-page__content { grid-template-columns: 1fr; }
    .tool-right-col { position: static; }
    .tc-header { gap: var(--space-3); }
    .tc-header__icon { font-size: 28px; }
    .tc-header__title { font-size: var(--text-xl); }
    .itp-grid { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); }
    .itp-orient { font-size: 10px; padding: 7px 4px; }
    .tc-result { padding: var(--space-4); }
    .tc-related__grid { grid-template-columns: 1fr; }
    .tc-ad--sidebar .tc-ad__inner { min-height: 100px; }
    .tc-ad--horizontal .tc-ad__inner { min-height: 80px; }
}