/* =========================================
   Base Styles and Variables
   ========================================= */
:root {
    /* Color Palette */
    --primary-bg: #121212;
    --glass-bg: rgba(30, 30, 40, 0.7);
    --accent-color: #A020F0; /* Electric Purple */
    --accent-color-muted: #d3a7ee;
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.5);
    --error-color: #8B0000; /* Dark Red */
    
    /* Gradients */
    --bg-gradient: linear-gradient(135deg, #1A1A2E 0%, #16213E 50%, #0F3460 100%);
    
    /* Shadows */
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.36);
    --button-shadow: 0 4px 12px rgba(160, 32, 240, 0.2);
    
    /* Border & Radius */
    --border-radius: 12px;
    --input-border: 2px solid rgba(255, 255, 255, 0.1);
    
    /* Typography */
    --font-primary: 'Montserrat', sans-serif;
    --font-secondary: 'Roboto', sans-serif;
    
    /* Spacing */
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 2rem;
    --space-xl: 3rem;
}

/* =========================================
   Reset & Global Styles
   ========================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow-x: hidden;
}

body {
    font-family: var(--font-primary);
    background: var(--bg-gradient);
    color: var(--text-primary);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    line-height: 1.6;
}

/* =========================================
   Container Layout
   ========================================= */
.container {
    width: 100%;
    max-width: 800px;
    padding: var(--space-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

/* =========================================
   Typography
   ========================================= */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
}

.main-title {
    font-size: 4rem; /* 64px */
    margin-bottom: var(--space-xl);
    text-align: center;
    background: linear-gradient(to right, var(--accent-color-muted), var(--accent-color));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.2;
    letter-spacing: -0.025em;
}

p {
    margin-bottom: var(--space-md);
}

/* =========================================
   Converter Section
   ========================================= */
.converter {
    width: 100%;
    padding: var(--space-xl) 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* =========================================
   Input Field Styling
   ========================================= */
.input-container {
    position: relative;
    width: 100%;
    margin-bottom: var(--space-lg);
}

.typewriter-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    pointer-events: none;
    color: var(--text-muted);
    font-family: var(--font-secondary);
    font-size: 1.5rem;
}

.conversion-input {
    width: 100%;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem; /* Match typewriter font size */
    padding: var(--space-md) 0;
    font-family: var(--font-secondary);
    position: relative;
    z-index: 1;
}

.conversion-input:focus {
    outline: none;
}

.input-underline {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    width: 100%;
    background-color: var(--text-muted);
    transition: all 0.3s ease;
}

.input-container:focus-within .input-underline {
    background-color: var(--accent-color);
    height: 3px;
}

/* =========================================
   Button Styling
   ========================================= */
.convert-btn {
    background-color: var(--accent-color);
    color: var(--text-primary);
    border: none;
    border-radius: 50px;
    padding: var(--space-md) var(--space-xl);
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    letter-spacing: 0.5px;
    margin: var(--space-md) 0 var(--space-lg);
    transition: all 0.3s ease;
    box-shadow: var(--button-shadow);
    font-family: var(--font-primary);
}

.convert-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(160, 32, 240, 0.3);
}

.convert-btn:active {
    transform: translateY(1px);
    box-shadow: 0 2px 8px rgba(160, 32, 240, 0.2);
}

/* =========================================
   Results Styling
   ========================================= */
.results-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease;
}

.results-container.visible {
    opacity: 1;
    transform: translateY(0);
}

.result {
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-md);
    text-align: center;
}

.fact {
    font-size: 1.1rem;
    color: var(--text-secondary);
    text-align: center;
    max-width: 600px;
    font-style: italic;
    line-height: 1.6;
}

/* =========================================
   Footer Styling
   ========================================= */
footer {
    margin-top: var(--space-xl);
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* =========================================
   Responsive Adjustments
   ========================================= */
@media (max-width: 768px) {
    .container {
        padding: var(--space-md);
    }
    
    .main-title {
        font-size: 2.5rem;
        margin-bottom: var(--space-lg);
    }
    
    .converter {
        padding: var(--space-lg) 0;
    }
    
    .conversion-input, .typewriter-container {
        font-size: 1.25rem;
    }
    
    .result {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .main-title {
        font-size: 2rem;
    }
    
    .converter {
        padding: var(--space-md) 0;
    }
    
    .conversion-input, .typewriter-container {
        font-size: 1rem;
    }
    
    .convert-btn {
        padding: var(--space-sm) var(--space-lg);
        font-size: 1rem;
    }
    
    .result {
        font-size: 1.25rem;
    }
    
    .fact {
        font-size: 0.9rem;
    }
}

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

.fade-in {
    animation: fadeIn 0.5s ease forwards;
}

/* Typed.js cursor styling */
.typed-cursor {
    color: var(--accent-color);
}

/* =========================================
   Error Styling
   ========================================= */
.result.error {
    color: var(--error-color);
    font-size: 1.5rem; /* Same as the input field */
    font-weight: 500; /* Slightly less bold than normal result */
}
