* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #3b82f6;
    --bg-primary: #f3f4f6;
    --bg-secondary: #e5e7eb;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --border: #3b82f6;
    --error: #ef4444;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.container {
    max-width: 500px;
    width: 100%;
}

.header {
    text-align: center;
    margin-bottom: 40px;
}

.header h1 {
    font-size: 3rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -1px;
}

.card {
    background: white;
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 30px;
}

.input-group {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.url-input {
    flex: 1;
    background: var(--bg-primary);
    border: 2px solid var(--border);
    color: var(--text-primary);
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.2s ease;
    outline: none;
}

.url-input:focus {
    border-color: var(--primary);
    background: white;
}

.url-input::placeholder {
    color: var(--text-secondary);
}

.btn-shorten,
.btn-copy {
    background: var(--primary);
    color: white;
    border: 2px solid var(--primary);
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-shorten:hover,
.btn-copy:hover {
    background: #2563eb;
    border-color: #2563eb;
}

.btn-shorten:active,
.btn-copy:active {
    transform: scale(0.98);
}

.btn-shorten:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.result {
    display: flex;
    gap: 12px;
    align-items: center;
    animation: slideIn 0.3s ease;
}

.result.hidden {
    display: none;
}

.result-link-clickable {
    flex: 1;
    background: var(--bg-primary);
    border: 2px solid var(--border);
    color: var(--primary);
    padding: 12px 14px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: 'Courier New', monospace;
    text-decoration: none;
    display: flex;
    align-items: center;
    word-break: break-all;
    transition: all 0.2s ease;
    cursor: pointer;
}

.result-link-clickable:hover {
    background: white;
}

.btn-copy {
    padding: 12px 16px;
    font-size: 0.9rem;
}

.error {
    animation: slideIn 0.3s ease;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--error);
    color: #fca5a5;
    padding: 14px;
    border-radius: 8px;
    font-size: 0.95rem;
}

.error.hidden {
    display: none;
}

.loading {
    text-align: center;
    padding: 30px;
    animation: slideIn 0.3s ease;
}

.loading.hidden {
    display: none;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 12px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stats {
    text-align: center;
    margin-top: 24px;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.recent-links {
    margin-top: 40px;
    animation: slideIn 0.3s ease;
}

.recent-links h3 {
    margin-bottom: 16px;
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.links-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.link-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.link-item:hover {
    border-color: var(--primary);
    background: var(--bg);
}

.link-item-short {
    color: var(--primary);
    font-weight: 600;
    font-family: 'Courier New', monospace;
}

.link-item-original {
    color: var(--text-secondary);
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
}

@media (max-width: 600px) {
    .header h1 {
        font-size: 2.5rem;
    }

    .card {
        padding: 20px;
    }

    .input-group {
        flex-direction: column;
    }

    .btn-shorten {
        width: 100%;
    }

    .result-link-group {
        flex-direction: column;
    }

    .btn-copy {
        width: 100%;
    }

    .link-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .link-item-original {
        max-width: none;
    }
}
