/* styles.css - Image Format Converter - January 2, 2026 */

/* ============================================
   CSS Variables & Base Styles
   ============================================ */
:root {
    --primary-color: #0d6efd;
    --primary-hover: #0b5ed7;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --light-bg: #f8f9fa;
    --card-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --card-shadow-hover: 0 8px 25px rgba(0, 0, 0, 0.15);
    --border-radius: 10px;
    --border-radius-sm: 5px;
    --transition-speed: 0.3s;
}

* {
    box-sizing: border-box;
}

body {
    padding-top: 2rem;
    padding-bottom: 2rem;
    background-color: var(--light-bg);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.container {
    max-width: 800px;
}

/* ============================================
   Header Styles
   ============================================ */
header h1 {
    color: #333;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

header h1 i {
    color: var(--primary-color);
}

header .lead {
    color: #666;
    margin-bottom: 0.5rem;
}

.privacy-badge {
    display: inline-block;
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    color: #155724;
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    margin-top: 0.5rem;
}

.privacy-badge i {
    margin-right: 0.3rem;
}

/* ============================================
   Card Styles
   ============================================ */
.card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--card-shadow);
    transition: box-shadow var(--transition-speed) ease;
    background: #fff;
}

.card:hover {
    box-shadow: var(--card-shadow-hover);
}

.card-title {
    color: #333;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--light-bg);
}

.card-title i {
    color: var(--primary-color);
}

/* ============================================
   Drop Zone Styles
   ============================================ */
.drop-zone {
    position: relative;
    border: 2px dashed #ccc;
    border-radius: var(--border-radius);
    padding: 2.5rem 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-speed) ease;
    background: linear-gradient(135deg, #fafafa 0%, #f0f0f0 100%);
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.drop-zone:hover {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, #f0f7ff 0%, #e6f0ff 100%);
}

.drop-zone:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.25);
}

.drop-zone.drag-over {
    border-color: var(--primary-color);
    border-style: solid;
    background: linear-gradient(135deg, #e6f0ff 0%, #cce0ff 100%);
    transform: scale(1.02);
}

.drop-zone-content {
    transition: opacity var(--transition-speed) ease;
}

.drop-zone.drag-over .drop-zone-content {
    opacity: 0;
}

.drop-zone-icon {
    font-size: 3rem;
    color: #aaa;
    margin-bottom: 1rem;
    transition: color var(--transition-speed) ease, transform var(--transition-speed) ease;
}

.drop-zone:hover .drop-zone-icon {
    color: var(--primary-color);
    transform: translateY(-5px);
}

.drop-zone-text {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 0.25rem;
}

.drop-zone-hint {
    font-size: 0.9rem;
    color: #999;
    margin-bottom: 0;
}

.drop-zone-active {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: opacity var(--transition-speed) ease;
    pointer-events: none;
}

.drop-zone-active i {
    font-size: 3rem;
    color: var(--primary-color);
    animation: bounce 0.5s ease infinite;
}

.drop-zone-active p {
    color: var(--primary-color);
    font-weight: 600;
    margin-top: 0.5rem;
}

.drop-zone.drag-over .drop-zone-active {
    opacity: 1;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

/* ============================================
   Preview Styles
   ============================================ */
.preview-wrapper {
    position: relative;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.preview-container {
    max-height: 300px;
    overflow: hidden;
    border-radius: var(--border-radius-sm);
    text-align: center;
    background: linear-gradient(45deg, #f0f0f0 25%, transparent 25%),
                linear-gradient(-45deg, #f0f0f0 25%, transparent 25%),
                linear-gradient(45deg, transparent 75%, #f0f0f0 75%),
                linear-gradient(-45deg, transparent 75%, #f0f0f0 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
    background-color: #fff;
    border: 1px solid #ddd;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 150px;
}

#imagePreview {
    max-width: 100%;
    max-height: 300px;
    object-fit: contain;
}

.clear-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    opacity: 0.8;
    transition: opacity var(--transition-speed) ease;
}

.clear-btn:hover {
    opacity: 1;
}

/* ============================================
   Image Details Styles
   ============================================ */
.image-details {
    background: linear-gradient(135deg, var(--light-bg) 0%, #eef2f7 100%);
    padding: 1rem;
    border-radius: var(--border-radius-sm);
    animation: fadeIn 0.3s ease;
}

.detail-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 0.5rem;
}

.detail-item i {
    font-size: 1.2rem;
    color: var(--primary-color);
    margin-bottom: 0.3rem;
}

.detail-label {
    font-size: 0.75rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-value {
    font-weight: 600;
    color: #333;
    font-size: 0.95rem;
}

/* ============================================
   Format Options Styles
   ============================================ */
.format-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.format-btn {
    border-radius: 8px;
    padding: 0.6rem 1rem;
    min-width: 80px;
    transition: all var(--transition-speed) ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.format-btn:hover:not(.btn-primary) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.3);
}

.format-btn.btn-primary {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.4);
}

.format-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.format-desc {
    font-size: 0.65rem;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.format-note {
    background: #fff3cd;
    color: #856404;
    padding: 0.5rem 0.75rem;
    border-radius: var(--border-radius-sm);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.format-note i {
    color: #ffc107;
}

/* ============================================
   Quality Slider Styles
   ============================================ */
.quality-slider-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.quality-slider-wrapper .form-range {
    flex: 1;
}

.quality-label {
    font-size: 0.75rem;
    color: #888;
    text-transform: uppercase;
    white-space: nowrap;
}

#qualityValue {
    min-width: 45px;
    text-align: center;
}

/* ============================================
   Resize Controls Styles
   ============================================ */
.resize-controls .input-group {
    max-width: 100%;
}

.resize-controls .form-control {
    text-align: center;
}

.resize-controls .input-group-text {
    background: var(--light-bg);
}

.dimension-separator {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    font-weight: bold;
}

.resize-presets {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.preset-label {
    font-size: 0.85rem;
    color: #666;
}

.preset-btn {
    padding: 0.25rem 0.6rem;
    font-size: 0.8rem;
}

.preset-btn:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

/* ============================================
   Convert Button Styles
   ============================================ */
.convert-btn {
    padding: 0.8rem 2rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    transition: all var(--transition-speed) ease;
}

.convert-btn:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(13, 110, 253, 0.4);
}

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

.convert-btn.converting {
    pointer-events: none;
}

.convert-btn.converting i {
    animation: spin 1s linear infinite;
}

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

/* ============================================
   Progress Section Styles
   ============================================ */
.progress-section {
    margin: 1.5rem 0;
    animation: fadeIn 0.3s ease;
}

.progress {
    height: 30px;
    border-radius: 15px;
    background-color: #e9ecef;
    overflow: hidden;
}

.progress-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 500;
    transition: width 0.3s ease;
}

/* ============================================
   Error Message Styles
   ============================================ */
#errorMessage {
    border-radius: var(--border-radius);
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* ============================================
   Result Section Styles
   ============================================ */
.result-section {
    animation: slideUp 0.4s ease;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.result-card {
    border: 2px solid var(--success-color);
    background: linear-gradient(135deg, #fff 0%, #f0fff4 100%);
}

.result-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.result-header i {
    font-size: 2rem;
    animation: popIn 0.5s ease;
}

@keyframes popIn {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.result-header h3 {
    margin: 0;
    color: var(--success-color);
}

.result-comparison {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: #fff;
    border-radius: var(--border-radius-sm);
}

.comparison-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem 1rem;
}

.comparison-label {
    font-size: 0.75rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.comparison-value {
    font-weight: 700;
    font-size: 1.1rem;
    color: #333;
}

.comparison-arrow {
    color: var(--primary-color);
    font-size: 1.2rem;
}

.comparison-item.savings {
    background: #d4edda;
    border-radius: var(--border-radius-sm);
}

.comparison-item.savings .comparison-value {
    color: var(--success-color);
}

.result-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
}

.result-actions .btn {
    min-width: 150px;
}

#downloadBtn {
    animation: pulse 2s ease infinite;
}

@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(25, 135, 84, 0.4); }
    50% { box-shadow: 0 0 0 10px rgba(25, 135, 84, 0); }
}

#downloadBtn:hover {
    animation: none;
}

/* ============================================
   Footer Styles
   ============================================ */
.footer {
    margin-top: 3rem;
    padding: 2rem 0;
    text-align: center;
    color: #666;
    border-top: 1px solid #eee;
}

.footer p {
    margin-bottom: 0.5rem;
}

.footer p:last-child {
    margin-bottom: 0;
}

.footer i {
    color: var(--primary-color);
}

/* ============================================
   Toast Notification Styles
   ============================================ */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1050;
}

.custom-toast {
    background: #333;
    color: #fff;
    padding: 0.75rem 1.25rem;
    border-radius: var(--border-radius-sm);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: slideInRight 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.custom-toast.success {
    background: var(--success-color);
}

.custom-toast.error {
    background: var(--danger-color);
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ============================================
   Responsive Styles
   ============================================ */
@media (max-width: 576px) {
    body {
        padding-top: 1rem;
    }
    
    .card {
        padding: 1rem !important;
    }
    
    .drop-zone {
        padding: 1.5rem 1rem;
        min-height: 150px;
    }
    
    .drop-zone-icon {
        font-size: 2.5rem;
    }
    
    .format-options {
        justify-content: center;
    }
    
    .format-btn {
        min-width: 70px;
        padding: 0.5rem 0.75rem;
    }
    
    .quality-slider-wrapper {
        flex-wrap: wrap;
    }
    
    .resize-controls .input-group {
        flex-wrap: nowrap;
    }
    
    .resize-controls .form-control {
        min-width: 60px;
    }
    
    .resize-presets {
        justify-content: center;
    }
    
    .result-comparison {
        gap: 0.5rem;
    }
    
    .comparison-item {
        padding: 0.5rem;
    }
    
    .result-actions {
        flex-direction: column;
    }
    
    .result-actions .btn {
        width: 100%;
    }
}

/* ============================================
   Accessibility Improvements
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus visible styles for keyboard navigation */
:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 2px;
}

button:focus:not(:focus-visible),
a:focus:not(:focus-visible) {
    outline: none;
}

/* ============================================
   Print Styles
   ============================================ */
@media print {
    .drop-zone,
    .convert-btn,
    .result-actions,
    .progress-section {
        display: none !important;
    }
}
