/* ==========================================
   JPG to PDF Tool Styles
   ========================================== */

/* Breadcrumb */
.tool-breadcrumb {
    background: var(--gray-100);
    padding: 12px 0;
}

.tool-breadcrumb .breadcrumb {
    margin: 0;
    font-size: 0.85rem;
}

.tool-breadcrumb .breadcrumb-item a {
    color: var(--primary);
}

/* Tool Header */
.tool-header {
    padding: 50px 0 40px;
    background: linear-gradient(135deg, #fff9e6, #fff3cd);
}

.tool-icon-large {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2rem;
    margin-bottom: 20px;
    box-shadow: 0 8px 25px rgba(241, 196, 15, 0.3);
}

.tool-header h1 {
    font-size: 2rem;
    font-weight: 800;
    color: var(--dark);
    margin-bottom: 12px;
}

.tool-desc {
    font-size: 1.05rem;
    color: var(--gray-600);
    max-width: 650px;
    margin: 0 auto;
    line-height: 1.7;
}

/* Workspace */
.tool-workspace {
    padding: 40px 0 60px;
}

.workspace-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    padding: 40px;
    max-width: 900px;
    margin: 0 auto;
}

/* Upload Zone */
.upload-zone {
    border: 3px dashed var(--gray-300);
    border-radius: 16px;
    padding: 60px 30px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    background: var(--gray-100);
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--primary);
    background: rgba(231, 76, 60, 0.03);
}

.upload-zone.dragover {
    transform: scale(1.01);
}

.upload-icon {
    font-size: 3.5rem;
    color: var(--gray-400);
    margin-bottom: 16px;
}

.upload-zone:hover .upload-icon,
.upload-zone.dragover .upload-icon {
    color: var(--primary);
}

.upload-zone h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 8px;
}

.upload-zone p {
    color: var(--gray-500);
    margin-bottom: 16px;
}

.btn-upload {
    background: var(--primary);
    color: white;
    padding: 12px 28px;
    border-radius: 30px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
}

.btn-upload:hover {
    background: var(--primary-dark);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.3);
}

.upload-hint {
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-top: 16px;
    margin-bottom: 0;
}

/* Preview Area */
.preview-area {
    margin-top: 24px;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 12px;
}

.preview-header h4 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--dark);
    margin: 0;
}

.preview-actions {
    display: flex;
    gap: 8px;
}

.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 12px;
    max-height: 400px;
    overflow-y: auto;
    padding: 4px;
}

.preview-item {
    position: relative;
    border-radius: 10px;
    overflow: visible;
    border: 2px solid var(--gray-200);
    aspect-ratio: 1;
    cursor: grab;
    transition: all 0.2s ease;
    background: var(--gray-100);
}

.preview-item:hover {
    border-color: var(--primary);
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}

.preview-item.dragging {
    opacity: 0.4;
    cursor: grabbing;
    transform: scale(0.95);
}

.preview-item.drag-over {
    border-color: var(--primary);
    border-style: dashed;
    box-shadow: 0 0 12px rgba(231, 76, 60, 0.3);
    transform: scale(1.03);
}

.preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

.preview-item .item-order {
    position: absolute;
    top: 6px;
    left: 6px;
    background: var(--primary);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    z-index: 3;
}

.preview-item .item-remove {
    position: absolute;
    top: 6px;
    right: 6px;
    background: rgba(220, 53, 69, 0.85);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s ease;
    z-index: 3;
}

.preview-item:hover .item-remove {
    opacity: 1;
}

/* Move buttons */
.item-move-btns {
    position: absolute;
    bottom: 26px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 6px;
    z-index: 3;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.preview-item:hover .item-move-btns {
    opacity: 1;
}

.item-move-btn {
    width: 28px;
    height: 28px;
    background: rgba(0, 0, 0, 0.65);
    color: white;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.item-move-btn:hover {
    background: var(--primary);
    transform: scale(1.15);
}

.preview-item .item-name {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    color: white;
    padding: 16px 6px 6px;
    font-size: 0.65rem;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
    border-radius: 0 0 8px 8px;
}

/* Touch clone for mobile drag */
.touch-clone {
    border-radius: 10px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.3);
    border: 2px solid var(--primary) !important;
}

.drag-hint {
    font-size: 0.8rem;
    color: var(--gray-500);
    margin-top: 12px;
    margin-bottom: 0;
}

/* On mobile: always show move buttons */
@media (max-width: 991.98px) {
    .item-move-btns {
        opacity: 1;
    }
    .preview-item .item-remove {
        opacity: 1;
    }
}

/* Options */
.options-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 24px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--gray-200);
}

.options-grid {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.option-label {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--gray-700);
    margin-bottom: 12px;
    display: block;
}

.option-cards {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.option-card {
    flex: 1;
    min-width: 100px;
    border: 2px solid var(--gray-200);
    border-radius: 12px;
    padding: 16px 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
}

.option-card:hover {
    border-color: var(--gray-400);
}

.option-card.active {
    border-color: var(--primary);
    background: rgba(231, 76, 60, 0.03);
    box-shadow: 0 0 0 1px var(--primary);
}

.option-visual {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 50px;
    color: var(--gray-600);
}

.option-card.active .option-visual {
    color: var(--primary);
}

.option-card span {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--gray-700);
}

.option-card.active span {
    color: var(--primary);
}

/* Page preview visuals */
.page-preview {
    border: 2px solid currentColor;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
}

.page-preview.portrait {
    width: 30px;
    height: 42px;
}

.page-preview.landscape {
    width: 42px;
    height: 30px;
}

.size-label {
    font-size: 1.1rem;
    font-weight: 800;
}

/* Margin preview visuals */
.margin-preview {
    width: 44px;
    height: 44px;
    border: 2px solid currentColor;
    border-radius: 3px;
    position: relative;
}

.margin-preview::after {
    content: '';
    position: absolute;
    background: currentColor;
    opacity: 0.15;
    border-radius: 1px;
}

.margin-preview.no-margin::after {
    inset: 0;
}

.margin-preview.small-margin::after {
    inset: 4px;
}

.margin-preview.big-margin::after {
    inset: 8px;
}

/* Merge option */
.merge-option {
    padding: 16px;
    background: var(--gray-100);
    border-radius: 10px;
}

.merge-option .form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.merge-option .form-check-label {
    font-weight: 600;
    color: var(--dark);
}

/* Convert Button */
.btn-convert {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 16px 48px;
    border-radius: 30px;
    font-weight: 700;
    font-size: 1.05rem;
    border: none;
    box-shadow: 0 4px 20px rgba(231, 76, 60, 0.35);
    transition: all 0.3s ease;
}

.btn-convert:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(231, 76, 60, 0.45);
    color: white;
}

.btn-convert:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Progress */
.progress-area {
    padding: 40px 20px;
}

.spinner-wrapper {
    position: relative;
    width: 100px;
    height: 100px;
    margin: 0 auto 24px;
}

.spinner {
    width: 100px;
    height: 100px;
    border: 4px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.spinner-wrapper > i {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    color: var(--primary);
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.progress-area h3 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 8px;
}

.progress-area #progressText {
    color: var(--gray-600);
    margin-bottom: 20px;
}

.progress-bar-wrapper {
    max-width: 500px;
    margin: 0 auto;
}

.progress-bar-wrapper .progress {
    height: 12px;
    border-radius: 10px;
    background: var(--gray-200);
    overflow: hidden;
}

.progress-bar-wrapper .progress-bar {
    background: linear-gradient(90deg, var(--primary), #f39c12);
    border-radius: 10px;
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    color: white;
}

.progress-hint {
    margin-top: 16px;
    font-size: 0.82rem;
    color: var(--gray-500);
}

/* Download */
.download-area {
    padding: 40px 20px;
}

.download-icon {
    font-size: 4rem;
    color: #2ecc71;
    margin-bottom: 20px;
}

.download-area h3 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 8px;
}

.download-area > p {
    color: var(--gray-600);
    margin-bottom: 24px;
}

.btn-download {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    color: white;
    padding: 16px 40px;
    border-radius: 30px;
    font-weight: 700;
    font-size: 1.05rem;
    display: inline-flex;
    align-items: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(46, 204, 113, 0.35);
}

.btn-download:hover {
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(46, 204, 113, 0.45);
}

.download-info {
    margin-top: 24px;
}

.countdown-wrapper {
    font-size: 0.95rem;
    color: var(--gray-700);
    margin-bottom: 8px;
}

.countdown-wrapper strong {
    color: var(--primary);
    font-size: 1.1rem;
    font-family: monospace;
}

.download-warning {
    font-size: 0.82rem;
    color: var(--gray-500);
}

.download-warning i {
    color: #f39c12;
}

/* Error */
.error-area {
    padding: 40px 20px;
}

.error-icon {
    font-size: 4rem;
    color: var(--primary);
    margin-bottom: 20px;
}

.error-area h3 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 8px;
}

/* How to Section */
.tool-howto {
    padding: 60px 0;
    background: var(--gray-100);
}

.tool-howto h2 {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--dark);
}

.howto-step {
    text-align: center;
    padding: 24px;
}

.howto-number {
    width: 48px;
    height: 48px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 1.2rem;
    margin-bottom: 16px;
}

.howto-step h4 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--dark);
}

.howto-step p {
    font-size: 0.9rem;
    color: var(--gray-600);
    line-height: 1.6;
}

/* FAQ */
.tool-faq {
    padding: 60px 0;
}

.tool-faq h2 {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--dark);
}

.tool-faq .accordion-item {
    border: 1px solid var(--gray-200);
    border-radius: 10px !important;
    margin-bottom: 10px;
    overflow: hidden;
}

.tool-faq .accordion-button {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--dark);
}

.tool-faq .accordion-button:not(.collapsed) {
    background: rgba(231, 76, 60, 0.05);
    color: var(--primary);
}

.tool-faq .accordion-button:focus {
    box-shadow: none;
}

.tool-faq .accordion-body {
    font-size: 0.9rem;
    color: var(--gray-600);
    line-height: 1.7;
}

/* Responsive */
@media (max-width: 767.98px) {
    .workspace-card {
        padding: 24px 16px;
    }

    .upload-zone {
        padding: 40px 20px;
    }

    .upload-icon {
        font-size: 2.5rem;
    }

    .preview-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 8px;
    }

    .option-cards {
        gap: 8px;
    }

    .option-card {
        min-width: 80px;
        padding: 12px 8px;
    }

    .tool-header h1 {
        font-size: 1.5rem;
    }

    .btn-convert {
        width: 100%;
    }
}
