:root {
    --primary: #1e3a8a;
    --primary-light: #3b82f6;
    --accent: #f59e0b;
    --bg-body: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius: 16px;
    --glass: rgba(255, 255, 255, 0.8);
}

.dark-theme {
    --primary: #60a5fa;
    --primary-light: #93c5fd;
    --accent: #fbbf24;
    --bg-body: #0f172a;
    --bg-card: #1e293b;
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --border: #334155;
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    --glass: rgba(30, 41, 59, 0.8);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, transform 0.2s ease;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}

.background-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: linear-gradient(135deg, rgba(30, 58, 138, 0.05) 0%, rgba(59, 130, 246, 0.05) 100%);
    opacity: 0.8;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Header */
header {
    height: 70px;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border);
    background: var(--glass);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 100;
}

header .container {
    display: flex;
    justify-content: space-between;
    width: 100%;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}

.logo span span {
    color: var(--accent);
}

.logo-icon {
    width: 28px;
    height: 28px;
}

.icon-btn {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-main);
    padding: 8px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Hero */
.hero {
    text-align: center;
    padding: 40px 0 30px;
}

.hero h1 {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 10px;
    line-height: 1.2;
}

.hero h1 span {
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero p {
    color: var(--text-muted);
    font-size: 1rem;
    max-width: 500px;
    margin: 0 auto;
}

/* Layout - Mobile First */
.grid-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.card-header i {
    color: var(--primary);
    width: 20px;
}

.card-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
}

/* Forms */
.input-group {
    margin-bottom: 15px;
}

.input-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

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

.input-wrapper input, .range-input-wrapper input {
    width: 100%;
    padding: 12px 15px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-body);
    color: var(--text-main);
    font-size: 1rem;
    font-family: inherit;
    outline: none;
}

.currency, .unit {
    position: absolute;
    right: 15px;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.range-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.range-input-wrapper {
    width: 120px;
    align-self: flex-end;
}

input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: var(--border);
    border-radius: 5px;
    outline: none;
    margin: 10px 0;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: var(--primary);
    cursor: pointer;
    border-radius: 50%;
    border: 3px solid var(--bg-card);
}

.primary-btn {
    width: 100%;
    padding: 15px;
    border-radius: 10px;
    background: var(--primary);
    color: white;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 5px;
}

/* Results */
.results-container.hidden { display: none; }

.results-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.result-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 15px;
    position: relative;
    overflow: hidden;
}

.result-card.highlight {
    background: var(--primary);
    color: white;
}

.result-card .label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.result-card.highlight .label { color: rgba(255,255,255,0.7); }

.result-card .value {
    font-size: 1.5rem;
    font-weight: 700;
}

.card-bg-icon {
    position: absolute;
    right: -5px;
    bottom: -5px;
    width: 50px;
    height: 50px;
    opacity: 0.05;
}

.actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.secondary-btn {
    flex: 1;
    padding: 10px;
    border-radius: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-main);
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

/* History */
.history-card { margin-top: 20px; margin-bottom: 40px; }
.history-table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table {
    width: 100%;
    min-width: 500px;
    border-collapse: collapse;
}

th { text-align: left; padding: 12px; border-bottom: 2px solid var(--border); font-size: 0.85rem; color: var(--text-muted); }
td { padding: 12px; border-bottom: 1px solid var(--border); font-size: 0.9rem; }

.history-actions { display: flex; gap: 5px; }
.icon-btn.sm { padding: 5px; }
.icon-btn.delete-btn:hover { background: #ef4444; color: white; }

/* Toast */
.toast {
    position: fixed;
    bottom: 20px;
    left: 20px;
    right: 20px;
    background: var(--primary);
    color: white;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
    z-index: 1000;
}
.toast.hidden { display: none; }

/* Desktop Enhancements */
@media (min-width: 768px) {
    .container { padding: 0 30px; }
    .hero { padding: 60px 0 40px; }
    .hero h1 { font-size: 3rem; }
    .hero p { font-size: 1.2rem; }
    
    .grid-layout { grid-template-columns: 1fr 1fr; gap: 30px; }
    
    .results-grid { grid-template-columns: 1fr 1fr; }
    .result-card.highlight { grid-column: span 2; }
    
    .card { padding: 30px; }
    .logo { font-size: 24px; }
    
    .toast { left: auto; right: 20px; width: auto; min-width: 250px; }
}

[data-aos] { opacity: 0; transform: translateY(15px); transition: 0.5s ease-out; }
[data-aos].aos-animate { opacity: 1; transform: translateY(0); }
