/* ============================================
=== CONVERT-TO-JPG - MODERN STYLES ===
============================================
*/
/* Is file mein sirf wahi styles hain jo compress/resize se alag hain */
/* Sabhi modal/card styles common-tools.css se aa rahe hain */

/* Modal Z-Index & Styling */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100; /* Higher than header (50) */
    padding: 1rem;
    opacity: 1;
    transition: opacity 0.3s ease;
    visibility: visible;
}
.modal-overlay.ct-hidden { /* Use .ct-hidden */
    opacity: 0;
    visibility: hidden;
}


/* Modal Content */
#tool-modal .modal-content {
    max-width: 90%;
    width: 1400px;
    padding: 0;
    border-radius: 24px;
    background: linear-gradient(145deg, rgba(255,255,255,0.95), rgba(248,250,252,0.98));
    border: 1px solid rgba(107,70,255,0.08);
    box-shadow: 0 40px 100px rgba(11,23,50,0.15), 0 0 0 1px rgba(255,255,255,0.5) inset;
    overflow: hidden;
    color: var(--text-light);
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 40px);
}
body.dark #tool-modal .modal-content {
    background: linear-gradient(145deg, rgba(15,23,42,0.98), rgba(8,10,14,0.95));
    border: 1px solid rgba(139,92,246,0.12);
    box-shadow: 0 40px 100px rgba(0,0,0,0.8), 0 0 0 1px rgba(107,70,255,0.1) inset;
    color: var(--text-dark);
}

/* Modal Header */
#tool-modal .modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}
body.dark #tool-modal .modal-header {
    border-bottom-color: var(--border-dark);
}
#tool-modal h2 {
    font-size: 1.25rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 90%;
}
#tool-modal .modal-close-btn {
    background: var(--bg-light);
    color: var(--text-light);
    border: 1px solid var(--border-light);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}
body.dark #tool-modal .modal-close-btn {
    background: var(--bg-dark);
    color: var(--text-dark);
    border-color: var(--border-dark);
}
#tool-modal .modal-close-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
    transform: rotate(90deg);
}

/* Modal Body */
#tool-modal .modal-body {
    display: grid;
    grid-template-columns: 3fr 1fr;
    overflow: hidden;
    flex-grow: 1;
}

/* Preview Section */
#tool-modal .preview-section {
    padding: 1.5rem;
    overflow-y: auto;
}
#tool-modal .preview-container-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

/* Options Container */
#tool-modal .options-container {
    padding: 1.5rem;
    border-left: 1px solid var(--border-light);
    background: rgba(0,0,0,0.01);
    overflow-y: auto;
}
body.dark #tool-modal .options-container {
    border-left-color: var(--border-dark);
    background: rgba(0,0,0,0.1);
}

/* Modal Footer */
#tool-modal .modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border-light);
    background: rgba(255,255,255,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}
body.dark #tool-modal .modal-footer {
    border-top-color: var(--border-dark);
    background: rgba(15,23,42,0.5);
}
#tool-modal .status-text {
    flex-grow: 1;
    text-align: left;
    display: none;
}
#tool-modal .btn-compress,
#tool-modal .download-options {
    flex-shrink: 0;
    flex-grow: 0;
    width: auto;
    min-width: 200px;
    padding: 0.75rem 1.5rem;
}
#tool-modal .download-options {
    display: flex;
    gap: 1rem;
}
#tool-modal .btn-download {
    width: 100%;
}


/* Preview Card (Copied from compress-image.css) */
.image-card {
    background: var(--card-light);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0,0,0,0.03);
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
}
body.dark .image-card {
    background: var(--card-dark);
    border-color: var(--border-dark);
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
.image-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.05);
}
body.dark .image-card:hover {
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}
.image-card-header, .image-card-footer {
    padding: 0.5rem 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    flex-shrink: 0;
}
.image-card-header {
    background: var(--bg-light);
    flex-wrap: wrap;
    gap: 0.25rem;
}
body.dark .image-card-header {
    background: var(--bg-dark);
}
.image-size {
    font-weight: 600;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    background: rgba(0,0,0,0.05);
}
body.dark .image-size {
    background: rgba(255,255,255,0.05);
}
.original-size { color: var(--text-secondary); }
.converted-size { color: #10b981; }
.image-preview {
    height: 150px;
    padding: 0.5rem;
    background: var(--bg-light);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-grow: 1;
    overflow: hidden;
}
body.dark .image-preview { background: var(--bg-dark); }
.preview-canvas {
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.image-card-footer {
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    text-align: center;
}
.image-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}
.download-single-btn {
    padding: 0.35rem 0.6rem;
    font-size: 0.7rem;
    border-radius: 6px;
    background: var(--brand-primary);
    color: white;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}
.download-single-btn:hover {
    opacity: 0.8;
}
.download-placeholder {
    padding: 0.5rem 0.75rem;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 36px;
    border-top: 1px solid var(--border-light);
}
body.dark .download-placeholder {
    border-top-color: var(--border-dark);
}


/* === OPTIONS (CONVERT) === */
.option-group { margin-bottom: 1.25rem; }
.option-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
}
.option-input {
    width: 100%;
    padding: 0.65rem 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-light);
    background: var(--bg-light);
    color: var(--text-light);
    transition: all 0.2s ease;
}
body.dark .option-input {
    background: var(--bg-dark);
    border-color: var(--border-dark);
    color: var(--text-dark);
}
.option-input:focus {
    outline: none;
    border-color: var(--brand-primary);
    background-color: var(--card-light);
}
body.dark .option-input:focus {
    background-color: var(--card-dark);
}

.adjustment-section {
    border-top: none; /* No border needed for single section */
    padding-top: 0;
    margin-top: 0;
}
.adjustment-section .section-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

/* Sliders */
.slider-group { display: flex; align-items: center; gap: 0.75rem; }
.slider-group input[type="range"] { flex: 1; }
.slider-value {
    display: inline-block;
    min-width: 40px;
    text-align: center;
    font-weight: 600;
    color: var(--brand-primary);
    font-size: 0.9rem;
}

/* Status Text */
.status-text {
    text-align: left;
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
}
.status-text.success { color: #10b981; }
.status-text.error { color: #ef4444; }
.status-text .loader {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-light);
    border-top-color: var(--brand-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    display: inline-block;
    margin-right: 0.5rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Responsive */
@media (max-width: 1024px) {
    #tool-modal .modal-body {
        display: block;
        overflow-y: auto;
        max-height: 70vh;
    }
    #tool-modal .options-container {
        border-left: none;
        border-top: 1px solid var(--border-light);
        max-height: none;
        overflow-y: visible;
    }
    body.dark #tool-modal .options-container {
        border-top-color: var(--border-dark);
    }
}
@media (max-width: 768px) {
    #tool-modal .modal-content {
        border-radius: 18px;
        max-height: calc(100vh - 40px);
        width: 100%;
    }
    #tool-modal .modal-header { padding: 1.25rem 1rem; }
    
    #tool-modal h2 {
        font-size: 1.15rem; 
    }
    #tool-modal .modal-body {
        max-height: calc(100vh - 200px);
    }
    #tool-modal .preview-container-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    #tool-modal .modal-footer {
        flex-direction: column;
        align-items: center;
    }
    #tool-modal .btn-compress,
    #tool-modal .download-options {
        flex-basis: auto;
        width: 100%;
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }
    #tool-modal .download-options {
        flex-direction: column;
    }
    #tool-modal .status-text {
        text-align: center;
        margin-bottom: 0.5rem;
        width: 100%;
        justify-content: center;
    }
}
@media (max-width: 480px) {
    #tool-modal .preview-container-grid {
        grid-template-columns: 1fr 1fr;
    }
}