:root {
    --primary: #4f46e5;
    --primary-light: #6366f1;
    --primary-lighter: #818cf8;
    --secondary: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --dark: #1e293b;
    --darker: #0f172a;
    --light: #f8fafc;
    --gray: #94a3b8;
    --gray-light: #e2e8f0;
    --gray-lighter: #f1f5f9;
    --success: #10b981;
    --info: #3b82f6;
    --white: #ffffff;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

body {
    background-color: var(--gray-lighter);
    color: var(--dark);
    min-height: 100vh;
    line-height: 1.5;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.headerp {
    text-align: center;
    margin-bottom: 1rem;
    margin-top: -0.5rem;
    background-color: var(--white);
    border-radius: 0.75rem;
    box-shadow: var(--shadow-sm);
    padding: 1rem 0.1rem;
}

.headerp h1 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.headerp .subtitle {
    font-size: 1rem;
    color: var(--gray);
    max-width: 700px;
    margin: 0 auto;
}

.tool-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

@media (max-width: 768px) {
    .tool-container {
        grid-template-columns: 1fr;
    }
    
    .headerp h1 {
        font-size: 1.2rem;
    }
    
    .btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.8rem;
    }
    
    .panel-header, .upload-section, .uploaded-files, .resize-options, .controls {
        padding: 0.8rem;
    }
    
    .upload-option {
        padding: 1rem;
    }
    
    .results-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 1rem;
        padding: 0.8rem;
    }
}

@media (max-width: 480px) {
    .results-footer {
        flex-direction: column;
        gap: 0.5rem;
    }

    .results-footer .btn {
        width: 100%;
    }
}

.panel {
    background: white;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.03);
}

.panel-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--gray-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--darker);
}

.panel-actions {
    display: flex;
    gap: 0.5rem;
}

.btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    white-space: nowrap;
}

.btn:hover {
    background: var(--primary-lighter);
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

.btn:active {
    transform: translateY(0);
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}

.btn-secondary {
    background: white;
    color: var(--primary);
    border: 1px solid var(--gray-light);
}

.btn-secondary:hover {
    background: rgba(79, 70, 229, 0.05);
    border-color: var(--primary-light);
}

.btn-success {
    background: var(--success);
}

.btn-success:hover {
    background: #0e9f72;
}

.btn-danger {
    background: var(--danger);
}

.btn-danger:hover {
    background: #dc2626;
}

.btn-disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.upload-section {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.upload-option {
    border: 2px dashed var(--gray-light);
    border-radius: 10px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    background-color: rgba(241, 245, 249, 0.5);
}

.upload-option:hover {
    border-color: var(--primary-light);
    background: rgba(79, 70, 229, 0.03);
}

.upload-option.active {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.05);
}

.upload-icon {
    font-size: 2rem;
    color: var(--primary);
    margin-bottom: 0.75rem;
    opacity: 0.8;
}

.upload-text {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--dark);
}

.upload-subtext {
    color: var(--gray);
    font-size: 0.85rem;
}

#fileInput {
    display: none;
}

.uploaded-files {
    border-top: 1px solid var(--gray-light);
    padding: 1rem 1.5rem;
}

.uploaded-files-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.uploaded-files-title {
    font-weight: 600;
    color: var(--darker);
}

.uploaded-files-count {
    background: var(--gray-lighter);
    color: var(--dark);
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.uploaded-files-list {
    max-height: 300px;
    overflow-y: auto;
    padding-right: 0.5rem;
}

.uploaded-files-list::-webkit-scrollbar {
    width: 6px;
}

.uploaded-files-list::-webkit-scrollbar-track {
    background: var(--gray-lighter);
    border-radius: 3px;
}

.uploaded-files-list::-webkit-scrollbar-thumb {
    background: var(--gray-light);
    border-radius: 3px;
}

.uploaded-files-list::-webkit-scrollbar-thumb:hover {
    background: var(--gray);
}

.image-card {
    display: flex;
    align-items: center;
    padding: 0.8rem;
    border-radius: 8px;
    margin-bottom: 0.5rem;
    background: var(--gray-lighter);
    transition: all 0.2s ease;
}

.image-card:hover {
    background: var(--gray-light);
}

.image-card.selected {
    background: rgba(79, 70, 229, 0.1);
    border: 1px solid var(--primary-light);
}

.image-preview {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
    margin-right: 1rem;
}

.image-info {
    flex: 1;
    min-width: 0;
}

.image-name {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.2rem;
    color: var(--dark);
}

.image-stats {
    display: flex;
    font-size: 0.75rem;
    color: var(--gray);
    gap: 0.8rem;
}

.image-size, .image-dimensions {
    display: flex;
    align-items: center;
    gap: 0.2rem;
}

.remove-btn {
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    padding: 0.2rem;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.remove-btn:hover {
    opacity: 1;
}

.preview-container {
    padding: 1.5rem;
    text-align: center;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.empty-state {
    color: var(--gray);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

#previewImage {
    max-width: 100%;
    max-height: 400px;
    display: none;
    margin-bottom: 1rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
}

.loading {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--gray-light);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--gray-light);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.progress {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 3px;
}

.resize-options {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--gray-light);
}

.resize-options h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--darker);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.resize-options h3 i {
    color: var(--primary);
}

.size-control {
    margin-bottom: 1.5rem;
}

.control-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.control-label {
    font-size: 0.85rem;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.control-value {
    font-weight: 600;
    color: var(--primary);
    background: rgba(79, 70, 229, 0.1);
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.8rem;
}

.dimension-control {
    margin-bottom: 1.5rem;
}

.dimension-control label {
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    color: var(--dark);
    display: block;
}

.dimension-control input {
    padding: 0.5rem;
    border: 1px solid var(--gray-light);
    border-radius: 6px;
    font-size: 0.85rem;
    width: 100%;
    max-width: 200px;
}

.checkbox-control {
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.checkbox-control input {
    width: 16px;
    height: 16px;
}

.checkbox-control label {
    font-size: 0.85rem;
    color: var(--dark);
}

.format-control {
    margin-bottom: 1.5rem;
}

.format-control label {
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    color: var(--dark);
    display: block;
}

.format-control select {
    padding: 0.5rem;
    border: 1px solid var(--gray-light);
    border-radius: 6px;
    font-size: 0.85rem;
    width: 100%;
    max-width: 200px;
}

.format-control select:focus {
    outline: none;
    border-color: var(--primary-light);
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.2);
}

.file-size-control {
    margin-bottom: 1.5rem;
}

.file-size-control label {
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    color: var(--dark);
    display: block;
}

.file-size-input {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.file-size-input input {
    padding: 0.5rem;
    border: 1px solid var(--gray-light);
    border-radius: 6px;
    font-size: 0.85rem;
    width: 100px;
}

.estimated-quality {
    font-size: 0.85rem;
    color: var(--gray);
    margin-top: 0.5rem;
}

.controls {
    display: flex;
    justify-content: space-between;
    gap: 0.8rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--gray-light);
}

.results-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.03);
    margin-bottom: 2rem;
    display: none;
}

.results-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--gray-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.results-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--darker);
}

.results-count {
    background: var(--gray-lighter);
    color: var(--dark);
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}

.results-grid {
    padding: 1.5rem;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.5rem;
}

.result-card {
    background: var(--gray-lighter);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}

.result-image {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
}

.result-info {
    padding: 0.8rem;
}

.result-name {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 0.5rem;
    color: var(--dark);
}

.result-stats {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--gray);
}

.result-original-size {
    text-decoration: line-through;
    color: var(--danger);
}

.result-new-size {
    font-weight: 600;
    color: var(--success);
}

.result-dimensions {
    display: flex;
    gap: 0.5rem;
}

.download-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: var(--primary);
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.result-card:hover .download-btn {
    opacity: 1;
}

.download-btn:hover {
    background: var(--primary-light);
    transform: scale(1.1);
}

.results-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--gray-light);
    display: flex;
    justify-content: flex-end;
    gap: 0.8rem;
}

.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.toast {
    background: var(--dark);
    color: white;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    max-width: 350px;
    position: relative;
    overflow: hidden;
}

.toast::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
}

.toast.success::before {
    background: var(--success);
}

.toast.error::before {
    background: var(--danger);
}

.toast.warning::before {
    background: var(--warning);
}

.toast.info::before {
    background: var(--info);
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast i {
    font-size: 1.2rem;
    margin-top: 2px;
}

.toast.success i {
    color: var(--success);
}

.toast.error i {
    color: var(--danger);
}

.toast.warning i {
    color: var(--warning);
}

.toast.info i {
    color: var(--info);
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    margin-bottom: 0.3rem;
    font-size: 0.95rem;
}

.toast-message {
    font-size: 0.85rem;
    opacity: 0.9;
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    color: white;
    opacity: 0.7;
    cursor: pointer;
    transition: opacity 0.2s ease;
    padding: 0.2rem;
    display: flex;
    font-size: 0.9rem;
}

.toast-close:hover {
    opacity: 1;
}

.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.2);
    width: 100%;
}

.toast-progress-bar {
    height: 100%;
    background: white;
    width: 100%;
    transition: width linear;
}

/* Default image icon styles */
.default-image-icon {
    font-size: 3rem;
    color: var(--gray-light);
    margin-bottom: 1rem;
}

.image-placeholder {
    width: 50px;
    height: 50px;
    background: var(--gray-lighter);
    border-radius: 4px;
    margin-right: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-light);
}
/* Blog Container Styles */
.blog-container {
margin: 3rem auto 0;
padding: 2rem;
max-width: 1200px;
background: var(--white);
border-radius: 12px;
box-shadow: var(--shadow-sm);
border: 1px solid var(--gray-light);
}

.blog-title {
font-size: 1.5rem;
color: var(--darker);
margin-bottom: 2rem;
padding-bottom: 1rem;
border-bottom: 1px solid var(--gray-light);
display: flex;
align-items: center;
gap: 0.75rem;
}

.blog-title i {
color: var(--primary);
}

.blog-posts {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
gap: 1.5rem;
}

.blog-post {
background: var(--gray-lighter);
border-radius: 10px;
overflow: hidden;
transition: all 0.3s ease;
border: 1px solid var(--gray-light);
}

.blog-post:hover {
transform: translateY(-5px);
box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
border-color: var(--primary-light);
}

.post-image {
height: 180px;
overflow: hidden;
display: flex;
align-items: center;
justify-content: center;
background: linear-gradient(135deg, var(--primary), var(--primary-light));
}

.post-image i {
font-size: 3.5rem;
color: white;
opacity: 0.9;
}

.post-content {
padding: 1.5rem;
}

.post-content h3 {
font-size: 1.1rem;
margin-bottom: 0.75rem;
color: var(--darker);
}

.feature-list {
list-style: none;
padding: 0;
margin: 1rem 0 0;
}

.feature-list li {
padding: 0.35rem 0;
display: flex;
align-items: center;
gap: 0.6rem;
font-size: 0.85rem;
color: var(--dark);
}

.feature-list i {
width: 1.1rem;
color: var(--primary);
text-align: center;
}

/* Color variants for different feature cards */
.blog-post:nth-child(1) .post-image {
background: linear-gradient(135deg, #4f46e5, #6366f1);
}
.blog-post:nth-child(2) .post-image {
background: linear-gradient(135deg, #10b981, #34d399);
}
.blog-post:nth-child(3) .post-image {
background: linear-gradient(135deg, #3b82f6, #60a5fa);
}
.blog-post:nth-child(4) .post-image {
background: linear-gradient(135deg, #f59e0b, #fbbf24);
}

/* Responsive adjustments */
@media (max-width: 768px) {
.blog-container {
padding: 1.5rem;
margin-top: 2rem;
}

.blog-posts {
grid-template-columns: 1fr;
gap: 1.2rem;
}

.post-image {
height: 160px;
}
}

@media (max-width: 480px) {
.blog-container {
padding: 1.25rem;
}

.blog-title {
font-size: 1.3rem;
}

.post-content {
padding: 1.25rem;
}
}
