/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

/* Header */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-align: center;
    padding: 2rem 1rem;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.subtitle {
    font-size: 1.1rem;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto;
}

/* Main Content */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

section {
    margin-bottom: 3rem;
}

/* Introduction Section */
.intro-section {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 2rem;
}

.intro-section p {
    font-size: 1.1rem;
    text-align: center;
    color: #555;
}

/* Navigation Menu - Lightweight & Modern */
.main-nav {
    background: white;
    padding: 1rem 2rem;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.08);
    margin-bottom: 2rem;
    border: 1px solid rgba(102, 126, 234, 0.12);
}

.nav-menu {
    list-style: none;
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
}

.nav-item {
    display: inline-block;
}

.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    text-decoration: none;
    color: #6b7280;
    font-weight: 500;
    font-size: 0.95rem;
    border-radius: 12px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    background: transparent;
}

.nav-link:hover {
    color: #667eea;
    background: rgba(102, 126, 234, 0.05);
    transform: translateY(-1px);
}

.nav-link:active {
    transform: translateY(0);
}

.nav-link.active {
    color: white;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.25);
}

.nav-link.active:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
    transform: translateY(-1px);
}

/* Tool Section */
.tool-section {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.tool-section h2 {
    color: #333;
    margin-bottom: 1.5rem;
    font-size: 1.8rem;
}

/* Upload Area */
.upload-area {
    border: 3px dashed #667eea;
    border-radius: 12px;
    padding: 3rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f8f9ff;
}

.upload-area:hover {
    border-color: #5a6fd8;
    background: #f0f3ff;
}

.upload-area.dragover {
    border-color: #4c63d2;
    background: #e8edff;
    transform: scale(1.02);
}

.upload-content {
    pointer-events: none;
}

.upload-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.upload-area p {
    font-size: 1.1rem;
    color: #555;
    margin-bottom: 0.5rem;
}

.upload-formats {
    font-size: 0.9rem;
    color: #888;
}

/* Processing Panel */
.processing-panel {
    margin-top: 2rem;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}

.controls-section h3 {
    color: #333;
    margin-bottom: 1rem;
    font-size: 1.3rem;
}

/* Preset Buttons */
.preset-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.preset-btn {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 1rem 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    font-size: 0.9rem;
    font-weight: 500;
}

.preset-btn:hover {
    border-color: #667eea;
    background: #f0f3ff;
}

.preset-btn.active {
    background: #667eea;
    color: white;
    border-color: #667eea;
}

.preset-btn span {
    display: block;
    font-size: 0.8rem;
    opacity: 0.8;
    margin-top: 0.3rem;
}

/* Form Controls */
.crop-options, .compression-controls {
    margin-bottom: 1.5rem;
}

.crop-options label, .compression-controls label {
    display: block;
    margin-bottom: 0.8rem;
    cursor: pointer;
}

.crop-options input[type="radio"] {
    margin-right: 0.5rem;
}

.padding-options {
    margin-left: 1rem;
    margin-top: 1rem;
}

.color-picker {
    margin-top: 0.5rem;
}

.color-picker input[type="color"] {
    width: 50px;
    height: 30px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

select, input[type="range"] {
    width: 100%;
    margin-top: 0.5rem;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

input[type="range"] {
    height: 8px;
    background: #ddd;
    outline: none;
    padding: 0;
}

input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    background: #667eea;
    border-radius: 50%;
    cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: #667eea;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

/* Preview Section */
.preview-container {
    text-align: center;
}

.preview-container h3 {
    margin-bottom: 1rem;
    color: #333;
}

#previewCanvas {
    max-width: 100%;
    max-height: 400px;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.preview-info {
    margin: 1rem 0;
    font-size: 0.9rem;
    color: #666;
}

.preview-info p {
    margin-bottom: 0.3rem;
}

.download-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    margin-top: 1rem;
}

.download-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.download-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Info Section */
.info-section {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.info-section h2 {
    color: #333;
    margin-bottom: 1rem;
    font-size: 1.6rem;
}

.info-section article {
    margin-bottom: 2.5rem;
}

.info-section article:last-child {
    margin-bottom: 0;
}

.info-section p {
    color: #555;
    margin-bottom: 1rem;
    line-height: 1.7;
}

.info-section ul {
    margin-left: 1.5rem;
    color: #555;
}

.info-section li {
    margin-bottom: 0.8rem;
    line-height: 1.6;
}

.info-section strong {
    color: #333;
}

/* Footer */
footer {
    background: #333;
    color: white;
    text-align: center;
    padding: 1.5rem;
    margin-top: 3rem;
}

footer a {
    color: #667eea;
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Responsive Design */
@media (max-width: 768px) {
    header h1 {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    main {
        padding: 1rem;
    }
    
    .processing-panel {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .preset-buttons {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .tool-section, .intro-section, .info-section {
        padding: 1.5rem;
    }
    
    .upload-area {
        padding: 2rem 1rem;
    }
    
    .upload-icon {
        font-size: 2.5rem;
    }
}

@media (max-width: 480px) {
    header {
        padding: 1.5rem 1rem;
    }
    
    header h1 {
        font-size: 1.8rem;
    }
    
    .preset-buttons {
        grid-template-columns: 1fr;
    }
    
    .preset-btn {
        padding: 0.8rem;
    }
    
    .tool-section, .intro-section, .info-section {
        padding: 1rem;
    }
}

/* Loading and transitions */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

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

/* Blog Styles */
.blog-intro {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 3rem;
}

.blog-hero h2 {
    color: #333;
    font-size: 2rem;
    margin-bottom: 1rem;
    text-align: center;
}

.blog-hero p {
    font-size: 1.1rem;
    color: #555;
    text-align: center;
    line-height: 1.7;
    max-width: 800px;
    margin: 0 auto;
}

.blog-posts {
    margin-bottom: 3rem;
}

.blog-posts h2 {
    color: #333;
    font-size: 1.8rem;
    margin-bottom: 2rem;
    text-align: center;
}

.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.blog-card {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border-top: 4px solid #667eea;
}

.blog-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

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

.blog-tag {
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.blog-tag.instagram {
    background: linear-gradient(45deg, #833ab4, #fd1d1d, #fcb045);
    color: white;
}

.blog-tag.youtube {
    background: #ff0000;
    color: white;
}

.blog-date {
    color: #888;
    font-size: 0.9rem;
}

.blog-card h3 {
    margin-bottom: 1rem;
    line-height: 1.4;
}

.blog-card h3 a {
    color: #333;
    text-decoration: none;
    font-size: 1.3rem;
    font-weight: 600;
}

.blog-card h3 a:hover {
    color: #667eea;
}

.blog-excerpt {
    color: #666;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.blog-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

.read-time {
    color: #888;
    font-size: 0.9rem;
}

.blog-difficulty {
    background: #f0f3ff;
    color: #667eea;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

.read-more {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    transition: color 0.3s ease;
}

.read-more:hover {
    color: #5a6fd8;
}

.blog-cta {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 3rem 2rem;
    border-radius: 12px;
    text-align: center;
    margin: 3rem 0;
}

.cta-content h2 {
    font-size: 1.8rem;
    margin-bottom: 1rem;
}

.cta-content p {
    font-size: 1.1rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

.cta-button {
    display: inline-block;
    background: white;
    color: #667eea;
    padding: 1rem 2rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
    transition: all 0.3s ease;
}

.cta-button:hover {
    background: #f8f9ff;
    transform: translateY(-2px);
}

.blog-topics h2 {
    color: #333;
    font-size: 1.8rem;
    margin-bottom: 2rem;
    text-align: center;
}

.topics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.topic-item {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    text-align: center;
    transition: transform 0.3s ease;
}

.topic-item:hover {
    transform: translateY(-3px);
}

.topic-item h3 {
    color: #333;
    font-size: 1.1rem;
    margin-bottom: 0.8rem;
}

.topic-item p {
    color: #666;
    font-size: 0.95rem;
    line-height: 1.5;
}

/* Blog Post Content Styles - Optimized Typography */
.blog-content {
    background: white;
    padding: 3rem 2.5rem;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    border: 1px solid rgba(0,0,0,0.05);
    max-width: 820px;
    margin: 0 auto 2rem auto;
    line-height: 1.8;
    font-size: 16px;
}

/* Typography Hierarchy */
.blog-content h1 {
    color: #1f2937;
    font-size: 2.25rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    line-height: 1.2;
    letter-spacing: -0.025em;
}

.blog-content h2 {
    color: #1f2937;
    font-size: 1.75rem;
    font-weight: 600;
    margin-top: 3rem;
    margin-bottom: 1.25rem;
    border-bottom: 3px solid #667eea;
    padding-bottom: 0.75rem;
    position: relative;
}

.blog-content h2::before {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 60px;
    height: 3px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.blog-content h3 {
    color: #374151;
    font-size: 1.375rem;
    font-weight: 600;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    position: relative;
    padding-left: 1rem;
}

.blog-content h3::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.5rem;
    width: 4px;
    height: 1.5rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 2px;
}

.blog-content h4 {
    color: #4b5563;
    font-size: 1.125rem;
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: 0.75rem;
}

/* Improved Text Styles */
.blog-content p {
    color: #4b5563;
    margin-bottom: 1.5rem;
    font-size: 1.0625rem;
    line-height: 1.8;
}

.blog-content ul, .blog-content ol {
    margin-bottom: 1.75rem;
    padding-left: 1.75rem;
}

.blog-content li {
    color: #4b5563;
    margin-bottom: 0.75rem;
    font-size: 1.0625rem;
    line-height: 1.7;
}

.blog-content li strong {
    color: #1f2937;
    font-weight: 600;
}

.blog-content blockquote {
    background: linear-gradient(135deg, #f8f9ff 0%, #f1f5ff 100%);
    border-left: 5px solid #667eea;
    padding: 1.5rem 2rem;
    margin: 2.5rem 0;
    font-style: italic;
    color: #4b5563;
    border-radius: 0 8px 8px 0;
    position: relative;
}

.blog-content blockquote::before {
    content: '"';
    font-size: 4rem;
    color: #667eea;
    position: absolute;
    top: -0.5rem;
    left: 1rem;
    opacity: 0.3;
    font-family: Georgia, serif;
}

.blog-content .highlight-box {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08) 0%, rgba(118, 75, 162, 0.12) 100%);
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 12px;
    padding: 2rem;
    margin: 2.5rem 0;
    position: relative;
}

.blog-content .highlight-box::before {
    content: '💡';
    position: absolute;
    top: -0.75rem;
    left: 1.5rem;
    background: white;
    padding: 0.25rem 0.5rem;
    border-radius: 50%;
    font-size: 1.25rem;
}

/* Blog Navigation - Improved Styling */
.blog-navigation {
    background: white;
    padding: 1.5rem 2rem;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    border: 1px solid rgba(0,0,0,0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 820px;
    margin: 2rem auto;
    gap: 1rem;
}

.blog-nav-link {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.blog-nav-link:hover {
    color: #5a6fd8;
    background: rgba(102, 126, 234, 0.05);
    border-color: rgba(102, 126, 234, 0.2);
    transform: translateY(-1px);
}

/* Accessibility & Focus States */
.nav-link:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.2);
}

.blog-nav-link:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.2);
}

/* Improved Link Contrast */
.nav-link {
    color: #4b5563; /* Better contrast ratio */
}

.nav-link:hover {
    color: #4338ca; /* Darker shade for better contrast */
    background: rgba(67, 56, 202, 0.08);
}

.blog-nav-link {
    color: #4338ca; /* Better contrast */
}

.blog-nav-link:hover {
    color: #3730a3; /* Even better contrast on hover */
}

/* Mobile-First Responsive Styles */
@media (max-width: 768px) {
    .main-nav {
        padding: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .nav-menu {
        gap: 0.25rem;
        flex-wrap: wrap;
    }
    
    .nav-link {
        font-size: 0.9rem;
        padding: 0.6rem 1rem;
    }
    
    .blog-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .topics-grid {
        grid-template-columns: 1fr;
    }
    
    .blog-content {
        padding: 2rem 1.25rem;
        border-radius: 12px;
        font-size: 15px;
    }
    
    .blog-content h1 {
        font-size: 1.875rem;
        line-height: 1.25;
    }
    
    .blog-content h2 {
        font-size: 1.5rem;
        margin-top: 2.5rem;
    }
    
    .blog-content h3 {
        font-size: 1.25rem;
    }
    
    .blog-content p {
        font-size: 1rem;
        line-height: 1.75;
    }
    
    .blog-content li {
        font-size: 1rem;
    }
    
    .blog-content .highlight-box {
        padding: 1.5rem;
        margin: 2rem 0;
    }
    
    .blog-content blockquote {
        padding: 1.25rem 1.5rem;
        margin: 2rem 0;
    }
    
    .blog-navigation {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
        padding: 1.25rem;
    }
    
    .blog-cta {
        padding: 2rem 1.25rem;
    }
    
    .cta-content h2 {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .blog-content {
        padding: 1.5rem 1rem;
    }
    
    .blog-content h1 {
        font-size: 1.625rem;
    }
    
    .blog-content h2 {
        font-size: 1.375rem;
    }
    
    .nav-menu {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .nav-link {
        width: 100%;
        text-align: center;
        justify-content: center;
    }
}