/* iLoveIMG Design - Desktop Grid Version */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f8f9fa;
    color: #333;
    line-height: 1.5;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.side-menu {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100vh;
    background: white;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    transition: left 0.3s ease;
    z-index: 1000;
}

.side-menu.active {
    left: 0;
}

.side-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid #e0e0e0;
}

.close-menu {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    color: #666;
}

.side-menu-nav {
    display: flex;
    flex-direction: column;
}

.menu-item {
    padding: 16px 20px;
    text-decoration: none;
    color: #333;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
}

.menu-item:hover {
    background: #f5f5f5;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: white;
    border-bottom: 1px solid #e0e0e0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.menu-btn, .grid-btn {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #333;
    border-radius: 50%;
    transition: background 0.2s;
}

.menu-btn:hover, .grid-btn:hover {
    background: #f0f0f0;
}

.logo {
    display: flex;
    align-items: center;
    font-size: 24px;
    font-weight: 700;
}

.logo-text {
    color: #000;
}

.logo-heart {
    margin: 0 2px;
    font-size: 22px;
}

.hero {
    text-align: center;
    padding: 40px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.hero h1 {
    font-size: 28px;
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 12px;
}

.hero .subtitle {
    font-size: 16px;
    opacity: 0.95;
}

.category-nav {
    display: flex;
    gap: 8px;
    padding: 16px;
    overflow-x: auto;
    background: white;
    border-bottom: 1px solid #e0e0e0;
    scrollbar-width: none;
}

.category-nav::-webkit-scrollbar {
    display: none;
}

.category-btn {
    padding: 8px 20px;
    border-radius: 20px;
    border: 1px solid #ddd;
    background: white;
    color: #666;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.category-btn.active {
    background: #333;
    color: white;
    border-color: #333;
}

.category-btn:not(.active):hover {
    background: #f5f5f5;
}

/* DESKTOP GRID LAYOUT - MAIN CHANGE */
.tools-container {
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
    flex: 1;
}

.tool-card {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 20px;
    background: white;
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: all 0.2s;
    height: 100%;
}

.tool-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

.tool-icon {
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
}

.tool-info {
    flex: 1;
    min-width: 0;
}

.tool-info h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 6px;
    color: #333;
}

.tool-info p {
    font-size: 13px;
    color: #666;
    line-height: 1.5;
}

/* Footer Styles */
.footer {
    background: #2c3e50;
    color: white;
    padding: 50px 20px 20px;
    margin-top: 60px;
}

.footer-content {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 40px;
    margin-bottom: 40px;
}

.footer-section h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: #ecf0f1;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 10px;
}

.footer-section ul li a {
    color: #bdc3c7;
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
}

.footer-section ul li a:hover {
    color: white;
}

.footer-bottom {
    max-width: 1400px;
    margin: 0 auto;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.footer-bottom p {
    color: #95a5a6;
    font-size: 14px;
}

.social-links {
    display: flex;
    gap: 16px;
}

.social-links a {
    color: #bdc3c7;
    text-decoration: none;
    font-size: 18px;
    transition: color 0.2s;
}

.social-links a:hover {
    color: white;
}

/* RESPONSIVE - Mobile First, then Desktop Grid */
@media (max-width: 767px) {
    .tools-container {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .hero h1 {
        font-size: 24px;
    }

    .footer-content {
        grid-template-columns: repeat(2, 1fr);
        gap: 30px;
    }

    .footer-bottom {
        flex-direction: column;
        text-align: center;
    }
}

/* Tablet - 2 columns */
@media (min-width: 768px) and (max-width: 1199px) {
    .tools-container {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }

    .hero h1 {
        font-size: 32px;
    }

    .hero {
        padding: 50px 20px;
    }
}

/* Desktop - 3 COLUMNS GRID LIKE IMAGE */
@media (min-width: 1200px) {
    .tools-container {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 24px;
        padding: 32px;
    }

    .hero h1 {
        font-size: 36px;
    }

    .hero {
        padding: 60px 20px;
    }
}

/* Tool Page Styles (for premium tools) */
.tool-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px 20px;
    text-align: center;
}

.tool-header h1 {
    font-size: 28px;
    margin-bottom: 12px;
}

.tool-header p {
    font-size: 16px;
    opacity: 0.9;
}

.tool-section {
    max-width: 800px;
    margin: 40px auto;
    padding: 0 20px;
    flex: 1;
}

.upload-area {
    background: white;
    border: 3px dashed #667eea;
    border-radius: 16px;
    padding: 60px 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.upload-area:hover {
    background: #f8f5ff;
    border-color: #764ba2;
}

.upload-area.dragover {
    background: #f0e8ff;
    transform: scale(1.02);
}

.upload-icon {
    margin-bottom: 20px;
    display: flex;
    justify-content: center;
}

.upload-area h2 {
    color: #667eea;
    margin-bottom: 10px;
    font-size: 20px;
}

.upload-area p {
    color: #666;
    margin-bottom: 20px;
}

.btn {
    display: inline-block;
    padding: 14px 32px;
    background: #667eea;
    color: white;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.3s;
    text-decoration: none;
}

.btn:hover {
    background: #764ba2;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

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

#file-input {
    display: none;
}

.preview-section {
    display: none;
    margin-top: 40px;
}

.preview-section.active {
    display: block;
}

.image-preview {
    max-width: 100%;
    border-radius: 12px;
    margin: 20px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.actions {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: 30px;
    flex-wrap: wrap;
}

.loading {
    display: none;
    text-align: center;
    padding: 20px;
    color: #667eea;
}

.loading.active {
    display: block;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.controls {
    background: white;
    padding: 20px;
    border-radius: 12px;
    margin-top: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.control-group {
    margin-bottom: 15px;
}

.control-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
    color: #333;
}

.control-group input,
.control-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

@media (max-width: 767px) {
    .upload-area {
        padding: 40px 20px;
    }

    .actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
    }

    .tool-header h1 {
        font-size: 24px;
    }
}


/* Additional CSS for Rotate Tool Controls */
/* Add this to your main.css file OR create a separate rotate.css */

.controls {
    max-width: 800px;
    margin: 30px auto;
    background: #fff;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.controls-header {
    margin-bottom: 25px;
    text-align: center;
}

.controls-header h3 {
    font-size: 20px;
    color: #333;
    margin-bottom: 8px;
}

.controls-header p {
    color: #666;
    font-size: 14px;
}

.controls-header strong {
    color: #667eea;
    font-size: 18px;
}

.control-group {
    margin-bottom: 25px;
}

.control-group label {
    display: block;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
    font-size: 14px;
}

.button-row {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn-control {
    flex: 1;
    min-width: 140px;
    padding: 12px 20px;
    background: #f0f4ff;
    border: 2px solid #e0e7ff;
    border-radius: 8px;
    color: #333;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
}

.btn-control:hover {
    background: #667eea;
    border-color: #667eea;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-control svg {
    width: 20px;
    height: 20px;
}

.btn-reset {
    width: 100%;
    background: #fff3cd;
    border-color: #ffc107;
    color: #856404;
}

.btn-reset:hover {
    background: #ffc107;
    border-color: #ffc107;
    color: #fff;
}

.slider {
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: #e0e7ff;
    outline: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #667eea;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.canvas-container {
    text-align: center;
    margin: 20px 0;
    background: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .controls {
        padding: 20px;
        margin: 20px 15px;
    }

    .button-row {
        flex-direction: column;
    }

    .btn-control {
        width: 100%;
        min-width: auto;
    }
}
