* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    color: #1e293b;
    background: #f9fafb;
    overflow-x: hidden;
}

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Navigation */
.navbar {
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    width: 100%;
    z-index: 1000;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 0;
}

.nav-logo {
    display: flex;
    align-items: center;
    font-size: 1.75rem;
    font-weight: 700;
    color: #2563eb;
    text-decoration: none;
    transition: color 0.3s ease;
}

.nav-logo:hover {
    color: #1e40af;
}

.nav-logo i {
    margin-right: 0.75rem;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-menu.show {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    padding: 1rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.nav-item {
    position: relative;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.25rem;
    text-decoration: none;
    color: #475569;
    background: none;
    border: none;
    cursor: pointer;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.nav-link:hover {
    background: #f0f5ff;
    color: #2563eb;
}

.nav-link i {
    margin-right: 0.75rem;
}

.dropdown-toggle::after {
    content: '\f078';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    margin-left: 0.5rem;
    font-size: 0.75rem;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
    min-width: 220px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.3s ease;
    padding: 0.75rem 0;
    z-index: 1001;
    border: 1px solid #f1f5f9;
}

.dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    padding: 0.5rem;
}

.dropdown-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.25rem;
    text-decoration: none;
    color: #475569;
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.dropdown-item:hover {
    background: #f0f5ff;
    color: #2563eb;
}

.dropdown-item i {
    margin-right: 0.75rem;
    width: 18px;
}

.mobile-menu-toggle {
    display: none;
    font-size: 1.75rem;
    cursor: pointer;
    color: #475569;
    background: none;
    border: none;
}

/* Hero Section */
.hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    background: linear-gradient(145deg, #4f46e5 0%, #7c3aed 100%);
    overflow: hidden;
}

.hero-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000"><defs><pattern id="grid" width="60" height="60" patternUnits="userSpaceOnUse"><path d="M 60 0 L 0 0 0 60" fill="none" stroke="rgba(255,255,255,0.12)" stroke-width="1"/></pattern></defs><rect width="100%" height="100%" fill="url(%23grid)"/></svg>');
    opacity: 0.25;
    animation: subtleMove 20s linear infinite;
}

@keyframes subtleMove {
    0% { transform: translate(0, 0); }
    100% { transform: translate(-60px, -60px); }
}

.hero-content {
    position: relative;
    text-align: center;
    color: white;
    z-index: 2;
}

.hero-title {
    font-size: 4rem;
    font-weight: 800;
    margin-bottom: 1.25rem;
    background: linear-gradient(45deg, #ffffff, #dbeafe);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.2;
}

.hero-subtitle {
    font-size: 1.25rem;
    margin-bottom: 2.5rem;
    opacity: 0.9;
    max-width: 650px;
    margin-left: auto;
    margin-right: auto;
    font-weight: 400;
}

.hero-buttons {
    display: flex;
    gap: 1.25rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    padding: 0.875rem 2rem;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
}

.btn::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.2);
    transition: left 0.3s ease;
}

.btn:hover::after {
    left: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, #2563eb, #1e40af);
    color: white;
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(37, 99, 235, 0.6);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(12px);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-3px);
}

.btn-success {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
    box-shadow: 0 6px 20px rgba(34, 197, 94, 0.4);
}

.btn-success:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(34, 197, 94, 0.6);
}

.btn-ghost {
    background: transparent;
    color: #475569;
    border: 1px solid #e5e7eb;
}

.btn-ghost:hover {
    background: #f0f5ff;
    color: #2563eb;
}

/* Tools Section */
.tools-section {
    padding: 6rem 0;
    background: white;
}

.section-title {
    text-align: center;
    font-size: 2.75rem;
    font-weight: 800;
    margin-bottom: 3.5rem;
    color: #1e293b;
    position: relative;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -1rem;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background: linear-gradient(90deg, #2563eb, #4f46e5);
    border-radius: 2px;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
}

.tool-card {
    background: white;
    border-radius: 20px;
    padding: 2.5rem;
    text-align: center;
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.08);
    border: 1px solid #f3f4f6;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tool-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
    border-color: #2563eb;
}

.tool-icon {
    width: 90px;
    height: 90px;
    margin: 0 auto 2rem;
    background: linear-gradient(135deg, #2563eb, #1e40af);
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2.25rem;
    transition: transform 0.3s ease;
}

.tool-card:hover .tool-icon {
    transform: rotate(8deg) scale(1.1);
}

.tool-card h3 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    color: #1e293b;
}

.tool-card p {
    color: #64748b;
    font-size: 1rem;
}

/* Tool Interface */
.tool-interface {
    background: #f9fafb;
    padding: 3rem 0;
}

.tool-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2.5rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid #e5e7eb;
}

.tool-header h2 {
    font-size: 2.25rem;
    color: #1e293b;
    font-weight: 700;
}

/* Upload Area */
.upload-area {
    border: 2px dashed #d1d5db;
    border-radius: 20px;
    padding: 4rem 2rem;
    text-align: center;
    background: white;
    transition: all 0.3s ease;
    margin-bottom: 2.5rem;
}

.upload-area.dragover {
    border-color: #2563eb;
    background: #eff6ff;
    transform: scale(1.02);
}

.upload-content {
    max-width: 450px;
    margin: 0 auto;
}

.upload-icon {
    font-size: 4.5rem;
    color: #d1d5db;
    margin-bottom: 1.25rem;
    transition: transform 0.3s ease;
}

.upload-area:hover .upload-icon {
    transform: translateY(-5px);
}

.upload-area h3 {
    font-size: 1.75rem;
    margin-bottom: 0.75rem;
    color: #1e293b;
}

.upload-area p {
    color: #64748b;
    margin-bottom: 2rem;
    font-size: 1rem;
}

/* Tool Controls */
.tool-controls {
    background: white;
    border-radius: 20px;
    padding: 2.5rem;
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.08);
    margin-bottom: 2.5rem;
}

.control-group {
    margin-bottom: 2.5rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid #f3f4f6;
}

.control-group:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.control-group h4 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    color: #1e293b;
}

.controls-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    align-items: end;
}

.control-item {
    display: flex;
    flex-direction: column;
}

.control-item label {
    margin-bottom: 0.75rem;
    font-weight: 600;
    color: #374151;
    font-size: 0.95rem;
}

.control-item input,
.control-item select {
    padding: 0.875rem;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
}

.control-item input:focus,
.control-item select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.control-item input[type="checkbox"] {
    width: auto;
    margin-right: 0.75rem;
}

.control-item input[type="range"] {
    -webkit-appearance: none;
    height: 10px;
    background: #e5e7eb;
    border-radius: 5px;
    outline: none;
}

.control-item input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    background: #2563eb;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.preset-sizes {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 1.25rem;
}

.preset-btn {
    padding: 0.625rem 1.25rem;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.95rem;
    font-weight: 500;
}

.preset-btn:hover {
    background: #2563eb;
    color: white;
    border-color: #2563eb;
    transform: translateY(-2px);
}

.action-buttons {
    display: flex;
    gap: 1.25rem;
    justify-content: center;
    margin-top: 2.5rem;
}

/* Preview Area */
.preview-area {
    background: white;
    border-radius: 20px;
    padding: 2.5rem;
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.08);
}

.preview-area h4 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: #1e293b;
}

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

.preview-item {
    background: #f9fafb;
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
    transition: transform 0.3s ease;
}

.preview-item:hover {
    transform: translateY(-5px);
}

.preview-item img {
    max-width: 100%;
    max-height: 220px;
    border-radius: 12px;
    margin-bottom: 1.25rem;
    object-fit: contain;
}

.preview-item .file-info {
    font-size: 0.95rem;
    color: #64748b;
    margin-bottom: 1.25rem;
}

.preview-item .download-btn {
    width: 100%;
}

.download-section {
    text-align: center;
    padding-top: 1.5rem;
    border-top: 1px solid #e5e7eb;
}

/* Features Section */
.features-section {
    padding: 6rem 0;
    background: #f9fafb;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.feature-card {
    background: white;
    border-radius: 20px;
    padding: 2.5rem;
    text-align: center;
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-8px);
}

.feature-icon {
    width: 70px;
    height: 70px;
    margin: 0 auto 2rem;
    background: linear-gradient(135deg, #22c55e, #16a34a);
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.75rem;
}

.feature-card h3 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    color: #1e293b;
}

.feature-card p {
    color: #64748b;
    font-size: 1rem;
}

/* Footer */
.footer {
    background: #1e293b;
    color: white;
    padding: 4rem 0 2rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2.5rem;
    margin-bottom: 3rem;
}

.footer-section h4 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

.footer-logo {
    display: flex;
    align-items: center;
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: #2563eb;
    text-decoration: none;
}

.footer-logo i {
    margin-right: 0.75rem;
}

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

.footer-section ul li {
    margin-bottom: 0.75rem;
}

.footer-section ul li a {
    color: #94a3b8;
    text-decoration: none;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.footer-section ul li a:hover {
    color: #2563eb;
}

.footer-bottom {
    text-align: center;
    padding-top: 2.5rem;
    border-top: 1px solid #334155;
}

.footer-bottom p {
    color: #94a3b8;
    font-size: 0.95rem;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.loading-overlay.show {
    opacity: 1;
    visibility: visible;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 5px solid rgba(37, 99, 235, 0.3);
    border-top: 5px solid #2563eb;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 1.25rem;
}

.loading-overlay p {
    color: white;
    font-size: 1.25rem;
    font-weight: 500;
}

/* Crop Canvas */
.crop-canvas-container {
    position: relative;
    display: inline-block;
    margin: 1.5rem 0;
    max-width: 100%;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.crop-canvas {
    max-width: 100%;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
}

.crop-overlay {
    position: absolute;
    border: 2px solid #2563eb;
    background: rgba(37, 99, 235, 0.15);
    cursor: move;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.3);
}

.crop-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: #2563eb;
    border: 2px solid white;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.crop-handle.nw { top: -6px; left: -6px; cursor: nw-resize; }
.crop-handle.ne { top: -6px; right: -6px; cursor: ne-resize; }
.crop-handle.sw { bottom: -6px; left: -6px; cursor: sw-resize; }
.crop-handle.se { bottom: -6px; right: -6px; cursor: se-resize; }

/* Responsive Design */
@media (max-width: 1024px) {
    .hero-title {
        font-size: 3.25rem;
    }

    .tools-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }
}

@media (max-width: 768px) {
    .nav-menu {
        display: none;
    }
    
    .mobile-menu-toggle {
        display: block;
    }
    
    .hero-title {
        font-size: 2.75rem;
    }
    
    .hero-subtitle {
        font-size: 1.1rem;
    }
    
    .hero-buttons {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }
    
    .tools-grid {
        grid-template-columns: 1fr;
    }
    
    .controls-row {
        grid-template-columns: 1fr;
    }
    
    .action-buttons {
        flex-direction: column;
        gap: 1rem;
    }
    
    .preview-grid {
        grid-template-columns: 1fr;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 16px;
    }
    
    .nav-container {
        padding: 1rem 0;
    }
    
    .hero-title {
        font-size: 2.25rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    .tool-controls,
    .upload-area,
    .preview-area {
        padding: 1.75rem;
    }
    
    .upload-area {
        padding: 2.5rem 1.25rem;
    }
    
    .upload-icon {
        font-size: 3.5rem;
    }
    
    .section-title {
        font-size: 2.25rem;
    }
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
    body {
        background: #0f172a;
        color: #f1f5f9;
    }
    
    .navbar {
        background: rgba(15, 23, 42, 0.96);
        border-bottom-color: rgba(255, 255, 255, 0.1);
    }
    
    .nav-link {
        color: #94a3b8;
    }
    
    .nav-link:hover {
        background: #1e293b;
        color: #3b82f6;
    }
    
    .dropdown-menu {
        background: #1e293b;
        border-color: #334155;
    }
    
    .dropdown-item {
        color: #94a3b8;
    }
    
    .dropdown-item:hover {
        background: #334155;
        color: #3b82f6;
    }
    
    .tools-section,
    .tool-controls,
    .preview-area {
        background: #1e293b;
    }
    
    .tool-card,
    .feature-card,
    .upload-area {
        background: #1e293b;
        border-color: #334155;
    }
    
    .upload-area.dragover {
        background: #334155;
    }
    
    .control-item input,
    .control-item select {
        background: #0f172a;
        border-color: #475569;
        color: #f1f5f9;
    }
    
    .preset-btn {
        background: #0f172a;
        border-color: #475569;
        color: #f1f5f9;
    }
    
    .preview-item {
        background: #0f172a;
    }
    
    .features-section,
    .tool-interface {
        background: #0f172a;
    }
    
    .tool-card h3,
    .feature-card h3,
    .control-group h4,
    .preview-area h4 {
        color: #f1f5f9;
    }
}

/* Animations */
.fade-in {
    animation: fadeIn 0.6s ease-in;
}

.slide-up {
    animation: slideUp 0.6s ease-out;
}

.scale-in {
    animation: scaleIn 0.4s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.85);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Utility Classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-5 { margin-top: 1.25rem; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-5 { margin-bottom: 1.25rem; }

.hidden { display: none !important; }
.visible { display: block !important; }

.w-full { width: 100%; }
.h-full { height: 100%; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }

.rounded { border-radius: 0.5rem; }
.rounded-lg { border-radius: 0.75rem; }
.rounded-xl { border-radius: 1rem; }

.shadow { box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); }
.shadow-lg { box-shadow: 0 10px 20px rgba(0, 0, 0, 0.12); }
.shadow-xl { box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15); }