:root {
    --primary-color: #4f46e5; /* Indigo 600 */
    --primary-hover: #4338ca; /* Indigo 700 */
    --secondary-color: #ec4899; /* Pink 500 */
    --background-color: #f3f4f6; /* Gray 100 */
    --card-bg: #ffffff;
    --text-main: #1f2937; /* Gray 800 */
    --text-muted: #6b7280; /* Gray 500 */
    --border-color: #e5e7eb; /* Gray 200 */
    --focus-ring: rgba(79, 70, 229, 0.4);
    --radius-lg: 16px;
    --radius-md: 8px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--background-color);
    color: var(--text-main);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Header */
.app-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 2rem 0;
    text-align: center;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
}

.app-header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.app-header p {
    opacity: 0.9;
    font-weight: 300;
}

/* Main Layout */
.app-main {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    padding-bottom: 2rem;
}

@media (min-width: 900px) {
    .app-main {
        grid-template-columns: 1fr 1fr;
        align-items: start;
    }
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 2rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.card h2 {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--background-color);
    padding-bottom: 0.75rem;
    color: var(--text-main);
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.95rem;
}

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

.input-with-unit input {
    width: 100%;
    padding: 0.75rem 1rem;
    padding-right: 3rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    transition: all 0.2s;
}

.input-with-unit input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--focus-ring);
}

.input-with-unit .unit {
    position: absolute;
    right: 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    pointer-events: none;
}

select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 1rem;
    background-color: white;
    cursor: pointer;
}

/* Toggle Group (Loan Type) */
.toggle-group {
    display: flex;
    background: var(--background-color);
    padding: 0.25rem;
    border-radius: var(--radius-md);
    gap: 0.25rem;
}

.toggle-group input[type="radio"] {
    display: none;
}

.toggle-group label {
    flex: 1;
    text-align: center;
    padding: 0.5rem;
    margin: 0;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: all 0.2s;
}

.toggle-group input[type="radio"]:checked + label {
    background: white;
    color: var(--primary-color);
    box-shadow: var(--shadow-sm);
}

/* Payment Method Cards */
.payment-method-options {
    display: flex;
    gap: 1rem;
}

.radio-card {
    flex: 1;
    position: relative;
}

.radio-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    z-index: 1;
}

.radio-card label {
    display: flex;
    flex-direction: column;
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
    height: 100%;
    margin-bottom: 0;
}

.radio-card input:checked + label {
    border-color: var(--primary-color);
    background-color: rgba(79, 70, 229, 0.05);
}

.method-title {
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.25rem;
}

.radio-card input:checked + label .method-title {
    color: var(--primary-color);
}

.method-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.3;
}

/* Button */
.btn-primary {
    width: 100%;
    padding: 1rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.4);
}

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

.btn-primary:active {
    transform: translateY(1px);
}

/* Results */
.results-summary {
    text-align: center;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: linear-gradient(to right, #4f46e50d, #ec48990d);
    border-radius: var(--radius-md);
    border: 1px solid rgba(79, 70, 229, 0.1);
}

.result-item.highlight .value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1;
    display: block;
    margin: 0.5rem 0;
}

.result-item.highlight .label {
    font-size: 1rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.result-item.highlight .unit {
    font-size: 1rem;
    color: var(--text-muted);
}

.sub-text {
    font-size: 0.85rem;
    color: var(--secondary-color);
    margin-top: 0.5rem;
    min-height: 1.2em;
}

.results-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
    text-align: center;
}

.results-grid .result-item .label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.results-grid .result-item .value {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-main);
}

.results-grid .result-item .unit {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* Utilities */
.hidden {
    display: none !important;
}

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

/* AdSense Placeholders */
.ad-container {
    width: 100%;
    margin-bottom: 1.5rem;
    text-align: center;
}

.ad-top {
    max-width: 900px;
    margin: 0 auto 2rem auto;
}

.ad-placeholder {
    background-color: #f1f5f9;
    border: 2px dashed #cbd5e1;
    color: #94a3b8;
    padding: 2rem;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100px;
}

.ad-content .ad-placeholder {
    min-height: 250px;
    margin-top: 2rem;
}
