:root {
    --bg-color: #0b0c10;
    --card-bg: rgba(31, 40, 51, 0.6);
    --card-border: rgba(102, 252, 241, 0.2);
    --text-primary: #ffffff;
    --text-secondary: #c5c6c7;
    --accent: #66fcf1;
    --accent-glow: rgba(102, 252, 241, 0.4);
    --accent-dark: #45a29e;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow-x: hidden;
}

/* Dynamic background glow */
.background-effect {
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, var(--accent-glow) 0%, transparent 40%);
    opacity: 0.3;
    z-index: -1;
    pointer-events: none;
    animation: drift 20s infinite linear alternate;
}

@keyframes drift {
    0% { transform: translate(0, 0); }
    100% { transform: translate(5%, 5%); }
}

.container {
    width: 100%;
    max-width: 520px;
    padding: 2rem;
    z-index: 1;
}

header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.logo {
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: -1px;
    background: linear-gradient(90deg, var(--text-primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 300;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.glassmorphism {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

.calculator-card {
    padding: 2rem;
    margin-bottom: 2rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.calculator-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.45);
}

.input-group {
    display: flex;
    flex-direction: column;
    margin-bottom: 1.5rem;
}

.input-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 0;
}

.weight-input-group {
    flex: 2;
    margin-bottom: 0;
}

.unit-input-group {
    flex: 1;
    margin-bottom: 0;
}

label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.currency-symbol {
    position: absolute;
    left: 1rem;
    color: var(--accent);
    font-weight: 600;
    font-size: 1.1rem;
}

input, select {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 0.8rem 1rem;
    font-family: 'Inter', sans-serif;
    font-size: 1.1rem;
    color: var(--text-primary);
    transition: all 0.3s ease;
    outline: none;
}

.input-wrapper input {
    padding-left: 2.2rem;
}

input:focus, select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(102, 252, 241, 0.2);
    background: rgba(0, 0, 0, 0.3);
}

/* Remove arrows from number input */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
input[type=number] {
    -moz-appearance: textfield;
}

.unit-toggle {
    display: flex;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 3px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.unit-btn {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    padding: 0.7rem 0.5rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
    outline: none;
}

.unit-btn:hover {
    color: var(--text-primary);
}

.unit-btn.active {
    background: var(--accent);
    color: var(--bg-color);
}

.section-note {
    text-align: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin: -1.5rem 0 2rem 0;
    font-weight: 400;
    font-style: italic;
    opacity: 0.7;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.result-card {
    padding: 1.1rem 0.6rem;
    text-align: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.result-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255,255,255,0.05) 0%, transparent 100%);
    pointer-events: none;
}

.result-card:hover {
    transform: translateY(-4px);
    border-color: var(--accent);
    box-shadow: 0 0 20px rgba(102, 252, 241, 0.15);
}

.result-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    font-weight: 600;
    border-bottom: 1px solid rgba(102, 252, 241, 0.1);
    padding-bottom: 0.5rem;
}

.result-data {
    display: flex;
    justify-content: space-around;
    gap: 0.25rem;
}

.result-item:not(:last-child) {
    border-right: 1px solid rgba(102, 252, 241, 0.1);
}

.result-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 0 0.15rem;
}

.section-separator {
    display: flex;
    align-items: center;
    text-align: center;
    margin: 2.5rem 0;
    opacity: 0.8;
}

.section-separator::before,
.section-separator::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--card-border);
}

.section-separator span {
    padding: 0 1rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--accent);
}

.result-sublabel {
    display: block;
    font-size: 0.58rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.3rem;
    font-weight: 600;
}

.result-value {
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: 0.2px;
    white-space: nowrap;
}

.cost-value {
    color: var(--accent);
}

.sale-value {
    color: #ffffff;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.profit-value {
    color: #4ade80;
    text-shadow: 0 0 10px rgba(74, 222, 128, 0.35);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.calculator-card {
    animation: fadeIn 0.6s ease-out;
}

.result-card {
    animation: fadeIn 0.6s ease-out backwards;
}

.result-card:nth-child(1) { animation-delay: 0.15s; }
.result-card:nth-child(2) { animation-delay: 0.25s; }
.result-card:nth-child(3) { animation-delay: 0.35s; }
.result-card:nth-child(4) { animation-delay: 0.45s; }
.result-card:nth-child(5) { 
    animation-delay: 0.55s; 
    grid-column: span 2;
}

/* Budget Card Styles */
.budget-card {
    animation-delay: 0.08s;
}

.section-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid var(--card-border);
    padding-bottom: 0.5rem;
}

.budget-results {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1.5rem;
}

.budget-result-item {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 1rem 0.5rem;
    text-align: center;
    transition: all 0.3s ease;
}

.budget-result-item:hover {
    border-color: var(--accent);
    background: rgba(102, 252, 241, 0.05);
}

.budget-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.3rem;
    font-weight: 600;
}

.budget-value {
    display: block;
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--accent);
    letter-spacing: 0.5px;
}

.budget-financials {
    margin-top: 1rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 1.1rem 0.6rem;
    text-align: center;
    transition: all 0.3s ease;
}

.budget-financials:hover {
    border-color: var(--accent);
    background: rgba(102, 252, 241, 0.05);
    box-shadow: 0 0 20px rgba(102, 252, 241, 0.15);
}

@media (max-width: 480px) {
    .results-grid {
        grid-template-columns: 1fr;
    }
    
    .result-card:nth-child(5) { 
        grid-column: span 1;
    }
    
    .input-row {
        flex-direction: column;
    }
}
