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

:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #ec4899;
    --background: #0f172a;
    --surface: #1e293b;
    --surface-light: #334155;
    --text: #f8fafc;
    --text-muted: #94a3b8;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    --gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-2: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --gradient-3: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--background);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

.bg-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.bg-animation::before {
    content: '';
    position: absolute;
    width: 150%;
    height: 150%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, transparent 60%),
        radial-gradient(circle at 80% 20%, rgba(236, 72, 153, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 20% 80%, rgba(56, 189, 248, 0.15) 0%, transparent 50%);
    animation: float 20s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0) rotate(0deg);
    }

    33% {
        transform: translate(30px, -30px) rotate(120deg);
    }

    66% {
        transform: translate(-20px, 20px) rotate(240deg);
    }
}

header {
    padding: 2rem;
    text-align: center;
    position: relative;
}

.logo {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, #fff 0%, #a5b4fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.logo-icon {
    width: 48px;
    height: 48px;
    background: var(--gradient-1);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    -webkit-text-fill-color: white;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem 4rem;
}

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

.tool-card {
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 2rem;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.tool-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-1);
    transform: scaleX(0);
    transition: transform 0.4s ease;
}

.tool-card:hover {
    transform: translateY(-5px);
    border-color: rgba(99, 102, 241, 0.5);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.tool-card:hover::before {
    transform: scaleX(1);
}

.tool-card.image-converter::before {
    background: var(--gradient-2);
}

.tool-card.pdf-creator::before {
    background: var(--gradient-3);
}

.tool-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.tool-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-left: 15px;
    font-size: 1.75rem;
    background: var(--gradient-1);
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.3);
}

.image-converter .tool-icon {
    background: var(--gradient-2);
    box-shadow: 0 10px 20px rgba(236, 72, 153, 0.3);
}

.pdf-creator .tool-icon {
    background: var(--gradient-3);
    box-shadow: 0 10px 20px rgba(56, 189, 248, 0.3);
}

.tool-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.tool-description {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.upload-zone {
    border: 2px dashed var(--surface-light);
    border-radius: 16px;
    padding: 2.5rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    background: rgba(15, 23, 42, 0.5);
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
    transform: scale(1.02);
}

.upload-zone input {
    display: none;
}

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

.upload-next {
    font-size: 1.1rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.upload-hint {
    font-size: 0.85rem;
    color: var(--text-muted);
    opacity: 0.7;
}

.file-preview {
    margin-top: 1.5rem;
    display: none;
}

.file-preview.active {
    display: block;
    animation: slideIn 0.3s ease;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.preview-item {
    background: var(--surface);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
    border: 1px solid var(--surface-light);
    transition: all 0.3s ease;
}

.preview-item:hover {
    border-color: var(--primary);
    transform: translateX(5px);
}

.preview-thumb {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    object-fit: cover;
    background: var(--surface-light);
}

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

.preview-name {
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preview-size {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.preview-remove {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: rgba(239, 68, 68, 0.2);
    color: var(--error);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.preview-remove:hover {
    background: var(--error);
    color: white;
    transform: rotate(90deg);
}

.controls {
    margin-top: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.format-selector {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.format-btn {
    padding: 0.5rem 1rem;
    border: 2px solid var(--surface-light);
    background: transparent;
    color: var(--text);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.format-btn:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.format-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.quality-control {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--surface);
    border-radius: 12px;
}

.quality-control label {
    font-size: 0.9rem;
    color: var(--text-muted);
    min-width: 60px;
}

.slider-container {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 1rem;
}

input[type="range"] {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: var(--surface-light);
    outline: none;
    -webkit-appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: var(--primary);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.4);
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    background: var(--primary-dark);
}

.quality-value {
    min-width: 45px;
    text-align: center;
    font-weight: 700;
    color: var(--primary);
}

.action-btn {
    width: 100%;
    padding: 1rem;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
}

.action-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--gradient-1);
    color: white;
    box-shadow: 0 4px 15px rgba(19, 102, 241, 0.4);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.6);
}

.btn-secondary {
    background: var(--gradient-2);
    color: white;
    box-shadow: 0 4px 15px rgba(236, 72, 153, 0.4);
}

.btn-secondary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(236, 72, 153, 0.6);
}

.btn-tertiary {
    background: var(--gradient-3);
    color: white;
    box-shadow: 0 4px 15px rgba(56, 189, 248, 0.4);
}

.btn-tertiary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(56, 189, 248, 0.4);
}

.action-btn.processing {
    pointer-events: none;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.progress-container {
    display: none;
    margin-top: 1rem;
}

.progress-container.active {
    display: block;
}

.progress-bar {
    height: 8px;
    background: var(--surface-light);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-1);
    border-radius: 4px;
    transition: width 0.3s ease;
    position: relative;
    overflow: hidden;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

.progress-text {
    text-align: center;
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.results {
    margin-top: 1.5rem;
    display: none;
}

.results.active {
    display: block;
    animation: slideIn 0.3s ease;
}

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

.result-item {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--surface-light);
    transition: all 0.3s ease;
    aspect-ratio: 1;
}

.result-item:hover {
    transform: scale(1.05);
    border-color: var(--success);
}

.result-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.result-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.5rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    font-size: 0.75rem;
    text-align: center;
}

.download-all-btn {
    width: 100%;
    padding: 0.875rem;
    background: var(--success);
    color: white;
    border: none;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.download-all-btn:hover {
    background: #059669;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

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

.feature-card {
    text-align: center;
    padding: 2rem;
    background: rgba(30, 41, 59, 0.5);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
}

.feature-card:hover {
    background: rgba(30, 41, 59, 0.8);
    transform: translateY(-5px);
    border-color: rgba(99, 102, 241, 0.3);
}

.feature-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
    background: var(--surface);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    border: 1px solid var(--surface-light);
}

.feature-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.feature-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.5;
}

.toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toast {
    background: var(--surface);
    border: 1px solid var(--surface-light);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    animation: slideInRight 0.3s ease;
    min-width: 300px;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast.success {
    border-left: 4px solid var(--success);
}

.toast.error {
    border-left: 4px solid var(--error);
}

.toast.info {
    border-left: 4px solid var(--primary);
}

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

    .logo {
        font-size: 1.75rem;
    }

    .subtitle {
        font-size: 1rem;
    }
}

/* Utility */
.hidden {
    display: none !important;
}

.fade-in {
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}