/* Base Styles */
:root {
    --bg-color: #0b0f19;
    --card-bg: rgba(22, 31, 48, 0.7);
    --border-color: rgba(42, 56, 84, 0.6);
    --primary-color: #3b82f6;
    --primary-glow: rgba(59, 130, 246, 0.35);
    --accent-red: #ef4444;
    --accent-red-glow: rgba(239, 68, 68, 0.4);
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --text-green: #10b981;
    --font-outfit: 'Outfit', sans-serif;
    --font-jakarta: 'Plus Jakarta Sans', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-jakarta);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    overflow-x: hidden;
    padding: 20px;
}

/* Background decoration */
.background-decor {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    pointer-events: none;
}

.circle {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
}

.circle-1 {
    width: 400px;
    height: 400px;
    background: rgba(99, 102, 241, 0.15);
    top: -100px;
    right: -50px;
}

.circle-2 {
    width: 500px;
    height: 500px;
    background: rgba(239, 68, 68, 0.08);
    bottom: -150px;
    left: -100px;
}

/* Container */
.app-container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 40px;
}

.logo {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-family: var(--font-outfit);
    font-size: 2.2rem;
    font-weight: 800;
    background: linear-gradient(135deg, #ffffff 30%, #a5b4fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 10px;
    letter-spacing: 1px;
}

.logo i {
    background: linear-gradient(135deg, #3b82f6, #818cf8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 0 10px rgba(99, 102, 241, 0.5));
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
    font-weight: 400;
}

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

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

/* Cards style (Glassmorphism) */
.card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.45);
}

.card-title {
    font-family: var(--font-outfit);
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 25px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
    letter-spacing: 0.5px;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

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

.form-select, input[type="text"], input[type="number"] {
    width: 100%;
    background-color: rgba(15, 23, 42, 0.6);
    border: 1.5px solid var(--border-color);
    color: var(--text-main);
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 1rem;
    outline: none;
    font-family: var(--font-jakarta);
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-select:focus, input[type="text"]:focus, input[type="number"]:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 12px var(--primary-glow);
}

/* Red Dropdown Special Box Styling */
.form-group.highlight-red label {
    color: #fca5a5;
}

.custom-select-red {
    border: 2px solid var(--accent-red) !important;
    background-color: rgba(239, 68, 68, 0.08) !important;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.1) !important;
    color: #fecaca !important;
    font-weight: 600;
}

.custom-select-red:focus {
    border-color: #ff8787 !important;
    box-shadow: 0 0 15px var(--accent-red-glow) !important;
}

/* Input wrappers */
.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper input {
    padding-right: 45px;
}

.input-addon {
    position: absolute;
    right: 16px;
    color: var(--text-muted);
    font-weight: 600;
}

.formatted-preview {
    display: block;
    margin-top: 5px;
    font-size: 0.85rem;
    color: var(--text-green);
    font-weight: 500;
    text-align: right;
}

.duration-row {
    display: grid;
    grid-template-columns: 1fr 120px;
    gap: 10px;
}

/* Button Calculate */
.btn-calculate {
    width: 100%;
    background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
    border: none;
    color: white;
    padding: 15px;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 700;
    font-family: var(--font-outfit);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    transition: transform 0.2s ease, box-shadow 0.3s ease, filter 0.3s ease;
    box-shadow: 0 4px 15px var(--primary-glow);
    margin-top: 10px;
}

.btn-calculate:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
    filter: brightness(1.1);
}

.btn-calculate:active {
    transform: translateY(0);
}

/* Results layout right panel */
.result-layout {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 25px;
}

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

.stat-box {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

.stat-value {
    font-size: 1.3rem;
    font-weight: 700;
    font-family: var(--font-outfit);
}

.accent-box {
    border-color: rgba(16, 185, 129, 0.3);
    background: rgba(16, 185, 129, 0.03);
}

.text-green {
    color: var(--text-green);
    text-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
}

.total-box {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.08) 0%, rgba(99, 102, 241, 0.08) 100%);
    border-color: rgba(99, 102, 241, 0.4);
    text-align: center;
}

.total-box .stat-value {
    font-size: 2rem;
    color: #a5b4fc;
    text-shadow: 0 0 15px rgba(165, 180, 252, 0.3);
}

/* Formula info styling */
.formula-box {
    background-color: rgba(15, 23, 42, 0.5);
    border-radius: 12px;
    padding: 15px 20px;
    border-left: 4px solid var(--primary-color);
}

.formula-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    display: block;
    margin-bottom: 5px;
}

.formula-latex {
    font-family: 'Outfit', monospace;
    font-size: 1.25rem;
    font-weight: 700;
    color: #93c5fd;
    margin: 8px 0;
    letter-spacing: 0.5px;
}

.formula-details {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Chart */
.chart-container {
    position: relative;
    height: 300px;
    width: 100%;
}

/* Detailed Table Section */
.table-card {
    margin-bottom: 40px;
}

.table-responsive {
    overflow-x: auto;
    width: 100%;
    margin-top: 10px;
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.95rem;
}

th, td {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border-color);
}

th {
    font-family: var(--font-outfit);
    font-weight: 600;
    color: var(--text-muted);
    background-color: rgba(15, 23, 42, 0.4);
}

tr:hover td {
    background-color: rgba(255, 255, 255, 0.02);
}

tr:last-child td {
    border-bottom: none;
}

/* Footer */
footer {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 20px 0 40px 0;
    border-top: 1px solid var(--border-color);
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

footer a:hover {
    text-decoration: underline;
}

/* Animation Micro-effects */
@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 10px rgba(239, 68, 68, 0.1); }
    50% { box-shadow: 0 0 20px rgba(239, 68, 68, 0.25); }
}

.custom-select-red {
    animation: pulseGlow 3s infinite ease-in-out;
}
