:root {
    --primary-color: #7d7d7d;
    --secondary-color: #3b82f6;
    --background-color: #f3f4f6;
    --text-color: #1f2937;
    --card-background: #ffffff;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
}

body.dark {
    --background-color: #1f2937;
    --text-color: #f3f4f6;
    --card-background: #111827;
    --primary-color: #3b82f6;
    --secondary-color: #60a5fa;
}

nav {
    background-color: var(--card-background);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    animation: slideIn 0.5s ease-out;
}

@media (max-width: 640px) {
    .nav-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav-links {
        display: flex;
        justify-content: center;
        width: 100%;
    }
    
    .nav-links a {
        margin: 0 0.5rem;
    }
}

h1 {
    font-size: 1.5rem;
    color: var(--primary-color);
}

.nav-links a {
    margin-left: 2rem;
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    transition: color 0.3s ease;
}

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

main {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.hero {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 4rem 1rem;
    border-radius: 1rem;
    margin-bottom: 3rem;
    animation: fadeIn 0.5s ease-out;
}

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

.hero h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.input-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 2rem;
    width: 100%;
}

@media (min-width: 640px) {
    .input-container {
        flex-direction: row;
    }
}

/* Enhanced input styles */
input {
    padding: 0.8rem 1.2rem;
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: var(--card-background);
    color: var(--text-color);
}

input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    color: var(--text-color);
}

/* Ensure text visibility in dark mode */
body.dark input {
    background: #111827;
    color: #f3f4f6;
}

body.dark input:focus {
    color: #f3f4f6;
}

/* Enhanced short link input styles */
#shortLink {
    width: 100%;
    padding: 0.8rem 1.2rem;
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: var(--card-background);
    color: var(--text-color);
}

#shortLink:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    color: var(--text-color);
}

/* Ensure text visibility in dark mode for short link */
body.dark #shortLink {
    background: #111827;
    color: #f3f4f6;
}

body.dark #shortLink:focus {
    color: #f3f4f6;
}

.primary-button {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.primary-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.primary-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.result-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}

@media (min-width: 640px) {
    .result-container {
        flex-direction: row;
    }
}

.stats {
    background-color: var(--card-background);
    padding: 3rem 1rem;
    border-radius: 1rem;
    margin-bottom: 3rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.stat-card {
    background: var(--card-background);
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease;
    text-align: center;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-card i {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
    transition: transform 0.3s ease;
}

.stat-card:hover i {
    transform: scale(1.1);
}

.about {
    background-color: var(--card-background);
    padding: 3rem 1rem;
    border-radius: 1rem;
}

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

footer {
    background: var(--card-background);
    padding: 4rem 1rem;
    margin-top: 4rem;
    box-shadow: var(--shadow);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.footer-section h3 {
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.notifications-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 300px;
    max-height: 500px;
    overflow-y: auto;
    z-index: 1000;
}

.notifications-container.dark {
    background: rgba(17, 24, 39, 0.9);
}

.notification {
    position: relative;
    padding: 1rem 1.5rem;
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    background-color: var(--card-background);
    color: var(--text-color);
    box-shadow: var(--shadow);
    transform: translateY(100%);
    transition: transform 0.3s ease-out;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.notification.show {
    transform: translateY(0);
}

.notification.success {
    background: linear-gradient(135deg, #22c55e, #10b981);
    color: white;
}

.notification.error {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

/* Toast Notifications */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background-color: var(--card-background);
    color: var(--text-color);
    padding: 12px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    display: flex;
    align-items: center;
    font-weight: 500;
    max-width: 90%;
    width: auto;
}

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

.toast.success {
    background: linear-gradient(135deg, #22c55e, #10b981);
    color: white;
}

.toast.error {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

.toast.info {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
}

.toast-icon {
    margin-right: 8px;
    font-size: 16px;
}

@media (max-width: 480px) {
    .toast {
        padding: 10px 16px;
        font-size: 14px;
        max-width: 90%;
    }
}

.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--card-background);
    border: 2px solid var(--text-color);
    color: var(--text-color);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.theme-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

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

@keyframes slideIn {
    from {
        transform: translateX(-100%);
    }
    to {
        transform: translateX(0);
    }
}

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

/* Mobile optimizations */
@media (max-width: 480px) {
    .hero h2 {
        font-size: 1.8rem;
    }
    
    .hero p {
        font-size: 1rem;
    }
    
    .primary-button {
        width: 100%;
        padding: 0.7rem 1rem;
        font-size: 0.9rem;
    }
    
    input, #shortLink {
        width: 100%;
        font-size: 0.9rem;
    }
    
    .theme-toggle {
        top: 10px;
        right: 10px;
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .input-container {
        grid-template-columns: 1fr;
    }

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

    .nav-content {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    .nav-links {
        margin-top: 1rem;
    }

    .nav-links a {
        margin: 0.5rem 0;
    }

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

    .stat-card {
        padding: 1.5rem;
    }

    .footer-content {
        grid-template-columns: 1fr;
    }
}
