/* Import Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600&family=Inter:wght@400;500;600&display=swap');

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

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    position: relative;
    overflow-x: hidden;
}

/* Animated background elements */
body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="20" cy="20" r="1" fill="rgba(255,255,255,0.05)"/><circle cx="80" cy="40" r="1" fill="rgba(255,255,255,0.03)"/><circle cx="40" cy="80" r="1" fill="rgba(255,255,255,0.04)"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
    animation: float 20s ease-in-out infinite;
    pointer-events: none;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0px) rotate(0deg);
    }

    50% {
        transform: translateY(-20px) rotate(1deg);
    }
}

/* Main container */
.converter-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 40px;
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.1),
        0 1px 0 rgba(255, 255, 255, 0.5) inset;
    border: 1px solid rgba(255, 255, 255, 0.2);
    max-width: 500px;
    width: 100%;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.converter-container::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transform: rotate(45deg);
    animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%) translateY(-100%) rotate(45deg);
    }

    50% {
        transform: translateX(100%) translateY(100%) rotate(45deg);
    }

    100% {
        transform: translateX(-100%) translateY(-100%) rotate(45deg);
    }
}

/* Title styling */
h1 {
    font-family: 'Cinzel', serif;
    font-size: 2.5rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 10px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 1;
}

.subtitle {
    color: #718096;
    font-size: 1.1rem;
    margin-bottom: 30px;
    font-weight: 400;
    position: relative;
    z-index: 1;
}

/* Label styling */
label {
    display: block;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 15px;
    font-size: 1.1rem;
    position: relative;
    z-index: 1;
}

/* Input styling */
#number {
    width: 100%;
    padding: 16px 20px;
    font-size: 1.2rem;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: #ffffff;
    color: #2d3748;
    text-align: center;
    font-weight: 500;
    position: relative;
    z-index: 1;
}

#number:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    transform: translateY(-2px);
}

#number:hover {
    border-color: #cbd5e0;
    transform: translateY(-1px);
}

/* Button styling */
#convert-btn {
    width: 100%;
    padding: 16px 30px;
    font-size: 1.2rem;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    margin: 20px 0;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

#convert-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

#convert-btn:active {
    transform: translateY(-1px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

#convert-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

#convert-btn:hover::before {
    left: 100%;
}

/* Output styling */
#output {
    min-height: 80px;
    padding: 20px;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
    border-radius: 12px;
    border: 2px solid #e2e8f0;
    font-family: 'Cinzel', serif;
    font-size: 2rem;
    font-weight: 600;
    color: #2d3748;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    word-break: break-all;
    position: relative;
    z-index: 1;
}

#output:not(:empty) {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    border-color: #667eea;
    animation: resultAppear 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes resultAppear {
    0% {
        opacity: 0;
        transform: scale(0.9) translateY(10px);
    }

    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Error state styling */
#output.error {
    background: linear-gradient(135deg, #feb2b2 0%, #fc8181 100%) !important;
    color: #742a2a !important;
    border-color: #fc8181 !important;
    font-family: 'Inter', sans-serif !important;
    font-size: 1.1rem !important;
    font-weight: 500 !important;
}

/* Responsive design */
@media (max-width: 600px) {
    .converter-container {
        padding: 30px 20px;
        margin: 20px;
    }

    h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    #number,
    #convert-btn {
        font-size: 1.1rem;
        padding: 14px 18px;
    }

    #output {
        font-size: 1.5rem;
        min-height: 70px;
        padding: 15px;
    }
}

/* Additional animations */
@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.8;
    }
}

.converting {
    animation: pulse 1s ease-in-out infinite;
}

/* Focus indicators for accessibility */
#number:focus-visible,
#convert-btn:focus-visible {
    outline: 3px solid #667eea;
    outline-offset: 2px;
}