:root {
    --primary: #e63946;
    --primary-hover: #d62828;
    --bg-dark: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.7);
    --text-main: #f8fafc;
    --text-dim: #94a3b8;
    --border-color: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --accent-glow: rgba(230, 57, 70, 0.2);
}

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

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

.bg-glow {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: radial-gradient(circle at 50% 50%, #1e293b 0%, #0f172a 100%);
}

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

.logo-container {
    margin-bottom: 1.5rem;
    text-align: center;
}

.main-logo {
    height: 120px;
    width: auto;
    filter: drop-shadow(0 0 10px rgba(230, 57, 70, 0.3));
}

h1 {
    font-size: 3rem;
    font-weight: 800;
    margin-top: 1rem;
    text-align: center;
    background: linear-gradient(to right, #fff, var(--text-dim));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    color: var(--text-dim);
    font-size: 1.25rem;
    max-width: 600px;
    margin: 1rem auto 4rem;
    text-align: center;
}

.calculator-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    align-items: start;
}

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

.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: var(--glass-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.glass-card:hover {
    box-shadow: 0 8px 32px 0 var(--accent-glow);
}

.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-dim);
    font-weight: 500;
}

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

input:not([type="checkbox"]),
select {
    width: 100%;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    color: white;
    font-size: 1.1rem;
    transition: border-color 0.2s;
    appearance: none;
    -webkit-appearance: none;
}

select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 1.2rem;
    cursor: pointer;
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--primary);
}

.prefix {
    position: absolute;
    left: 1rem;
    color: var(--text-dim);
}

input#rent {
    padding-left: 2.5rem;
}

.suffix {
    position: absolute;
    right: 1rem;
    color: var(--text-dim);
}

.btn-primary {
    width: 100%;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 1.25rem;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: 1rem;
    transition: background 0.2s, transform 0.1s;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
}

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

.results-layout {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.chart-wrapper {
    height: 420px;
}

.info-card h3,
.chart-card h3,
.final-impact-card h3 {
    margin-bottom: 1.5rem;
    font-size: 1.25rem;
    color: var(--primary);
}

.summary-text {
    font-size: 1.1rem;
    color: var(--text-main);
}

.summary-text strong {
    color: var(--primary);
}

.exempt-notice {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(34, 197, 94, 0.12);
    border: 1px solid rgba(34, 197, 94, 0.4);
    border-radius: 10px;
    padding: 0.85rem 1.25rem;
    margin-bottom: 1.25rem;
}

.exempt-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    min-width: 28px;
    background: rgba(34, 197, 94, 0.2);
    border-radius: 50%;
    color: #22c55e;
    font-size: 1rem;
    font-weight: 700;
}

.exempt-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: #22c55e;
    letter-spacing: 0.05em;
}

.summary-text p {
    margin: 0.5rem 0 0;
    font-size: 0.95rem;
    line-height: 1.55;
}

.impact-stats {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.stat-item {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-dim);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 800;
}

.highlight .stat-value {
    color: var(--primary);
}

.danger .stat-value {
    color: #ef4444;
}

.warning-note {
    font-size: 0.85rem;
    color: var(--text-dim);
    text-align: center;
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-slide-up {
    animation: fadeInUp 0.6s ease forwards;
}

.animate-fade-in {
    animation: fadeIn 0.8s ease forwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.sha-footer {
    margin-top: 4rem;
    text-align: center;
}

.footer-logo {
    height: 60px;
    width: auto;
    margin-bottom: 1.5rem;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1.5rem;
}

.social-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-dim);
    transition: all 0.3s ease;
    text-decoration: none;
}

.social-icon:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(230, 57, 70, 0.4);
}

.social-icon svg {
    width: 20px;
    height: 20px;
}

/* IPC per any */
.ipc-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.5rem;
}

.ipc-item {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.ipc-year-label {
    font-size: 0.72rem;
    color: var(--text-dim);
    text-align: center;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.ipc-grid input {
    padding: 0.6rem 1.5rem 0.6rem 0.5rem;
    font-size: 0.9rem;
    text-align: center;
}

.ipc-grid .input-wrapper {
    position: relative;
}

.ipc-grid .suffix {
    font-size: 0.75rem;
    right: 0.4rem;
}

/* Banner informatiu */
.info-banner {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-top: 2rem;
    padding: 1.25rem 1.75rem;
    border-left: 4px solid #f59e0b;
    border-radius: 12px;
}

.info-banner-icon {
    font-size: 1.4rem;
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.info-banner p {
    margin: 0;
    font-size: 0.95rem;
    color: var(--text-main);
    line-height: 1.6;
}

.info-banner strong {
    color: #f59e0b;
}

/* Checkboxes d'exclusió */
.exclusions-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.checkbox-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    cursor: pointer;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    border: 1px solid transparent;
    transition: background 0.2s, border-color 0.2s;
}

.checkbox-item:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--border-color);
}

.checkbox-item input[type="checkbox"] {
    width: 16px;
    height: 16px;
    min-width: 16px;
    accent-color: var(--primary);
    cursor: pointer;
    margin-top: 0.2rem;
}

.checkbox-label {
    font-size: 0.875rem;
    color: var(--text-dim);
    line-height: 1.45;
}

.checkbox-item:has(input:checked) {
    background: rgba(230, 57, 70, 0.08);
    border-color: rgba(230, 57, 70, 0.3);
}

.checkbox-item:has(input:checked) .checkbox-label {
    color: var(--text-main);
}

/* Banner d'advertència per a contractes exempts */
.warning-notice {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    background: rgba(230, 57, 70, 0.12);
    border: 1px solid rgba(230, 57, 70, 0.5);
    border-radius: 10px;
    padding: 0.85rem 1.25rem;
    margin-bottom: 1.25rem;
}

.warning-notice-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
    margin-top: 0.05rem;
}

.warning-notice-title {
    font-size: 0.95rem;
    font-weight: 800;
    color: #e63946;
    letter-spacing: 0.03em;
    line-height: 1.4;
}

/* Advertència de risc d'expulsió sota l'any d'alliberament */
.eviction-warning {
    font-size: 0.75rem;
    font-weight: 700;
    color: #f59e0b;
    letter-spacing: 0.04em;
    margin-top: 0.3rem;
    text-align: center;
    animation: pulse-amber 2s ease-in-out infinite;
}

@keyframes pulse-amber {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.6; }
}

/* Privacy Disclaimer */
.disclaimer {
    font-size: 0.8rem;
    color: var(--text-dim);
    text-align: center;
    margin-top: 1.5rem;
    line-height: 1.5;
}

.privacy-details {
    margin-top: 0.5rem;
    text-align: left;
}

.privacy-details summary {
    cursor: pointer;
    color: var(--text-dim);
    text-decoration: underline;
    text-align: center;
    display: inline-block;
    width: 100%;
}

.privacy-details summary:hover {
    color: var(--text-main);
}

.privacy-content {
    margin-top: 1rem;
    padding: 1.25rem;
    background-color: rgba(15, 23, 42, 0.6);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    font-size: 0.85rem;
}

.privacy-content ul {
    padding-left: 1.5rem;
    margin-bottom: 0;
    margin-top: 0.75rem;
}

.privacy-content li {
    margin-bottom: 0.5rem;
}

.privacy-content p {
    margin-top: 0.75rem;
    margin-bottom: 0;
}