/**
 * ConvMaster - HEIC to JPG Converter Styles
 * 
 * @package    ConvMaster
 * @version    1.0.0
 */

/* =====================================================
   TOOL PAGE LAYOUT
   ===================================================== */
.tool-page {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

.tool-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.tool-header__icon {
    font-size: 2.5rem;
}

.tool-header__icon .icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: var(--radius-lg);
    background: var(--bg-tertiary);
}

.tool-header__icon .icon--pink {
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.2), rgba(244, 114, 182, 0.2));
}

.tool-header__text h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0 0 0.25rem;
    color: var(--text-primary);
}

.tool-header__text p {
    margin: 0;
    color: var(--text-secondary);
}

.tool-header__date {
    display: inline-block;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    background: var(--bg-tertiary);
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
}

/* =====================================================
   CONVERTER WIDGET
   ===================================================== */
.converter {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

/* Drop Zone */
.converter__dropzone {
    padding: 3rem 2rem;
    text-align: center;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    margin: 1.5rem;
    transition: all 0.2s ease;
    cursor: pointer;
}

.converter__dropzone:hover {
    border-color: var(--primary);
    background: rgba(0, 102, 255, 0.05);
}

.converter__dropzone--active {
    border-color: var(--primary);
    background: rgba(0, 102, 255, 0.1);
    transform: scale(1.01);
}

.converter__dropzone-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    color: var(--text-muted);
    opacity: 0.6;
}

.converter__dropzone-icon svg {
    width: 100%;
    height: 100%;
}

.converter__dropzone-text {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.5rem;
}

.converter__dropzone-hint {
    color: var(--text-muted);
    margin: 0 0 1.5rem;
    font-size: 0.9rem;
}

.converter__dropzone-formats {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

/* Format Badges */
.format-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    border-radius: 4px;
    text-transform: uppercase;
}

.format-badge--heic,
.format-badge--heif {
    background: rgba(79, 70, 229, 0.15);
    color: #6366F1;
}

.format-badge--png {
    background: rgba(16, 185, 129, 0.15);
    color: #10B981;
}

.format-badge--jpg,
.format-badge--jpeg {
    background: rgba(239, 68, 68, 0.15);
    color: #EF4444;
}

.format-badge--webp {
    background: rgba(139, 92, 246, 0.15);
    color: #8B5CF6;
}

/* =====================================================
   WORKSPACE
   ===================================================== */
.converter__workspace {
    padding: 1.5rem;
}

.converter__workspace[hidden] {
    display: none !important;
}

/* File List */
.converter__file-list {
    margin-bottom: 1.5rem;
}

.converter__file-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.converter__file-list-header h3 {
    margin: 0;
    font-size: 1rem;
    color: var(--text-primary);
}

/* Thumbnails Grid */
.converter__thumbnails {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 1rem;
}

.converter__thumbnail {
    position: relative;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    aspect-ratio: 1;
}

.converter__thumbnail-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: var(--bg-secondary);
}

.converter__thumbnail-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.75rem;
    gap: 0.5rem;
}

.converter__thumbnail-placeholder svg {
    width: 32px;
    height: 32px;
    opacity: 0.5;
}

.converter__thumbnail-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.5rem;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    color: white;
    font-size: 0.7rem;
}

.converter__thumbnail-name {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.converter__thumbnail-size {
    opacity: 0.8;
}

.converter__thumbnail-remove {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    line-height: 1;
    transition: all 0.2s ease;
    opacity: 0;
}

.converter__thumbnail:hover .converter__thumbnail-remove {
    opacity: 1;
}

.converter__thumbnail-remove:hover {
    background: #DC2626;
    transform: scale(1.1);
}

.converter__thumbnail--converted {
    border-color: var(--success);
}

.converter__thumbnail--converted::after {
    content: '✓';
    position: absolute;
    top: 0.25rem;
    left: 0.25rem;
    width: 24px;
    height: 24px;
    background: var(--success);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
}

.converter__thumbnail--error {
    border-color: var(--danger);
}

.converter__thumbnail--error::after {
    content: '!';
    position: absolute;
    top: 0.25rem;
    left: 0.25rem;
    width: 24px;
    height: 24px;
    background: var(--danger);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: bold;
}

/* =====================================================
   OPTIONS
   ===================================================== */
.converter__options {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.converter__options-grid {
    display: grid;
    gap: 1.5rem;
}

.converter__option-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.converter__option-value {
    font-family: 'JetBrains Mono', monospace;
    color: var(--primary);
}

/* Format Selector */
.converter__format-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

@media (max-width: 480px) {
    .converter__format-selector {
        grid-template-columns: 1fr;
    }
}

.format-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 1rem 0.5rem;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

.format-btn:hover {
    border-color: var(--primary);
    background: rgba(0, 102, 255, 0.05);
}

.format-btn--selected {
    border-color: var(--primary);
    background: rgba(0, 102, 255, 0.1);
}

.format-btn__icon {
    font-size: 1.5rem;
}

.format-btn__name {
    font-weight: 700;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.format-btn__desc {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Quality Slider */
.converter__slider {
    width: 100%;
    height: 8px;
    appearance: none;
    background: var(--bg-secondary);
    border-radius: 4px;
    outline: none;
}

.converter__slider::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 102, 255, 0.4);
    transition: transform 0.1s ease;
}

.converter__slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.converter__slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--primary);
    border: none;
    border-radius: 50%;
    cursor: pointer;
}

.converter__slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.5rem;
}

/* =====================================================
   ACTIONS
   ===================================================== */
.converter__actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.btn--primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn--primary:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
    transform: none;
}

.btn--secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn--secondary:hover {
    background: var(--bg-secondary);
}

.btn--success {
    background: var(--success);
    color: white;
}

.btn--success:hover {
    background: var(--success-dark, #059669);
    transform: translateY(-1px);
}

.btn--large {
    padding: 1rem 2rem;
    font-size: 1rem;
}

.btn--small {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
}

.btn[hidden] {
    display: none !important;
}

/* =====================================================
   PROGRESS & MESSAGES
   ===================================================== */
.converter__progress {
    margin-top: 1.5rem;
    text-align: center;
}

.converter__progress[hidden] {
    display: none !important;
}

.converter__progress-bar {
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.converter__progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light, #60a5fa));
    border-radius: 4px;
    transition: width 0.3s ease;
}

.converter__progress-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.converter__error,
.converter__success {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1rem;
    margin-top: 1.5rem;
    border-radius: var(--radius-md);
}

.converter__error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger);
}

.converter__success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: var(--success);
}

.converter__error[hidden],
.converter__success[hidden] {
    display: none !important;
}

.converter__error svg,
.converter__success svg {
    flex-shrink: 0;
}

/* =====================================================
   RESULTS
   ===================================================== */
.converter__results {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

.converter__results[hidden] {
    display: none !important;
}

.converter__results h3 {
    margin: 0 0 1rem;
    font-size: 1rem;
    color: var(--text-primary);
}

.converter__results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.converter__result-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.converter__result-preview {
    aspect-ratio: 4/3;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    background-image: 
        linear-gradient(45deg, #808080 25%, transparent 25%), 
        linear-gradient(-45deg, #808080 25%, transparent 25%), 
        linear-gradient(45deg, transparent 75%, #808080 75%), 
        linear-gradient(-45deg, transparent 75%, #808080 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
    background-color: #a0a0a0;
}

[data-theme="light"] .converter__result-preview {
    background-color: #d0d0d0;
}

.converter__result-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.converter__result-info {
    padding: 0.75rem;
}

.converter__result-name {
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.25rem;
}

.converter__result-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.converter__result-savings {
    font-weight: 600;
}

.converter__result-savings--positive {
    color: var(--success);
}

.converter__result-savings--negative {
    color: var(--warning);
}

.converter__result-download {
    width: 100%;
    padding: 0.5rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.converter__result-download:hover {
    background: var(--primary-dark);
}

/* =====================================================
   SEO CONTENT
   ===================================================== */
.tool-content {
    margin-top: 3rem;
}

.tool-section {
    margin-bottom: 2.5rem;
}

.tool-section h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.tool-section p {
    color: var(--text-secondary);
    line-height: 1.7;
}

/* Features Grid */
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.feature-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    text-align: center;
}

.feature-card__icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
    display: block;
}

.feature-card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.5rem;
}

.feature-card p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
}

/* Steps Grid */
.steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.step-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    text-align: center;
    position: relative;
}

.step-card__number {
    position: absolute;
    top: -0.75rem;
    left: 50%;
    transform: translateX(-50%);
    width: 2rem;
    height: 2rem;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.875rem;
}

.step-card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0.5rem 0 0.5rem;
}

.step-card p {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin: 0;
}

/* Formats Table */
.formats-table {
    overflow-x: auto;
}

.formats-table table {
    width: 100%;
    border-collapse: collapse;
}

.formats-table th,
.formats-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.formats-table th {
    font-weight: 600;
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.formats-table td {
    color: var(--text-secondary);
}

/* FAQ */
.faq-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.faq-item {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

.faq-item summary {
    padding: 1rem 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.faq-item summary::after {
    content: '+';
    font-size: 1.25rem;
    color: var(--text-muted);
}

.faq-item[open] summary::after {
    content: '−';
}

.faq-item p {
    padding: 0 1.5rem 1rem;
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 640px) {
    .tool-header {
        flex-direction: column;
        text-align: center;
    }
    
    .converter__thumbnails {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
    
    .converter__file-list-header {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }
    
    .converter__actions {
        flex-direction: column;
    }
    
    .converter__actions .btn {
        width: 100%;
        justify-content: center;
    }
}

/* =====================================================
   REMOVE SPINNERS FROM NUMBER INPUTS
   ===================================================== */
input[type="number"] {
    -moz-appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Darker placeholders */
input::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}
