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

:root {
    --bg-primary: #ffffff;
    --bg-secondary: #fafafa;
    --text-primary: #0a0a0a;
    --text-secondary: #666666;
    --text-tertiary: #999999;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-light: #eff6ff;
    --border: #e5e5e5;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 12px 24px rgba(0, 0, 0, 0.12);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --gradient-opacity: 0.08;
}

[data-theme="dark"] {
    --bg-primary: #0a0a0a;
    --bg-secondary: #141414;
    --text-primary: #ffffff;
    --text-secondary: #a0a0a0;
    --text-tertiary: #666666;
    --accent: #3b82f6;
    --accent-hover: #60a5fa;
    --accent-light: #1e3a8a;
    --border: #2a2a2a;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 12px 24px rgba(0, 0, 0, 0.7);
    --gradient-opacity: 0.15;
}

*, html {
    scroll-behavior: smooth !important;
}

html {
    scroll-behavior: smooth;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: #1a1a1a;
    border-radius: 6px;
    border: 3px solid var(--bg-primary);
}

::-webkit-scrollbar-thumb:hover {
    background: #000000;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: #2a2a2a;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: #3a3a3a;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 32px;
}

/* Grain texture */
.grain {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    opacity: 0.03;
    z-index: 100;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

/* Gradient background */
.gradient-bg {
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 50% 50%, rgba(37, 99, 235, var(--gradient-opacity)) 0%, transparent 50%);
    animation: rotate 30s linear infinite;
    pointer-events: none;
    z-index: 0;
    transition: opacity 0.3s ease;
}

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

/* Navigation */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 50;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

[data-theme="dark"] .nav {
    background: rgba(10, 10, 10, 0.8);
}

.nav-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
}

.logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    transition: transform 0.3s ease;
}

.logo-img {
    width: 32px;
    height: 32px;
    transition: transform 0.3s ease;
}

.logo:hover .logo-img {
    transform: scale(1.1) rotate(5deg);
}

[data-theme="dark"] .logo-img {
    filter: invert(1);
}

.nav-links {
    display: flex;
    gap: 32px;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    transition: color 0.3s ease;
    position: relative;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent);
    transition: width 0.3s ease;
}

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

.nav-links a:hover::after {
    width: 100%;
}

/* Theme Toggle */
.theme-toggle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: var(--bg-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.theme-toggle:hover {
    border-color: var(--accent);
    transform: scale(1.05);
}

.nav-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Language Toggle */
.lang-toggle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: var(--bg-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.lang-toggle:hover {
    border-color: var(--accent);
    transform: scale(1.05);
    color: var(--accent);
}

.theme-toggle svg {
    position: absolute;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.sun-icon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
    color: var(--text-primary);
}

.moon-icon {
    opacity: 0;
    transform: rotate(90deg) scale(0);
    color: var(--text-primary);
}

[data-theme="dark"] .sun-icon {
    opacity: 0;
    transform: rotate(-90deg) scale(0);
}

[data-theme="dark"] .moon-icon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
    color: #ffffff;
}

/* Hero Section */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 120px 0 80px;
    position: relative;
    z-index: 1;
}

.hero-content {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

.hero-title {
    font-size: clamp(40px, 7vw, 72px);
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 24px;
    letter-spacing: -0.03em;
}

.hero-title .line {
    display: block;
}

.gradient-text {
    background: linear-gradient(135deg, var(--accent) 0%, #7c3aed 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-description {
    font-size: clamp(16px, 2vw, 20px);
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 48px;
    line-height: 1.7;
}

/* Shortener Card */
.shortener-card {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 48px;
    border: 1px solid var(--border);
}

.input-group {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.input-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 16px;
    color: var(--text-tertiary);
    pointer-events: none;
}

.input-wrapper input {
    width: 100%;
    padding: 16px 16px 16px 48px;
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 16px;
    font-family: inherit;
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.input-wrapper input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--bg-primary);
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 16px 32px;
    border-radius: var(--radius-md);
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    border: none;
    font-family: inherit;
}

.btn-primary {
    background: var(--accent);
    color: white;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.4);
}

.btn-primary svg {
    transition: transform 0.3s ease;
}

.btn-primary:hover svg {
    transform: translateX(4px);
}

.btn-secondary {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 2px solid var(--border);
}

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

/* Advanced Options */
.advanced-toggle {
    margin-bottom: 16px;
}

.toggle-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: color 0.3s ease;
    font-family: inherit;
}

.toggle-btn:hover {
    color: var(--accent);
}

.advanced-options {
    display: none;
    margin-bottom: 16px;
}

.advanced-options.show {
    display: block;
}

.option-group {
    flex: 1;
}

.option-group label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.option-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.option-group input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--bg-primary);
}

/* Result Card */
.result-card {
    display: none;
    background: var(--accent-light);
    border-radius: var(--radius-md);
    padding: 20px;
    margin-top: 16px;
}

.result-card.show {
    display: block;
    animation: slideDown 0.3s ease-out;
}

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

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.result-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.close-btn {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.result-url {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
}

.result-url a {
    flex: 1;
    font-size: 18px;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
    word-break: break-all;
}

.copy-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.copy-btn:hover {
    background: var(--accent-hover);
    transform: scale(1.05);
}

.result-actions {
    display: flex;
    gap: 12px;
}

.action-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: var(--bg-primary);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

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

/* Stats Row */
.stats-row {
    display: flex;
    justify-content: center;
    gap: 64px;
}

.stat-item {
    text-align: center;
}

.stat-value {
    font-size: 36px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Sections */
section {
    padding: 120px 0;
    position: relative;
    z-index: 1;
}

.section-label {
    display: inline-block;
    font-size: 14px;
    font-weight: 600;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 16px;
}

.section-title {
    font-size: clamp(32px, 5vw, 56px);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 24px;
    letter-spacing: -0.02em;
}

.section-header {
    text-align: center;
    margin-bottom: 80px;
}

/* Features */
.features {
    background: var(--bg-secondary);
}

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

.feature-card {
    background: var(--bg-primary);
    padding: 32px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    transition: all 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.feature-icon {
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-light);
    border-radius: var(--radius-md);
    color: #ffffff;
    margin-bottom: 20px;
}

.feature-card h3 {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 12px;
}

.feature-card p {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* How it Works */
.steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 48px;
}

.step-card {
    text-align: center;
}

.step-number {
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: white;
    font-size: 32px;
    font-weight: 700;
    border-radius: 50%;
    margin: 0 auto 24px;
}

.step-card h3 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 12px;
}

.step-card p {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Footer */
.footer {
    padding: 40px 0;
    border-top: 1px solid var(--border);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-content p {
    color: var(--text-secondary);
    font-size: 14px;
}

.footer-links {
    display: flex;
    gap: 24px;
}

.footer-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.3s ease;
}

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

/* Copy Notification */
.copy-notification {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--accent);
    color: white;
    padding: 16px 32px;
    border-radius: 100px;
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 8px 24px rgba(37, 99, 235, 0.4);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
    z-index: 1000;
}

.copy-notification.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.show {
    display: flex;
    animation: fadeIn 0.3s ease-out;
}

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

.modal-content {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease-out;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 20px;
    font-weight: 600;
}

.modal-body {
    padding: 24px;
}

.qr-code {
    width: 256px;
    height: 256px;
    margin: 0 auto 24px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
}

.analytics-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}

.analytics-card {
    background: var(--bg-secondary);
    padding: 20px;
    border-radius: var(--radius-md);
    text-align: center;
}

.analytics-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 8px;
}

.analytics-label {
    font-size: 14px;
    color: var(--text-secondary);
}

.analytics-note {
    text-align: center;
    font-size: 14px;
    color: var(--text-tertiary);
    font-style: italic;
}

/* Countries Section */
.countries-section {
    margin-bottom: 24px;
}

.countries-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.countries-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 300px;
    overflow-y: auto;
    padding-right: 8px;
}

.countries-list::-webkit-scrollbar {
    width: 6px;
}

.countries-list::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 3px;
}

.countries-list::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.countries-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

.country-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    transition: all 0.3s ease;
}

.country-item:hover {
    background: var(--accent-light);
    transform: translateX(4px);
}

.country-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.country-flag {
    font-size: 24px;
}

.country-name {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
}

.country-stats {
    display: flex;
    align-items: center;
    gap: 16px;
}

.country-clicks {
    font-size: 14px;
    font-weight: 600;
    color: var(--accent);
}

.country-percentage {
    font-size: 13px;
    color: var(--text-secondary);
}

/* My Links Preview */
.my-links-preview {
    margin-top: 48px;
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.preview-header h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
}

.view-all-btn {
    font-size: 14px;
    font-weight: 500;
    color: var(--accent);
    text-decoration: none;
    transition: color 0.3s ease;
}

.view-all-btn:hover {
    color: var(--accent-hover);
}

.links-preview-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.link-preview-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    transition: all 0.3s ease;
    gap: 16px;
}

.link-preview-item:hover {
    border-color: var(--accent);
    transform: translateX(4px);
}

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

.link-preview-item .link-short {
    font-size: 15px;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 4px;
    word-break: break-all;
}

.link-preview-item .link-long {
    font-size: 13px;
    color: var(--text-secondary);
    word-break: break-all;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.link-preview-item .link-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .container {
        padding: 0 20px;
    }
    
    .link-preview-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .link-preview-item .link-actions {
        width: 100%;
    }
    
    .link-preview-item .action-btn {
        flex: 1;
    }
    
    .nav-links {
        display: none;
    }
    
    .hero {
        padding: 100px 0 60px;
    }
    
    section {
        padding: 60px 0;
    }
    
    .input-group {
        flex-direction: column;
    }
    
    .advanced-options {
        flex-direction: column;
    }
    
    .stats-row {
        flex-direction: column;
        gap: 24px;
    }
    
    .result-actions {
        flex-direction: column;
    }
    
    .footer-content {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }
    
    .analytics-grid {
        grid-template-columns: 1fr;
    }
    
    .country-stats {
        flex-direction: column;
        align-items: flex-end;
        gap: 4px;
    }
}

::selection {
    background: var(--accent);
    color: white;
}
