/* Image to Base64 Converter - Custom Styles */

/* Base64 Textarea Styling */
.base64-textarea {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    word-break: break-all;
    white-space: pre-wrap;
    resize: vertical;
}

/* Modern Mode Selector */
.mode-selector-modern {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    padding: 0;
}

.mode-option {
    position: relative;
}

.mode-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.mode-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    height: 100%;
}

.mode-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.mode-icon .fsvg {
    opacity: 0.6;
    transition: all 0.3s ease;
}

.mode-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mode-title {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
    line-height: 1.3;
}

.mode-desc {
    font-size: 13px;
    color: #6b7280;
    line-height: 1.4;
}

/* Hover State */
.mode-label:hover {
    border-color: #cbd5e1;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

.mode-label:hover .mode-icon {
    background: #e8edf3;
}

.mode-label:hover .mode-icon .fsvg {
    opacity: 0.8;
}

/* Checked State */
.mode-input:checked + .mode-label {
    border-color: #052c65;
    background: #f8fafc;
    box-shadow: 0 2px 8px rgba(5, 44, 101, 0.1), inset 0 0 0 1px rgba(5, 44, 101, 0.1);
    transform: translateY(0);
}

.mode-input:checked + .mode-label .mode-icon {
    background: #052c65;
}

.mode-input:checked + .mode-label .mode-icon .fsvg {
    filter: brightness(0) invert(1);
    opacity: 1;
}

.mode-input:checked + .mode-label .mode-title {
    color: #052c65;
}

.mode-input:checked + .mode-label .mode-desc {
    color: #475569;
}

/* Dark Mode */
[data-bs-theme="dark"] .mode-label {
    background: #1a1d23;
    border-color: #343a40;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

[data-bs-theme="dark"] .mode-icon {
    background: #2d3239;
}

[data-bs-theme="dark"] .mode-title {
    color: #e9ecef;
}

[data-bs-theme="dark"] .mode-desc {
    color: #9ca3af;
}

[data-bs-theme="dark"] .mode-label:hover {
    border-color: #495057;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-bs-theme="dark"] .mode-label:hover .mode-icon {
    background: #3a3f47;
}

[data-bs-theme="dark"] .mode-input:checked + .mode-label {
    border-color: #6ea8fe;
    background: #212529;
    box-shadow: 0 2px 8px rgba(110, 168, 254, 0.2), inset 0 0 0 1px rgba(110, 168, 254, 0.2);
}

[data-bs-theme="dark"] .mode-input:checked + .mode-label .mode-icon {
    background: #6ea8fe;
}

[data-bs-theme="dark"] .mode-input:checked + .mode-label .mode-title {
    color: #6ea8fe;
}

[data-bs-theme="dark"] .mode-input:checked + .mode-label .mode-desc {
    color: #9ca3af;
}

/* Image Preview Styling */
#imagePreview,
#decodedImage {
    max-height: 120px;
    max-width: 200px;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    transition: all 0.15s ease-in-out;
    object-fit: contain;
    cursor: pointer;
    user-select: none;
}

#imagePreview:hover {
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.15);
    transform: scale(1.05);
}

#decodedImage {
    max-width: 100%;
    max-height: 400px;
    width: auto;
    height: auto;
}

[data-bs-theme="dark"] #imagePreview,
[data-bs-theme="dark"] #decodedImage {
    border-color: #495057;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.4);
}

[data-bs-theme="dark"] #imagePreview:hover {
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.6);
}

/* Statistics Container */
.stats-container {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    padding: 15px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    min-width: 140px;
}

.stat-label {
    font-size: 12px;
    color: #6c757d;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 20px;
    font-weight: 600;
    color: #212529;
}

[data-bs-theme="dark"] .stats-container {
    background: #1a1d23;
    border-color: #343a40;
}

[data-bs-theme="dark"] .stat-label {
    color: #9ca3af;
}

[data-bs-theme="dark"] .stat-value {
    color: #e9ecef;
}

/* Form Controls Dark Mode */
[data-bs-theme="dark"] .form-select,
[data-bs-theme="dark"] .base64-textarea,
[data-bs-theme="dark"] .toolOutput {
    background-color: #212529;
    border-color: #495057;
    color: #e9ecef;
}

[data-bs-theme="dark"] .form-select:focus,
[data-bs-theme="dark"] .base64-textarea:focus {
    background-color: #212529;
    border-color: #86b7fe;
    color: #e9ecef;
}

[data-bs-theme="dark"] .toolOutput {
    background-color: #1a1d23;
    color: #9ca3af;
}

/* Form Labels */
.form-group label,
.form-label {
    color: #212529;
    font-weight: 500;
}

[data-bs-theme="dark"] .form-group label,
[data-bs-theme="dark"] .form-label {
    color: #e9ecef;
}

/* Button Styling */
.toolBtn {
    transition: all 0.2s ease;
    border-radius: 6px;
    font-weight: 500;
    padding: 8px 16px;
}

.toolBtn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.toolBtn:active {
    transform: translateY(0);
}

/* Download Link Button Styling */
#downloadImageLink {
    color: white !important;
    text-decoration: none !important;
}

#downloadImageLink:hover,
#downloadImageLink:visited,
#downloadImageLink:focus,
#downloadImageLink:active {
    color: white !important;
    text-decoration: none !important;
}

/* Focus States */
.base64-textarea:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.form-select:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Placeholder Styling */
.base64-textarea::placeholder {
    color: #6c757d;
    opacity: 0.7;
}

[data-bs-theme="dark"] .base64-textarea::placeholder {
    color: #9ca3af;
    opacity: 0.8;
}

/* File Name Display */
#fileNameDisplay {
    font-size: 12px;
    color: #6c757d;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}

[data-bs-theme="dark"] #fileNameDisplay {
    color: #9ca3af;
}

/* Responsive Design */
@media (max-width: 768px) {
    .mode-selector-modern {
        grid-template-columns: 1fr;
    }

    .mode-label {
        padding: 14px;
    }

    .mode-icon {
        width: 44px;
        height: 44px;
    }

    .mode-title {
        font-size: 15px;
    }

    .mode-desc {
        font-size: 12px;
    }

    .stats-container {
        gap: 10px;
        padding: 10px;
    }

    .stat-item {
        min-width: 100px;
    }

    .stat-label {
        font-size: 11px;
    }

    .stat-value {
        font-size: 16px;
    }

    .toolBtn {
        width: 100%;
        margin-bottom: 5px;
    }

    .base64-textarea {
        font-size: 12px;
    }
}

@media (max-width: 576px) {
    .mode-selector-modern {
        gap: 12px;
    }

    .mode-label {
        padding: 12px;
        gap: 10px;
    }

    .mode-icon {
        width: 40px;
        height: 40px;
    }

    .mode-icon img {
        width: 20px;
        height: 20px;
    }
}

/* Loading Animation */
.toolBtn.loading {
    position: relative;
    pointer-events: none;
}

.toolBtn.loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.6s linear infinite;
}

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

/* Smooth Transitions */
#imagePreviewContainer,
#imageInfoSection,
#outputOptionsSection,
#convertButtonSection,
#base64OutputSection,
#statisticsSection,
#decodedImageSection {
    animation: slideDown 0.3s ease-out;
}

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

/* Output Select Styling */
.form-select {
    cursor: pointer;
}

[data-bs-theme="dark"] .form-select option {
    background-color: #212529;
    color: #e9ecef;
}

/* Prevent text selection on labels */
.form-label {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Text selection allowed in textareas and inputs */
.base64-textarea,
.toolOutput {
    user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
}