@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --primary-bg: rgba(99, 102, 241, 0.08);
    --primary-glow: rgba(99, 102, 241, 0.25);
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --bg-page: #fafbfc;
    --bg-card: #ffffff;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.06);
    --shadow-xl: 0 20px 60px rgba(0, 0, 0, 0.08);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

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

html {
    scroll-behavior: smooth;
}

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

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

a {
    text-decoration: none;
    color: inherit;
}

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

/* Header */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(24px) saturate(1.8);
    border-bottom: 1px solid var(--border-light);
    transition: all 0.3s ease;
}

.header.scrolled {
    box-shadow: var(--shadow-sm);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 68px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 22px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
}

.logo span {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

.nav a {
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.nav a:hover {
    background: var(--primary-bg);
    color: var(--primary);
}

.nav a.active {
    background: var(--primary);
    color: white;
}

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

.hero-bg {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.hero-bg-circle {
    position: absolute;
    border-radius: 50%;
    opacity: 0.4;
}

.hero-bg-circle:nth-child(1) {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.12), transparent 70%);
    top: -200px;
    right: -200px;
    animation: float 20s ease-in-out infinite;
}

.hero-bg-circle:nth-child(2) {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.1), transparent 70%);
    bottom: -100px;
    left: -100px;
    animation: float 15s ease-in-out infinite reverse;
}

.hero-bg-circle:nth-child(3) {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.06), transparent 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: float 25s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0); }
    33% { transform: translate(30px, -30px); }
    66% { transform: translate(-20px, 20px); }
}

.hero-content {
    text-align: center;
    max-width: 820px;
    position: relative;
    z-index: 1;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    background: var(--primary-bg);
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: 100px;
    font-size: 13px;
    font-weight: 500;
    color: var(--primary);
    margin-bottom: 24px;
}

.hero-badge-dot {
    width: 6px;
    height: 6px;
    background: var(--primary);
    border-radius: 50%;
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.hero h1 {
    font-size: 56px;
    font-weight: 800;
    line-height: 1.15;
    letter-spacing: -1.5px;
    color: var(--text-primary);
    margin-bottom: 20px;
}

.hero h1 .gradient-text {
    background: linear-gradient(135deg, var(--primary), #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero p {
    font-size: 18px;
    color: var(--text-secondary);
    line-height: 1.7;
    max-width: 600px;
    margin: 0 auto 40px;
}

/* URL Form */
.url-form {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 12px;
    box-shadow: var(--shadow-lg);
    display: flex;
    gap: 12px;
    align-items: center;
    transition: all 0.3s ease;
    max-width: 700px;
    margin: 0 auto;
}

.url-form:focus-within {
    border-color: var(--primary);
    box-shadow: var(--shadow-xl), 0 0 0 4px var(--primary-glow);
    transform: translateY(-2px);
}

.url-form .input-wrap {
    flex: 1;
    position: relative;
}

.url-form .input-wrap .icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 18px;
    pointer-events: none;
}

.url-form input {
    width: 100%;
    padding: 16px 20px 16px 50px;
    border: none;
    outline: none;
    font-size: 16px;
    font-family: inherit;
    color: var(--text-primary);
    background: transparent;
}

.url-form input::placeholder {
    color: var(--text-muted);
}

.url-form .btn-generate {
    padding: 14px 32px;
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
}

.url-form .btn-generate:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--primary-glow);
}

.url-form .btn-generate:active {
    transform: translateY(0);
}

.url-form .btn-generate.loading {
    opacity: 0.7;
    pointer-events: none;
}

/* Result Card */
.result-card {
    margin-top: 32px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-md);
    display: none;
    animation: slideUp 0.5s ease;
}

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

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

.result-card .success-icon {
    width: 48px;
    height: 48px;
    background: rgba(16, 185, 129, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    font-size: 24px;
    color: var(--success);
}

.result-content {
    display: flex;
    gap: 32px;
    align-items: center;
}

.result-main {
    flex: 1;
}

.result-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.result-url {
    font-size: 20px;
    font-weight: 600;
    color: var(--primary);
    word-break: break-all;
    margin-bottom: 16px;
}

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

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

.btn-copy:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-copy.copied {
    background: var(--success);
}

.btn-visit {
    padding: 10px 24px;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}

.btn-visit:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-bg);
}

.result-qr {
    flex-shrink: 0;
    width: 140px;
    height: 140px;
    background: var(--bg-page);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.result-qr canvas, .result-qr img {
    width: 120px !important;
    height: 120px !important;
}

.result-original {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border-light);
    font-size: 13px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    word-break: break-all;
}

.result-original a {
    color: var(--text-secondary);
}

.result-original a:hover {
    color: var(--primary);
}

/* History Section */
.history-section {
    padding: 80px 24px;
    background: var(--bg-page);
    border-top: 1px solid var(--border-light);
}

.history-inner {
    max-width: 820px;
    margin: 0 auto;
}

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

.history-header h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}

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

.history-count {
    font-size: 13px;
    color: var(--text-muted);
    background: var(--bg-card);
    padding: 6px 16px;
    border-radius: 100px;
    border: 1px solid var(--border-light);
    font-weight: 500;
}

.history-search {
    position: relative;
    margin-bottom: 24px;
}

.history-search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    display: flex;
}

.history-search input {
    width: 100%;
    padding: 14px 44px 14px 48px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-family: inherit;
    color: var(--text-primary);
    background: var(--bg-card);
    outline: none;
    transition: all 0.2s ease;
}

.history-search input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.history-search input::placeholder {
    color: var(--text-muted);
}

.history-search-clear {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    transition: all 0.2s ease;
}

.history-search-clear:hover {
    color: var(--text-secondary);
    background: var(--border-light);
}

/* History List */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.history-loading {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
    font-size: 14px;
}

.history-loading-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin: 0 auto 12px;
}

.history-item {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    transition: all 0.25s ease;
    animation: slideUp 0.35s ease both;
}

.history-item:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.1);
    transform: translateY(-2px);
}

.history-item:active {
    transform: translateY(0);
}

.history-item-icon {
    width: 42px;
    height: 42px;
    background: var(--primary-bg);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--primary);
    font-size: 18px;
}

.history-item-body {
    flex: 1;
    min-width: 0;
}

.history-item-original {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.history-item-short {
    font-size: 15px;
    font-weight: 600;
    color: var(--primary);
}

.history-item-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.history-item-clicks {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
}

.history-item-time {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
}

.history-item-action {
    padding: 6px 14px;
    background: transparent;
    color: var(--primary);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.history-item-action:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* History Empty */
.history-empty {
    text-align: center;
    padding: 48px 20px;
    background: var(--bg-card);
    border: 1px dashed var(--border);
    border-radius: var(--radius-lg);
}

.history-empty-icon {
    margin-bottom: 16px;
    color: var(--text-muted);
    opacity: 0.4;
}

.history-empty p {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.history-empty span {
    font-size: 13px;
    color: var(--text-muted);
}

/* History item stagger animation */
.history-item:nth-child(1) { animation-delay: 0s; }
.history-item:nth-child(2) { animation-delay: 0.04s; }
.history-item:nth-child(3) { animation-delay: 0.08s; }
.history-item:nth-child(4) { animation-delay: 0.12s; }
.history-item:nth-child(5) { animation-delay: 0.16s; }
.history-item:nth-child(6) { animation-delay: 0.20s; }
.history-item:nth-child(7) { animation-delay: 0.24s; }
.history-item:nth-child(8) { animation-delay: 0.28s; }
.history-item:nth-child(9) { animation-delay: 0.32s; }
.history-item:nth-child(10) { animation-delay: 0.36s; }

/* Features */
.features {
    padding: 80px 24px 100px;
    background: var(--bg-card);
    border-top: 1px solid var(--border-light);
}

.features-inner {
    max-width: 1100px;
    margin: 0 auto;
}

.features-header {
    text-align: center;
    margin-bottom: 56px;
}

.features-header h2 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 12px;
}

.features-header p {
    color: var(--text-secondary);
    font-size: 16px;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.feature-card {
    padding: 32px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    transition: all 0.3s ease;
    text-align: center;
}

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

.feature-icon {
    width: 56px;
    height: 56px;
    background: var(--primary-bg);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin: 0 auto 20px;
    color: var(--primary);
}

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

.feature-card p {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.7;
}

/* Footer */
.footer {
    background: var(--text-primary);
    color: white;
    padding: 48px 24px;
    text-align: center;
}

.footer p {
    opacity: 0.6;
    font-size: 14px;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text-primary);
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    transition: all 0.4s ease;
    z-index: 10000;
    box-shadow: var(--shadow-lg);
}

.toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--danger);
}

/* Error state */
.result-card.error-state .success-icon {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.error-message {
    color: var(--danger);
    font-size: 14px;
    text-align: center;
}

/* Responsive */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 34px;
    }

    .hero p {
        font-size: 16px;
    }

    .url-form {
        flex-direction: column;
        padding: 8px;
    }

    .url-form .input-wrap .icon {
        left: 16px;
    }

    .url-form input {
        padding: 14px 16px 14px 44px;
        font-size: 15px;
    }

    .url-form .btn-generate {
        width: 100%;
        justify-content: center;
        padding: 14px;
    }

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

    .result-qr {
        width: 120px;
        height: 120px;
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .header-inner {
        height: 60px;
    }

    .hero {
        padding: 100px 16px 60px;
    }
}

/* History Responsive */
@media (max-width: 768px) {
    .history-section {
        padding: 48px 16px;
    }

    .history-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .history-header h2 {
        font-size: 20px;
    }

    .history-item {
        flex-wrap: wrap;
        padding: 14px 16px;
    }

    .history-item-meta {
        width: 100%;
        justify-content: flex-start;
        padding-left: 58px;
    }

    .history-item-action {
        margin-left: auto;
    }
}

/* Loading spinner */
.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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