:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #ec4899;
    --accent: #06b6d4;
    --bg-dark: #0f172a;
    --bg-card: #1e293b;
    --bg-card-hover: #273548;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    --gradient-1: linear-gradient(135deg, #6366f1, #ec4899);
    --gradient-2: linear-gradient(135deg, #06b6d4, #6366f1);
    --gradient-3: linear-gradient(135deg, #ec4899, #f59e0b);
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.4);
}

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

html {
    overflow-x: hidden;
    width: 100%;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
}

/* Navbar */
.navbar {
    background: rgba(15, 23, 42, 0.85) !important;
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(99, 102, 241, 0.15);
    padding: 0.8rem 0;
    transition: all 0.3s ease;
}

.navbar.scrolled {
    background: rgba(15, 23, 42, 0.95) !important;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
}

.navbar-brand {
    font-size: 1.4rem;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-link {
    color: var(--text-secondary) !important;
    font-weight: 500;
    font-size: 0.9rem;
    padding: 0.5rem 1rem !important;
    border-radius: 8px;
    transition: all 0.3s ease;
    margin: 0 0.15rem;
}

.nav-link:hover, .nav-link.active {
    color: var(--text-primary) !important;
    background: rgba(99, 102, 241, 0.15);
}

/* Dropdown */
.dropdown-menu {
    background: var(--bg-card) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 12px !important;
    padding: 0.5rem !important;
    box-shadow: var(--shadow-lg) !important;
    min-width: 220px;
}

.dropdown-item {
    color: var(--text-secondary) !important;
    border-radius: 8px !important;
    padding: 0.5rem 1rem !important;
    font-size: 0.88rem;
    transition: all 0.2s ease;
}

.dropdown-item:hover {
    color: var(--text-primary) !important;
    background: rgba(99, 102, 241, 0.15) !important;
}

.dropdown-divider {
    border-color: var(--border-color) !important;
    margin: 0.3rem 0 !important;
}

.navbar .dropdown-toggle::after {
    margin-left: 0.3rem;
}

.main-content {
    padding-top: 80px;
    min-height: calc(100vh - 80px);
    overflow-x: hidden;
    width: 100%;
}

/* Hero Section */
.hero-section {
    padding: 5rem 0 4rem;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: -200px;
    left: 50%;
    transform: translateX(-50%);
    width: min(600px, 100vw);
    height: 600px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.12), transparent 70%);
    pointer-events: none;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 1.2rem;
}

.hero-title .gradient-text {
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.15rem;
    color: var(--text-secondary);
    max-width: 550px;
    margin: 0 auto 2.5rem;
    line-height: 1.7;
}

/* Tool Cards */
.tool-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 2.5rem 2rem;
    text-align: center;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
    text-decoration: none;
    display: block;
    position: relative;
    overflow: hidden;
}

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

.tool-card:hover {
    transform: translateY(-8px);
    border-color: var(--primary);
    box-shadow: var(--shadow-lg);
    background: var(--bg-card-hover);
}

.tool-card:hover::before {
    opacity: 1;
}

.tool-card-icon {
    width: 72px;
    height: 72px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.3rem;
    font-size: 2rem;
    color: white;
    transition: transform 0.3s ease;
}

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

.tool-card-icon.gradient-1 { background: var(--gradient-1); }
.tool-card-icon.gradient-2 { background: var(--gradient-2); }
.tool-card-icon.gradient-3 { background: var(--gradient-3); }

.tool-card h3 {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.6rem;
    color: var(--text-primary);
}

.tool-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
    margin: 0;
}

/* Tool Page Layout */
.tool-page {
    padding: 3rem 0 4rem;
}

.tool-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.tool-header h1 {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}

.tool-header p {
    color: var(--text-secondary);
    font-size: 1.05rem;
}

.tool-container {
    max-width: 700px;
    margin: 0 auto;
}

/* Input Cards */
.input-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    margin-bottom: 1.5rem;
}

.input-group-custom {
    display: flex;
    gap: 0.75rem;
}

.input-group-custom .form-control {
    background: var(--bg-dark);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 0.85rem 1.2rem;
    border-radius: 12px;
    font-size: 0.95rem;
    flex: 1;
    transition: border-color 0.3s ease;
}

.input-group-custom .form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
    outline: none;
}

.input-group-custom .form-control::placeholder {
    color: var(--text-secondary);
    opacity: 0.6;
}

/* Buttons */
.btn-primary-custom {
    background: var(--gradient-1);
    border: none;
    color: white;
    padding: 0.85rem 2rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.btn-primary-custom:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
    color: white;
}

.btn-primary-custom:active {
    transform: translateY(0);
}

.btn-primary-custom:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-copy {
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: var(--primary-light);
    padding: 0.6rem 1.2rem;
    border-radius: 10px;
    font-weight: 500;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-copy:hover {
    background: rgba(99, 102, 241, 0.25);
    color: white;
}

.btn-download {
    background: rgba(6, 182, 212, 0.15);
    border: 1px solid rgba(6, 182, 212, 0.3);
    color: var(--accent);
    padding: 0.6rem 1.2rem;
    border-radius: 10px;
    font-weight: 500;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.btn-download:hover {
    background: rgba(6, 182, 212, 0.25);
    color: white;
}

/* Result Card */
.result-card {
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 16px;
    padding: 1.5rem 2rem;
    margin-top: 1.5rem;
    display: none;
    animation: slideUp 0.4s ease;
}

.result-card.show {
    display: block;
}

.result-label {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--primary-light);
    margin-bottom: 0.75rem;
}

.result-url {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    word-break: break-all;
    margin-bottom: 1rem;
}

.result-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* QR Result */
.qr-result {
    text-align: center;
    padding: 2rem;
}

.qr-result img {
    max-width: 280px;
    border-radius: 12px;
    background: white;
    padding: 12px;
    box-shadow: var(--shadow);
}

/* Image Upload */
.upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: 16px;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

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

.upload-zone i {
    font-size: 3rem;
    color: var(--primary-light);
    margin-bottom: 1rem;
    display: block;
}

.upload-zone p {
    color: var(--text-secondary);
    margin: 0;
}

.upload-zone .upload-hint {
    font-size: 0.8rem;
    color: var(--text-secondary);
    opacity: 0.6;
    margin-top: 0.5rem;
}

.upload-zone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

/* Image Preview */
.image-preview {
    display: none;
    text-align: center;
    margin-top: 1.5rem;
}

.image-preview.show {
    display: block;
}

.image-preview img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.image-info {
    margin-top: 1rem;
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.image-info-item {
    text-align: center;
}

.image-info-item .label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.image-info-item .value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* Range Input */
.range-group {
    margin: 1.5rem 0;
}

.range-group label {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.range-group input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--border-color);
    outline: none;
    -webkit-appearance: none;
}

.range-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.4);
}

/* Loading Spinner */
.spinner-overlay {
    display: none;
    text-align: center;
    padding: 2rem;
}

.spinner-overlay.show {
    display: block;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 0.75rem;
}

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

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

/* Toast Notification */
.toast-notification {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--bg-card);
    border: 1px solid var(--primary);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.9rem;
    z-index: 9999;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toast-notification i {
    color: #22c55e;
    font-size: 1.2rem;
}

/* Footer */
.site-footer {
    background: rgba(15, 23, 42, 0.9);
    border-top: 1px solid var(--border-color);
    padding: 1.5rem 0;
    margin-top: 3rem;
}

.site-footer p {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.footer-badge {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Features Section */
.features-section {
    padding: 3rem 0;
}

.feature-item {
    text-align: center;
    padding: 1.5rem;
}

.feature-item i {
    font-size: 1.8rem;
    color: var(--primary-light);
    margin-bottom: 0.75rem;
}

.feature-item h5 {
    font-weight: 600;
    font-size: 0.95rem;
    margin-bottom: 0.3rem;
}

.feature-item p {
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin: 0;
}

/* Contact Grid */
.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

/* Footer Links */
.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    margin-right: 1rem;
    font-size: 0.8rem;
    transition: color 0.2s ease;
}

.footer-links a:hover {
    color: var(--text-primary);
}

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

    .hero-section {
        padding: 3rem 0 2rem;
    }

    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 0.95rem;
        padding: 0 1rem;
    }

    .tool-card {
        padding: 2rem 1.5rem;
    }

    .tool-header h1 {
        font-size: 1.5rem;
    }

    .tool-header p {
        font-size: 0.9rem;
    }

    .input-card {
        padding: 1.25rem;
    }

    .input-group-custom {
        flex-direction: column;
    }

    .input-group-custom .form-control {
        font-size: 0.9rem;
    }

    .result-card {
        padding: 1.25rem;
    }

    .result-url {
        font-size: 0.95rem;
    }

    .result-actions {
        flex-direction: column;
    }

    .result-actions .btn-copy,
    .result-actions .btn-download {
        width: 100%;
        justify-content: center;
    }

    .upload-zone {
        padding: 2rem 1rem;
    }

    .upload-zone i {
        font-size: 2.2rem;
    }

    .navbar-collapse {
        padding: 1rem 0;
    }

    .nav-link {
        padding: 0.6rem 1rem !important;
    }

    .toast-notification {
        left: 1rem;
        right: 1rem;
        bottom: 1rem;
    }

    .features-section .col-6 {
        padding: 0.5rem;
    }

    .feature-item {
        padding: 1rem 0.5rem;
    }

    .footer-links {
        flex-wrap: wrap;
    }

    .footer-links a {
        font-size: 0.75rem;
    }
}

@media (max-width: 400px) {
    .hero-title {
        font-size: 1.7rem;
    }

    .tool-card h3 {
        font-size: 1.1rem;
    }

    .tool-card p {
        font-size: 0.85rem;
    }

    .btn-primary-custom {
        width: 100%;
        justify-content: center;
    }
}
