@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
    --bg-main: #0b0f19;
    --bg-card: rgba(17, 24, 39, 0.75);
    --bg-input: rgba(31, 41, 55, 0.5);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(16, 185, 129, 0.4);
    
    --color-primary: #10b981; /* Sage Emerald */
    --color-primary-hover: #059669;
    --color-primary-glow: rgba(16, 185, 129, 0.15);
    
    --color-secondary: #f59e0b; /* Warm Gold */
    --color-secondary-hover: #d97706;
    --color-secondary-glow: rgba(245, 158, 11, 0.15);
    
    --color-danger: #f43f5e; /* Rose Red */
    --color-danger-hover: #e11d48;
    
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --text-dark: #111827;
    
    --font-sans: 'Outfit', sans-serif;
    --font-heading: 'Plus Jakarta Sans', sans-serif;
    
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.4);
    
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-full: 9999px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--bg-main);
    background-image: 
        radial-gradient(at 10% 10%, rgba(16, 185, 129, 0.08) 0px, transparent 50%),
        radial-gradient(at 90% 90%, rgba(245, 158, 11, 0.06) 0px, transparent 50%),
        radial-gradient(at 50% 50%, rgba(17, 24, 39, 0.5) 0px, transparent 100%);
    background-attachment: fixed;
    color: var(--text-main);
    min-height: 100vh;
    padding: 2rem 1.5rem;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.app-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* Header Styles */
header {
    text-align: center;
    margin-bottom: 0.5rem;
    animation: fadeIn Down var(--transition-slow);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.brand-icon {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.brand-icon svg {
    width: 28px;
    height: 28px;
    fill: none;
    stroke: white;
    stroke-width: 2.5;
}

h1 {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 2.5rem;
    background: linear-gradient(to right, #ffffff, #d1d5db);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.025em;
}

header p {
    color: var(--text-muted);
    font-size: 1.1rem;
    font-weight: 300;
}

/* Main Grid Layout */
.main-grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 2rem;
    align-items: start;
    animation: fadeIn var(--transition-slow) 0.1s both;
}

@media (max-width: 1024px) {
    .main-grid {
        grid-template-columns: 1fr;
    }
}

/* Glassmorphism Cards */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    box-shadow: var(--shadow-md);
    transition: transform var(--transition-normal), border-color var(--transition-normal), box-shadow var(--transition-normal);
}

.card:hover {
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: var(--shadow-lg);
}

.card-title {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-main);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
}

.card-title svg {
    width: 24px;
    height: 24px;
    stroke: var(--color-primary);
    stroke-width: 2;
    fill: none;
}

/* Form Elements */
.form-group {
    margin-bottom: 1.25rem;
}

label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

input[type="text"],
input[type="number"],
select {
    width: 100%;
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    color: var(--text-main);
    font-size: 1rem;
    font-weight: 500;
    transition: all var(--transition-fast);
    outline: none;
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-glow);
    background-color: rgba(31, 41, 55, 0.8);
}

/* Custom Servings Slider Section */
.servings-control {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 1.5rem;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
    padding: 1.25rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
}

.slider-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.servings-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: var(--radius-full);
    background: var(--bg-input);
    outline: none;
    transition: background var(--transition-fast);
}

.servings-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    cursor: pointer;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
    transition: transform var(--transition-fast);
}

.servings-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.servings-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
    cursor: pointer;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
    transition: transform var(--transition-fast);
}

.servings-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
}

.servings-counter {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-counter {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    background-color: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    font-size: 1.25rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.btn-counter:hover:not(:disabled) {
    background-color: var(--color-primary);
    border-color: var(--color-primary);
    box-shadow: 0 0 10px var(--color-primary-glow);
}

.btn-counter:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.servings-display {
    min-width: 60px;
    text-align: center;
}

.servings-number {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--color-primary);
    line-height: 1;
}

.servings-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.05em;
}

/* Preset Picker */
.presets-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.btn-preset {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0.75rem 0.5rem;
    color: var(--text-main);
    font-weight: 500;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all var(--transition-normal);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-preset:hover {
    border-color: var(--border-hover);
    background: rgba(16, 185, 129, 0.05);
}

.btn-preset.active {
    background: linear-gradient(135deg, var(--color-primary-glow), rgba(245, 158, 11, 0.05));
    border-color: var(--color-primary);
    color: var(--color-primary);
    font-weight: 600;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.1);
}

.btn-preset-custom {
    border-style: dashed;
    color: var(--text-muted);
}

.btn-preset-custom.active {
    color: var(--color-primary);
}

/* Custom recipe save/upload controls */
.custom-recipe-row {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.custom-recipe-row input[type="text"] {
    flex: 1;
}

.btn-recipe-action {
    flex-shrink: 0;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    font-weight: 600;
    font-size: 0.875rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: all var(--transition-normal);
    white-space: nowrap;
}

.btn-recipe-action:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
    background: rgba(16, 185, 129, 0.05);
}

.btn-recipe-action svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

@media (max-width: 600px) {
    .custom-recipe-row {
        flex-wrap: wrap;
    }
    .custom-recipe-row input[type="text"] {
        flex-basis: 100%;
    }
    .btn-recipe-action {
        flex: 1;
        justify-content: center;
    }
}

/* Recipe Ingredients list */
.ingredients-card {
    display: flex;
    flex-direction: column;
}

.ingredients-header-row {
    display: grid;
    grid-template-columns: 80px 100px 1fr auto;
    gap: 1rem;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 0.5rem;
}

.ingredients-header-row span {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.ingredients-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 0.25rem;
}

.ingredients-list::-webkit-scrollbar {
    width: 6px;
}

.ingredients-list::-webkit-scrollbar-track {
    background: transparent;
}

.ingredients-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: var(--radius-full);
}

.ingredients-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.ingredient-item {
    display: grid;
    grid-template-columns: 80px 100px 1fr auto;
    gap: 1rem;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius-md);
    transition: all var(--transition-normal);
}

.ingredient-item:hover {
    border-color: rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
}

.ingredient-qty {
    font-weight: 700;
    color: var(--color-secondary);
    font-size: 1.1rem;
    text-shadow: 0 0 10px rgba(245, 158, 11, 0.15);
}

.ingredient-unit {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.ingredient-name {
    font-weight: 500;
    color: var(--text-main);
}

.btn-icon-danger {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

.btn-icon-danger:hover {
    color: var(--color-danger);
    background: rgba(244, 63, 94, 0.15);
}

.btn-icon-danger svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

/* Custom Add Ingredient Form */
.add-ingredient-form {
    display: grid;
    grid-template-columns: 90px 110px 1fr auto;
    gap: 1rem;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-color);
}

@media (max-width: 600px) {
    .add-ingredient-form {
        grid-template-columns: 1fr 1fr;
    }
    .add-ingredient-form input[type="text"] {
        grid-column: span 2;
    }
    .add-ingredient-form button {
        grid-column: span 2;
    }
}

.btn-add {
    background: var(--color-primary);
    border: none;
    color: var(--bg-main);
    font-weight: 700;
    padding: 0.75rem 1.25rem;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all var(--transition-normal);
}

.btn-add:hover {
    background: var(--color-primary-hover);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
    transform: translateY(-1px);
}

.btn-add svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 2.5;
    fill: none;
}

/* Converter Panel */
.converter-container {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.conversion-box {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: relative;
}

.converter-row {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    padding: 1.25rem;
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    position: relative;
    transition: border-color var(--transition-normal);
}

.converter-row:focus-within {
    border-color: var(--border-hover);
}

.converter-row-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.converter-row-header span {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.converter-inputs {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 0.75rem;
}

/* Swap Button Placement and Styling */
.swap-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: -0.75rem 0;
    position: relative;
    z-index: 10;
}

.btn-swap {
    background: linear-gradient(135deg, var(--bg-input), rgba(31, 41, 55, 0.9));
    border: 1px solid var(--border-color);
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-primary);
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-normal);
}

.btn-swap:hover {
    border-color: var(--color-primary);
    color: var(--color-secondary);
    transform: rotate(180deg) scale(1.1);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.2);
}

.btn-swap svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 2.5;
    fill: none;
}

/* Conversion Result Panel */
.conversion-result-card {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.05), rgba(245, 158, 11, 0.02));
    border: 1px solid var(--color-primary-glow);
    padding: 1.25rem;
    border-radius: var(--radius-md);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 100px;
}

.result-formula {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.result-value {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-main);
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    letter-spacing: -0.01em;
}

.result-value-number {
    background: linear-gradient(to right, #ffffff, #e5e7eb);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.result-value-unit {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--color-secondary);
}

/* Empty States */
.empty-ingredients {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
    font-style: italic;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.empty-ingredients svg {
    width: 48px;
    height: 48px;
    stroke: rgba(255, 255, 255, 0.15);
    stroke-width: 1.5;
    fill: none;
}

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

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

/* Quick unit guides / shortcuts */
.converter-shortcuts {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.shortcuts-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 0.75rem;
    letter-spacing: 0.05em;
}

.shortcuts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.btn-shortcut {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    cursor: pointer;
    text-align: left;
    transition: all var(--transition-fast);
}

.btn-shortcut:hover {
    border-color: var(--color-secondary);
    color: var(--text-main);
    background: rgba(245, 158, 11, 0.05);
}

/* Custom CSS Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-main);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}
