/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #0f0f23;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow-x: hidden;
}

/* Animated background */
.background-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    z-index: -1;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Main container */
.container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 24px;
    padding: 40px;
    box-shadow: 
        0 25px 50px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    max-width: 550px;
    width: 100%;
    text-align: center;
    position: relative;
    animation: slideUp 0.6s ease-out;
}

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

/* Header section */
.header {
    margin-bottom: 40px;
}

h1 {
    color: #1a1a2e;
    margin-bottom: 12px;
    font-size: 3em;
    font-weight: 800;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.subtitle {
    color: #4a5568;
    margin-bottom: 20px;
    font-size: 1.2em;
    font-weight: 500;
}

.feature-badges {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.badge {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    animation: float 3s ease-in-out infinite;
}

.badge:nth-child(2) { animation-delay: 0.5s; }
.badge:nth-child(3) { animation-delay: 1s; }

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-5px); }
}

/* Form styles */
.shorten-form {
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 24px;
    text-align: left;
}

label {
    display: block;
    margin-bottom: 10px;
    color: #2d3748;
    font-weight: 600;
    font-size: 1.05em;
}

.input-wrapper {
    position: relative;
}

input[type="url"] {
    width: 100%;
    padding: 18px 50px 18px 18px;
    border: 2px solid #e2e8f0;
    border-radius: 16px;
    font-size: 16px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
}

input[type="url"]:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 
        0 0 0 4px rgba(102, 126, 234, 0.1),
        0 4px 12px rgba(102, 126, 234, 0.15);
    transform: translateY(-1px);
}

.input-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2em;
    opacity: 0.6;
    pointer-events: none;
}

/* Button styles */
.shorten-btn {
    width: 100%;
    padding: 18px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 16px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.shorten-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 35px rgba(102, 126, 234, 0.4);
}

.shorten-btn:active {
    transform: translateY(-1px);
}

.shorten-btn.loading .btn-text {
    opacity: 0;
}

.btn-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    opacity: 0;
}

.shorten-btn.loading .btn-loader {
    opacity: 1;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Result section */
.result {
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    border-radius: 20px;
    padding: 30px;
    margin-top: 30px;
    border: 1px solid rgba(102, 126, 234, 0.1);
    display: none;
    text-align: left;
}

.result.show {
    display: block;
    animation: resultSlideIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.result-header h3 {
    color: #1a202c;
    margin-bottom: 20px;
    text-align: center;
    font-size: 1.4em;
}

.url-display {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    align-items: center;
}

.short-url {
    flex: 1;
    background: white;
    padding: 16px;
    border-radius: 12px;
    border: 2px solid #e2e8f0;
    font-family: 'SF Mono', 'Monaco', 'Cascadia Code', monospace;
    font-size: 16px;
    font-weight: 600;
    color: #667eea;
    word-break: break-all;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.copy-btn {
    background: #48bb78;
    color: white;
    border: none;
    padding: 16px 20px;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(72, 187, 120, 0.3);
}

.copy-btn:hover {
    background: #38a169;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(72, 187, 120, 0.4);
}

.copy-btn.copied {
    background: #38a169;
}

.result-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    justify-content: center;
}

.stats-btn, .secondary-btn {
    flex: 1;
    padding: 12px 16px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.stats-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.stats-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.secondary-btn {
    background: #f7fafc;
    color: #4a5568;
    border: 2px solid #e2e8f0;
}

.secondary-btn:hover {
    background: #edf2f7;
    transform: translateY(-2px);
}

.result-info {
    text-align: center;
    padding-top: 15px;
    border-top: 1px solid #e2e8f0;
    font-size: 0.9em;
    color: #718096;
}

.original-url {
    color: #4a5568;
    font-weight: 500;
    word-break: break-all;
}

/* Stats panel */
.stats-panel {
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    border-radius: 20px;
    padding: 30px;
    margin-top: 20px;
    border: 1px solid rgba(102, 126, 234, 0.1);
    display: none;
}

.stats-panel.show {
    display: block;
    animation: resultSlideIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.stats-header h3 {
    color: #1a202c;
    font-size: 1.3em;
}

.close-btn {
    background: #fed7d7;
    color: #c53030;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: #feb2b2;
    transform: scale(1.1);
}

.stats-content {
    display: grid;
    gap: 20px;
}

.stat-item {
    background: white;
    padding: 20px;
    border-radius: 16px;
    border: 1px solid #e2e8f0;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.stat-label {
    color: #718096;
    font-size: 0.9em;
    margin-bottom: 8px;
    font-weight: 500;
}

.stat-value {
    color: #1a202c;
    font-size: 1.8em;
    font-weight: 700;
}

/* Error styles */
.error {
    color: #e53e3e;
    background: #fed7d7;
    border: 1px solid #feb2b2;
    padding: 16px;
    border-radius: 12px;
    margin-top: 20px;
    display: none;
    animation: shake 0.5s ease-in-out;
}

.error.show {
    display: block;
}

@keyframes shake {
    0%, 20%, 40%, 60%, 80%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
}

/* Footer */
.footer {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid #e2e8f0;
    color: #718096;
    font-size: 0.9em;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.footer-links a {
    color: #667eea;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    padding: 8px 12px;
    border-radius: 8px;
}

.footer-links a:hover {
    background: rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

.footer p a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
}

.footer p a:hover {
    text-decoration: underline;
}

/* Responsive design */
@media (max-width: 768px) {
    .container {
        padding: 30px 20px;
        margin: 10px;
    }
    
    h1 {
        font-size: 2.5em;
    }
    
    .url-display {
        flex-direction: column;
    }
    
    .copy-btn {
        width: 100%;
    }
    
    .result-actions {
        flex-direction: column;
    }
    
    .footer-links {
        flex-direction: column;
        gap: 10px;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    .container {
        padding: 25px 15px;
    }
    
    h1 {
        font-size: 2em;
    }
    
    .subtitle {
        font-size: 1em;
    }
    
    .feature-badges {
        gap: 8px;
    }
    
    .badge {
        font-size: 0.8em;
        padding: 4px 10px;
    }
}