/* CSS Reset & Variables */
:root {
    --primary-color: #10b981;       /* Emerald 500 */
    --primary-dark: #047857;        /* Emerald 700 */
    --primary-light: #d1fae5;       /* Emerald 100 */
    --accent-color: #34d399;        /* Emerald 400 */
    --bg-gradient: linear-gradient(135deg, #f0fdf4 0%, #ecfdf5 100%);
    --surface-color: #ffffff;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --border-color: #e5e7eb;
    --shadow-soft: 0 10px 30px -5px rgba(16, 185, 129, 0.1);
    --shadow-hover: 0 20px 40px -5px rgba(16, 185, 129, 0.2);
    --radius-lg: 24px;
    --radius-md: 12px;
    --danger-color: #ef4444;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background: var(--bg-gradient);
    color: var(--text-primary);
    min-height: 100vh;
    padding: 20px;
    line-height: 1.6;
}

.app-container {
    max-width: 900px;
    margin: 0 auto;
}

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

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

/* Hero Section */
.hero {
    text-align: center;
    margin-bottom: 40px;
    padding-top: 40px;
    animation: fadeIn 0.8s ease-out;
}

.badge {
    display: inline-block;
    background-color: var(--primary-light);
    color: var(--primary-dark);
    padding: 6px 16px;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.hero h1 {
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary-dark);
    margin-bottom: 10px;
}

.hero .subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    max-width: 500px;
    margin: 0 auto;
}

/* Cards & Layout */
.calculator-card, .results-container {
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-soft);
    padding: 40px;
    margin-bottom: 30px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.8);
}

#input-section {
    animation: fadeIn 1s ease-out;
}

.card-header {
    text-align: center;
    margin-bottom: 30px;
}

.card-header h2 {
    color: var(--text-primary);
    margin-bottom: 5px;
}

.card-header p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* Inputs */
.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.currency-symbol {
    position: absolute;
    left: 16px;
    color: var(--text-secondary);
    font-weight: 500;
}

input[type="number"] {
    width: 100%;
    padding: 14px 14px 14px 35px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    transition: all 0.2s;
    outline: none;
    background: #f9fafb;
}

input[type="number"]:focus {
    border-color: var(--primary-color);
    background: white;
    box-shadow: 0 0 0 4px var(--primary-light);
}

.highlight-group input {
    font-size: 1.25rem;
    padding: 18px 18px 18px 40px;
    border-color: var(--primary-light);
    background: #f0fdf4;
}

.highlight-group input:focus {
    background: white;
}

.tooltip {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--text-secondary);
    color: white;
    font-size: 0.7rem;
    cursor: help;
    opacity: 0.5;
}

.divider {
    height: 1px;
    background: var(--border-color);
    margin: 30px 0;
}

.grid-inputs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

h3 {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 10px;
}

/* Buttons */
.cta-button {
    width: 100%;
    margin-top: 30px;
    padding: 18px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 6px rgba(16, 185, 129, 0.2);
}

.cta-button:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(16, 185, 129, 0.3);
}

.cta-button:active {
    transform: translateY(0);
}

.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.reset-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    text-decoration: underline;
    cursor: pointer;
    font-size: 0.9rem;
}

.reset-btn:hover {
    color: var(--primary-dark);
}

/* Results Dashboard */
.hidden {
    display: none;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 20px;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.kpi-card {
    background: #f8fafc;
    padding: 24px;
    border-radius: var(--radius-md);
    text-align: center;
    transition: transform 0.2s;
}

.kpi-card:hover {
    transform: translateY(-5px);
}

.kpi-card h3 {
    font-size: 1rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.kpi-card .value {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 10px 0;
}

.profit-card .value { color: var(--primary-color); }
.margin-card .value { color: var(--primary-dark); }
.expense-card .value { color: var(--danger-color); }

.sub-text {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Charts */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.chart-card {
    background: white;
    padding: 20px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.chart-wrapper {
    position: relative;
    height: 250px;
    width: 100%;
}

/* Insight Card */
.insight-card {
    background: var(--primary-light);
    border: 1px solid var(--accent-color);
    padding: 20px;
    border-radius: var(--radius-md);
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.insight-icon {
    font-size: 1.5rem;
    background: white;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
}

.insight-text {
    font-size: 0.95rem;
    color: var(--primary-dark);
}

/* Mobile Responsiveness */
@media (max-width: 600px) {
    .hero h1 { font-size: 2.2rem; }
    .calculator-card, .results-container { padding: 25px; }
    .currency-symbol { left: 12px; }
    input[type="number"] { padding-left: 30px; }
    .charts-grid { grid-template-columns: 1fr; }
}
