:root {
    --light-red: #f9c5c5;
    --light-red-hover: #f7b0b0;
    --minty-green: #bce3d1;
    --minty-green-hover: #a9d8c1;
    --dark-text: #333333;
    --light-text: #ffffff;
    --background: #f9f9f9;
    --card-bg: #ffffff;
    --shadow: rgba(0, 0, 0, 0.1);
    --border-radius: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

@keyframes shimmerBackground {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

body {
    font-family: 'Poppins', sans-serif;
    color: var(--dark-text);
    line-height: 1.6;
    background: linear-gradient(135deg, 
        rgba(249, 197, 197, 0.2),
        rgba(188, 227, 209, 0.3),
        rgba(249, 197, 197, 0.2), 
        rgba(188, 227, 209, 0.3));
    background-size: 400% 400%;
    animation: shimmerBackground 15s ease infinite;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
    position: relative;
    z-index: 1;
}

header {
    text-align: center;
    margin-bottom: 2rem;
}

header a {
    text-decoration: none;
}

header h1 {
    font-family: 'Dancing Script', cursive;
    font-size: 3.2rem;
    font-weight: 600;
    color: var(--dark-text);
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.05);
    background: linear-gradient(45deg, var(--light-red), var(--minty-green));
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    transition: transform 0.3s ease;
    display: inline-block;
}

header h1:hover {
    transform: scale(1.03);
}

header p {
    font-size: 1.1rem;
    color: #666;
}

.calculator-wrapper {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    justify-content: space-between;
    margin-bottom: 3rem;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: 0 8px 20px var(--shadow);
    backdrop-filter: blur(10px);
    background-color: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.partner-section {
    flex: 1;
    min-width: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.partner-one {
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.6), rgba(249, 197, 197, 0.3));
    border-radius: var(--border-radius);
    padding: 1.5rem;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(249, 197, 197, 0.3);
}

.partner-two {
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.6), rgba(188, 227, 209, 0.3));
    border-radius: var(--border-radius);
    padding: 1.5rem;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(188, 227, 209, 0.3);
}

/* Partner image styling */
.partner-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.partner-image:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.image-placeholder {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f9c5c5, #a8e6cf);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    border: 3px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.image-placeholder:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

/* Remove default image styling when actual images are present */
.image-placeholder .default-image {
    display: none;
}

.default-image {
    color: var(--light-text);
    font-size: 1.2rem;
    font-weight: 500;
    text-align: center;
}

.calculator-center {
    flex: 1;
    min-width: 250px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1.5rem;
    padding: 2rem;
    border-radius: var(--border-radius);
    background: linear-gradient(135deg, rgba(249, 197, 197, 0.1), rgba(188, 227, 209, 0.1));
    backdrop-filter: blur(5px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
}

label {
    font-weight: 500;
    margin-bottom: 0.5rem;
    display: block;
}

.input-group {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.currency {
    position: absolute;
    left: 1rem;
    font-weight: 500;
    color: #666;
}

input[type="number"] {
    width: 100%;
    padding: 0.8rem 1rem 0.8rem 2rem;
    border: 2px solid #e0e0e0;
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.3s;
}

input[type="number"]:focus {
    outline: none;
    border-color: var(--minty-green);
}

.fairness-ratio {
    text-align: center;
    margin: 1.5rem 0;
}

#ratio-display {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--dark-text);
    display: block;
    margin-bottom: 0.5rem;
}

.ratio-bar {
    height: 12px;
    background-color: var(--minty-green);
    border-radius: 6px;
    overflow: hidden;
}

.ratio-fill {
    height: 100%;
    background-color: var(--light-red);
    border-radius: 6px 0 0 6px;
    transition: width 0.5s;
}

button {
    background-color: var(--minty-green);
    color: var(--dark-text);
    border: none;
    padding: 1rem;
    border-radius: var(--border-radius);
    font-size: 1.1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
}

button:hover {
    background-color: var(--minty-green-hover);
}

button:active {
    transform: scale(0.98);
}

.results {
    margin-top: 2rem;
    padding: 2rem;
    background-color: rgba(255, 255, 255, 0.85);
    border-radius: var(--border-radius);
    box-shadow: 0 8px 20px var(--shadow);
    text-align: center;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.5s, transform 0.5s;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.results.hidden {
    opacity: 0;
    transform: translateY(20px);
    display: none;
}

.results h2 {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    color: var(--dark-text);
}

.result-cards {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
}

.result-card {
    padding: 1.5rem;
    border-radius: var(--border-radius);
    min-width: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.partner-one-card {
    background-color: rgba(249, 197, 197, 0.2);
}

.partner-two-card {
    background-color: rgba(188, 227, 209, 0.2);
}

.result-card h3 {
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}

.amount {
    font-size: 2rem;
    font-weight: 600;
    margin: 0.5rem 0;
}

.percentage {
    font-size: 1.1rem;
    color: #666;
}

footer {
    margin-top: 3rem;
    text-align: center;
    color: #666;
}

.share-section {
    margin-top: 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

#share-btn {
    background-color: var(--light-red);
    font-size: 0.9rem;
    padding: 0.5rem 1rem;
}

#share-btn:hover {
    background-color: var(--light-red-hover);
}

#share-link {
    color: var(--dark-text);
    text-decoration: underline;
    font-size: 0.9rem;
}

#share-link.hidden {
    display: none;
}

/* Sparkling stars animation */
@keyframes twinkle {
    0% { opacity: 0; transform: scale(0.5); }
    50% { opacity: 1; transform: scale(1); }
    100% { opacity: 0; transform: scale(0.5); }
}

.star {
    position: absolute;
    width: 3px;
    height: 3px;
    background-color: white;
    border-radius: 50%;
    box-shadow: 0 0 3px 1px rgba(255, 255, 255, 0.5),
                0 0 5px 2px var(--light-red),
                0 0 8px 3px var(--minty-green);
    opacity: 0;
    pointer-events: none;
    z-index: 0;
    will-change: transform, opacity, left, top;
}

.star:nth-child(3n) {
    box-shadow: 0 0 3px 1px rgba(255, 255, 255, 0.5),
                0 0 5px 2px var(--light-red);
}

.star:nth-child(3n+1) {
    box-shadow: 0 0 3px 1px rgba(255, 255, 255, 0.5),
                0 0 5px 2px var(--minty-green);
}

.star:nth-child(5n) {
    animation-duration: 7s !important;
}

#stars-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    pointer-events: none;
    z-index: -1;
}

/* Special star shapes */
.star.heart {
    width: 5px;
    height: 5px;
    background-color: var(--light-red);
    position: absolute;
    transform: rotate(-45deg) scale(0.5);
    transform-origin: center;
}

.star.heart:before,
.star.heart:after {
    content: "";
    width: 5px;
    height: 5px;
    background-color: var(--light-red);
    border-radius: 50%;
    position: absolute;
}

.star.heart:before {
    top: -2.5px;
    left: 0;
}

.star.heart:after {
    top: 0;
    left: 2.5px;
}

/* Additional star animations */
@keyframes pulse {
    0% { transform: scale(0.5) rotate(0deg); }
    50% { transform: scale(1) rotate(180deg); }
    100% { transform: scale(0.5) rotate(360deg); }
}

.star:nth-child(7n) {
    animation-name: pulse !important;
}

/* PWA Install Prompt Styles */
.install-prompt {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.98));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    padding: 0;
    z-index: 1000;
    transform: translateY(100%);
    transition: transform 0.3s ease-in-out;
    border-top-left-radius: 15px;
    border-top-right-radius: 15px;
}

.install-prompt.show {
    transform: translateY(0);
}

.install-prompt-content {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.install-prompt-message {
    display: flex;
    align-items: center;
    gap: 14px;
}

.install-prompt-icon {
    font-size: 2.5rem;
}

.install-prompt-text h3 {
    margin: 0;
    font-size: 1.2rem;
    margin-bottom: 4px;
    color: var(--dark-text);
}

.install-prompt-text p {
    margin: 0;
    font-size: 0.9rem;
    color: #666;
}

.install-prompt-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

#install-dismiss {
    background-color: transparent;
    color: #666;
    border: 1px solid #ddd;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
}

#install-dismiss:hover {
    background-color: #f1f1f1;
}

#install-accept {
    background: linear-gradient(135deg, var(--light-red), var(--minty-green));
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.2s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

#install-accept:hover {
    transform: scale(1.05);
}

/* Responsive layout */
@media (max-width: 768px) {
    .calculator-wrapper {
        flex-direction: column;
        align-items: center;
    }
    
    /* Mobile order: Chimmy Income, Tilly Income, then Bill */
    .partner-one {
        order: 1;
        width: 100%;
        margin-bottom: 1rem;
    }
    
    .partner-two {
        order: 2;
        width: 100%;
        margin-bottom: 1rem;
    }
    
    .calculator-center {
        order: 3;
        width: 100%;
        margin-bottom: 1.5rem;
    }
    
    /* Hide desktop calculate button on mobile */
    .desktop-only {
        display: none !important;
    }
    
    /* Collapsible partner sections on mobile */
    .partner-section {
        border-radius: var(--border-radius);
        overflow: hidden;
        transition: all 0.3s ease;
    }
    
    .partner-header {
        cursor: pointer;
        padding: 1rem;
        display: flex;
        align-items: center;
        gap: 1rem;
        background: inherit;
        border-radius: var(--border-radius);
        transition: all 0.3s ease;
    }
    
    .partner-header:hover {
        opacity: 0.9;
    }
    
    .partner-header .image-placeholder {
        width: 60px;
        height: 60px;
        margin: 0;
        flex-shrink: 0;
    }
    
    .partner-header label {
        flex: 1;
        margin: 0;
        font-weight: 600;
    }
    
    .collapse-indicator {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        gap: 0.25rem;
    }
    
    .income-preview {
        font-size: 0.9rem;
        font-weight: 500;
        color: var(--dark-text);
    }
    
    .expand-arrow {
        font-size: 0.8rem;
        transition: transform 0.3s ease;
        color: #666;
    }
    
    .partner-section.collapsed .expand-arrow {
        transform: rotate(-90deg);
    }
    
    .partner-section.collapsed .input-group {
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        margin: 0;
        padding: 0;
    }
    
    .partner-section .input-group {
        max-height: 200px;
        opacity: 1;
        transition: all 0.3s ease;
        margin: 0 1rem 1rem;
    }
    
    .result-cards {
        flex-direction: column;
        align-items: center;
    }
    
    .result-card {
        width: 100%;
    }
    
    .image-placeholder {
        width: 100px;
        height: 100px;
    }
    
    /* Remove smooth scrolling on mobile */
    * {
        scroll-behavior: auto !important;
    }
}

/* Hide mobile-specific elements on desktop */
.collapse-indicator {
    display: none;
}

.partner-header {
    display: contents; /* Make it behave as if it doesn't exist on desktop */
}

/* Focus improvements for accessibility */
.partner-header:focus {
    outline: 2px solid var(--minty-green);
    outline-offset: 2px;
}

input:focus {
    outline: 2px solid var(--light-red);
    outline-offset: 1px;
}

/* Touch improvements for mobile */
@media (max-width: 768px) {
    .partner-header {
        min-height: 60px;
        touch-action: manipulation;
    }
    
    input[type="number"] {
        font-size: 16px; /* Prevents zoom on iOS */
        min-height: 44px; /* Better touch target */
    }
}
