/* ========================================================= */
/* Image to PDF Converter – Scoped Styles */
/* ========================================================= */

.tool-image-to-pdf {
    --ip-primary: var(--accent);
    --ip-primary-dark: var(--accent-dark);
    --ip-text: var(--text-main);
    --ip-text-muted: var(--text-muted);
    --ip-card-bg: var(--card);
    --ip-border: rgba(148, 163, 184, 0.3);
    --ip-border-hover: rgba(148, 163, 184, 0.5);
    --ip-success: #22c55e;
    --ip-error: #ef4444;
    --ip-warning: #f59e0b;
    --ip-radius: 16px;
    --ip-radius-sm: 12px;
    --ip-shadow: var(--shadow-small);
    --ip-shadow-hover: var(--shadow-soft);
}

/* Main Container */
.ip-main {
    padding-bottom: 40px;
}

/* Breadcrumbs */
.ip-breadcrumbs {
    padding: 16px 0;
    font-size: 0.88rem;
    color: var(--ip-text-muted);
}

.ip-breadcrumbs nav {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.ip-breadcrumbs a {
    color: var(--ip-text-muted);
    text-decoration: none;
    transition: color 0.2s;
}

.ip-breadcrumbs a:hover {
    color: var(--ip-text);
}

/* Hero */
.ip-hero {
    padding: 40px 0 32px;
    text-align: center;
}

.ip-hero h1 {
    margin: 0 0 12px;
    font-size: clamp(2rem, 3vw, 2.6rem);
    font-weight: 800;
    letter-spacing: -0.04em;
    color: var(--ip-text);
}

.ip-subtitle {
    margin: 0 0 12px;
    font-size: 1.05rem;
    color: var(--ip-text-muted);
    max-width: 600px;
    margin-inline: auto;
}

.ip-trust {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.88rem;
    color: var(--ip-text-muted);
    background: rgba(255, 255, 255, 0.9);
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid var(--ip-border);
}

.ip-trust svg {
    opacity: 0.7;
}

/* Tool Section */
.ip-tool-section {
    padding: 20px 0 40px;
}

/* Layout */
.ip-layout {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 24px;
    margin-bottom: 20px;
}

/* Card */
.ip-card {
    background: var(--ip-card-bg);
    border-radius: var(--ip-radius);
    border: 1px solid var(--ip-border);
    box-shadow: var(--ip-shadow);
    padding: 24px;
    position: relative;
}

.ip-card h3 {
    margin: 0 0 20px;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--ip-text);
}

.ip-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.ip-card-header h3 {
    margin: 0;
}

/* Upload Card - Dropzone */
.ip-dropzone {
    border: 2px dashed var(--ip-border);
    border-radius: var(--ip-radius-sm);
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    outline: none;
}

.ip-dropzone:hover,
.ip-dropzone:focus {
    border-color: var(--ip-primary);
    background: rgba(34, 197, 94, 0.03);
    transform: translateY(-2px);
}

.ip-dropzone.drag-over {
    border-color: var(--ip-primary);
    background: rgba(34, 197, 94, 0.08);
    transform: scale(1.01);
}

.ip-dropzone.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.ip-dropzone-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    stroke: var(--ip-primary);
    opacity: 0.8;
}

.ip-dropzone-title {
    margin: 0 0 6px;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--ip-text);
}

.ip-dropzone-subtitle {
    margin: 0 0 12px;
    font-size: 0.92rem;
    color: var(--ip-text-muted);
}

.ip-dropzone-formats {
    margin: 0;
    font-size: 0.84rem;
    color: var(--ip-text-muted);
    opacity: 0.8;
}

/* Preview Card */
.ip-preview-card {
    margin-top: 20px;
}

.ip-preview-list {
    display: grid;
    gap: 12px;
    max-height: 500px;
    overflow-y: auto;
    padding-right: 4px;
}

.ip-preview-list::-webkit-scrollbar {
    width: 6px;
}

.ip-preview-list::-webkit-scrollbar-track {
    background: rgba(148, 163, 184, 0.1);
    border-radius: 3px;
}

.ip-preview-list::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.3);
    border-radius: 3px;
}

.ip-preview-list::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.5);
}

/* Preview Item */
.ip-preview-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: var(--ip-radius-sm);
    border: 1px solid var(--ip-border);
    cursor: grab;
    transition: all 0.2s;
}

.ip-preview-item:hover {
    border-color: var(--ip-border-hover);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

.ip-preview-item.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.ip-preview-item.drag-over {
    border-color: var(--ip-primary);
    background: rgba(34, 197, 94, 0.05);
}

.ip-drag-handle {
    display: flex;
    flex-direction: column;
    gap: 3px;
    cursor: grab;
    padding: 4px;
    opacity: 0.4;
    transition: opacity 0.2s;
}

.ip-preview-item:hover .ip-drag-handle {
    opacity: 0.7;
}

.ip-drag-handle span {
    width: 16px;
    height: 2px;
    background: currentColor;
    border-radius: 1px;
}

.ip-preview-number {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ip-primary);
    color: white;
    border-radius: 50%;
    font-size: 0.8rem;
    font-weight: 700;
}

.ip-preview-thumb {
    flex-shrink: 0;
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: cover;
    border: 1px solid var(--ip-border);
}

.ip-preview-info {
    flex: 1;
    min-width: 0;
}

.ip-preview-name {
    margin: 0 0 4px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--ip-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ip-preview-meta {
    margin: 0;
    font-size: 0.8rem;
    color: var(--ip-text-muted);
}

.ip-preview-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.ip-btn-icon {
    background: none;
    border: none;
    padding: 6px;
    cursor: pointer;
    border-radius: 6px;
    color: var(--ip-text-muted);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ip-btn-icon:hover {
    background: rgba(15, 23, 42, 0.06);
    color: var(--ip-text);
}

.ip-btn-icon:active {
    transform: scale(0.95);
}

.ip-btn-icon svg {
    width: 18px;
    height: 18px;
}

.ip-btn-icon.danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--ip-error);
}

/* Options Card */
.ip-option-group {
    margin-bottom: 20px;
}

.ip-option-group:last-of-type {
    margin-bottom: 16px;
}

.ip-option-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
}

.ip-option-label input[type="checkbox"] {
    margin-top: 2px;
    cursor: pointer;
    width: 18px;
    height: 18px;
    accent-color: var(--ip-primary);
}

.ip-option-label input[type="checkbox"]:disabled {
    cursor: not-allowed;
}

.ip-option-text {
    flex: 1;
}

.ip-option-text strong {
    display: block;
    margin-bottom: 2px;
    font-size: 0.95rem;
    color: var(--ip-text);
}

.ip-option-text small {
    display: block;
    font-size: 0.84rem;
    color: var(--ip-text-muted);
    line-height: 1.4;
}

.ip-compress-levels {
    margin-top: 12px;
    padding-left: 28px;
    display: grid;
    gap: 8px;
}

.ip-compress-levels label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.88rem;
    color: var(--ip-text);
    cursor: pointer;
}

.ip-compress-levels input[type="radio"] {
    cursor: pointer;
    accent-color: var(--ip-primary);
}

.ip-label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--ip-text);
}

.ip-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--ip-border);
    border-radius: var(--ip-radius-sm);
    font-family: inherit;
    font-size: 0.92rem;
    color: var(--ip-text);
    background: rgba(255, 255, 255, 0.7);
    transition: all 0.2s;
    outline: none;
}

.ip-input:focus {
    border-color: var(--ip-primary);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
}

/* Buttons */
.ip-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--ip-radius-sm);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    outline: none;
}

.ip-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.ip-btn-primary {
    background: var(--ip-primary);
    color: white;
    box-shadow: var(--ip-shadow);
}

.ip-btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--ip-shadow-hover);
}

.ip-btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.ip-btn-secondary {
    background: rgba(255, 255, 255, 0.9);
    color: var(--ip-text);
    border: 1px solid var(--ip-border);
}

.ip-btn-secondary:hover:not(:disabled) {
    background: white;
    border-color: var(--ip-border-hover);
}

.ip-btn-text {
    background: none;
    border: none;
    padding: 8px 12px;
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--ip-primary);
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s;
}

.ip-btn-text:hover {
    background: rgba(34, 197, 94, 0.08);
}

/* Action Bar */
.ip-action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
    background: var(--ip-card-bg);
    border-radius: var(--ip-radius);
    border: 1px solid var(--ip-border);
    box-shadow: var(--ip-shadow);
    position: sticky;
    bottom: 20px;
    z-index: 10;
}

.ip-action-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Progress Bar */
.ip-progress {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ip-progress-bar {
    width: 140px;
    height: 8px;
    background: rgba(148, 163, 184, 0.2);
    border-radius: 4px;
    overflow: hidden;
}

.ip-progress-fill {
    height: 100%;
    background: var(--ip-primary);
    border-radius: 4px;
    transition: width 0.3s ease;
    width: 0%;
}

.ip-progress-text {
    margin: 0;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--ip-text);
    white-space: nowrap;
}

/* Success State */
.ip-success {
    text-align: center;
    padding: 40px 24px;
    background: var(--ip-card-bg);
    border-radius: var(--ip-radius);
    border: 1px solid var(--ip-border);
    box-shadow: var(--ip-shadow);
}

.ip-success-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 16px;
    stroke: var(--ip-success);
}

.ip-success-title {
    margin: 0 0 20px;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--ip-text);
}

/* Toast */
.ip-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 400px;
}

.ip-toast {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    background: white;
    border-radius: var(--ip-radius-sm);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.15);
    border-left: 4px solid;
    animation: ip-toast-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes ip-toast-in {
    from {
        opacity: 0;
        transform: translateX(100px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.ip-toast.success {
    border-left-color: var(--ip-success);
}

.ip-toast.error {
    border-left-color: var(--ip-error);
}

.ip-toast.warning {
    border-left-color: var(--ip-warning);
}

.ip-toast-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.ip-toast.success .ip-toast-icon {
    color: var(--ip-success);
}

.ip-toast.error .ip-toast-icon {
    color: var(--ip-error);
}

.ip-toast.warning .ip-toast-icon {
    color: var(--ip-warning);
}

.ip-toast-content {
    flex: 1;
    min-width: 0;
}

.ip-toast-title {
    margin: 0 0 2px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--ip-text);
}

.ip-toast-message {
    margin: 0;
    font-size: 0.85rem;
    color: var(--ip-text-muted);
    line-height: 1.4;
}

/* Responsive */
@media (max-width: 968px) {
    .ip-layout {
        grid-template-columns: 1fr;
    }

    .ip-action-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .ip-action-right {
        flex-direction: column;
        align-items: stretch;
    }

    .ip-progress {
        justify-content: center;
    }
}

@media (max-width: 640px) {
    .ip-hero h1 {
        font-size: 1.8rem;
    }

    .ip-subtitle {
        font-size: 0.95rem;
    }

    .ip-card {
        padding: 18px;
    }

    .ip-dropzone {
        padding: 32px 18px;
    }

    .ip-preview-item {
        padding: 10px;
    }

    .ip-preview-thumb {
        width: 50px;
        height: 50px;
    }

    .ip-toast-container {
        left: 12px;
        right: 12px;
        max-width: none;
    }

    .ip-action-bar {
        bottom: 0;
        border-radius: var(--ip-radius) var(--ip-radius) 0 0;
    }
}