/* Love Calculator Main Styles */
:root {
    --gradient-start: #fff5f8;
    --gradient-end: #f3e5f5;
    --primary-purple: #9c27b0;
    --primary-light: #ba68c8;
    --primary-dark: #7b1fa2;
    --soft-shadow: 0 10px 30px rgba(156, 39, 176, 0.15);
    --glow-color: rgba(156, 39, 176, 0.3);
    --text-dark: #4a148c;
    --text-light: #ffffff;
    --heart-color: #ff4081;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Container Styles */
.love-calculator-container {
    position: relative;
    min-height: 100vh;
    width: 100%;
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    overflow-x: hidden;
    padding: 20px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.love-calculator-wrapper {
    position: relative;
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    z-index: 2;
}

/* Animation Containers */
.flowers-container,
.hearts-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

/* Falling Flowers Animation */
.falling-flower {
    position: fixed;
    top: -10%;
    animation: fall linear infinite;
    z-index: 1;
    opacity: 0.7;
    filter: drop-shadow(0 2px 5px rgba(0,0,0,0.1));
    will-change: transform, opacity;
}

@keyframes fall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 0.7;
    }
    100% {
        transform: translateY(110vh) rotate(360deg);
        opacity: 0;
    }
}

/* Floating Hearts Animation */
.floating-heart {
    position: fixed;
    bottom: -10%;
    animation: float linear forwards;
    z-index: 1;
    user-select: none;
    will-change: transform, opacity;
}

@keyframes float {
    0% {
        transform: translateY(0) scale(1);
        opacity: 0.7;
    }
    100% {
        transform: translateY(-110vh) scale(1.2);
        opacity: 0;
    }
}

/* Main Card */
.love-calculator-card {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border-radius: 30px;
    box-shadow: var(--soft-shadow);
    padding: 30px;
    position: relative;
    z-index: 10;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.5);
    width: 100%;
    margin: 10px 0;
}

/* Mobile Optimization */
@media (max-width: 768px) {
    .love-calculator-container {
        padding: 10px;
        min-height: -webkit-fill-available; /* Fix for mobile viewport height */
    }
    
    .love-calculator-card {
        padding: 20px 15px;
        border-radius: 25px;
        margin: 5px 0;
    }
}

/* Title Styles */
.love-calculator-title {
    text-align: center;
    color: var(--text-dark);
    font-size: 2.5rem;
    margin-bottom: 30px;
    font-weight: 600;
    text-shadow: 2px 2px 4px rgba(156, 39, 176, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .love-calculator-title {
        font-size: 2rem;
        gap: 10px;
        margin-bottom: 20px;
    }
}

@media (max-width: 480px) {
    .love-calculator-title {
        font-size: 1.8rem;
    }
}

.title-heart {
    font-size: 2rem;
    animation: pulse 1.5s ease infinite;
}

@media (max-width: 768px) {
    .title-heart {
        font-size: 1.5rem;
    }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Form Styles */
.love-calculator-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

@media (max-width: 768px) {
    .love-calculator-form {
        gap: 15px;
    }
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    color: var(--text-dark);
    font-size: 1.1rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

@media (max-width: 768px) {
    .form-group label {
        font-size: 1rem;
    }
}

.label-icon {
    font-size: 1.2rem;
}

.form-group input {
    padding: 15px 20px;
    border: 2px solid rgba(156, 39, 176, 0.1);
    border-radius: 15px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
    color: var(--text-dark);
    width: 100%;
    -webkit-appearance: none; /* Remove default iOS styling */
    appearance: none;
}

@media (max-width: 768px) {
    .form-group input {
        padding: 14px 16px;
        font-size: 16px; /* Prevent zoom on iOS */
    }
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-purple);
    box-shadow: 0 0 0 3px rgba(156, 39, 176, 0.1);
}

.form-group.optional input {
    background: rgba(255, 255, 255, 0.8);
    border-style: dashed;
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 20px;
}

@media (max-width: 768px) {
    .form-actions {
        flex-direction: column;
        gap: 12px;
        margin-top: 15px;
    }
}

.calculate-btn,
.reset-btn {
    flex: 1;
    padding: 15px 25px;
    border: none;
    border-radius: 15px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 55px; /* Better touch target */
}

@media (max-width: 768px) {
    .calculate-btn,
    .reset-btn {
        padding: 16px 20px;
        font-size: 1rem;
        min-height: 50px;
    }
}

.calculate-btn {
    background: linear-gradient(135deg, var(--primary-purple), var(--primary-dark));
    color: white;
    box-shadow: 0 4px 15px rgba(156, 39, 176, 0.3);
}

.calculate-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(156, 39, 176, 0.4);
}

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

.calculate-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.reset-btn {
    background: white;
    color: var(--text-dark);
    border: 2px solid var(--primary-light);
}

.reset-btn:active {
    background: var(--primary-light);
    color: white;
}

/* Result Section */
.result-section {
    margin-top: 30px;
    animation: fadeInUp 0.6s ease;
    width: 100%;
}

@media (max-width: 768px) {
    .result-section {
        margin-top: 20px;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-card {
    background: white;
    border-radius: 30px;
    padding: 30px;
    box-shadow: var(--soft-shadow);
    position: relative;
    overflow: visible;
    transition: all 0.3s ease;
    width: 100%;
}

@media (max-width: 768px) {
    .result-card {
        padding: 20px 15px;
        border-radius: 25px;
    }
}

.result-card.glow-effect {
    animation: glow 0.6s ease;
}

@keyframes glow {
    0%, 100% { box-shadow: var(--soft-shadow); }
    50% { box-shadow: 0 0 30px var(--glow-color); }
}

/* Names Summary */
.names-summary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .names-summary {
        flex-direction: column;
        gap: 15px;
        margin-bottom: 20px;
    }
}

.name-badge {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    padding: 12px 25px;
    border-radius: 50px;
    color: var(--text-dark);
    font-size: 1.2rem;
    font-weight: 600;
    box-shadow: 0 2px 10px rgba(156, 39, 176, 0.1);
    text-align: center;
    word-break: break-word;
    max-width: 100%;
}

@media (max-width: 768px) {
    .name-badge {
        padding: 10px 20px;
        font-size: 1.1rem;
        width: 100%;
    }
}

.love-symbol {
    font-size: 2rem;
    animation: heartbeat 1.5s ease infinite;
}

@media (max-width: 768px) {
    .love-symbol {
        font-size: 1.8rem;
    }
}

/* Percentage Styles */
.percentage-container {
    position: relative;
    text-align: center;
    margin: 20px 0 30px;
}

.percentage-wrapper {
    position: relative;
    display: inline-block;
}

.love-percentage {
    font-size: 6rem;
    font-weight: 800;
    color: var(--primary-dark);
    text-shadow: 2px 2px 10px rgba(156, 39, 176, 0.2);
    line-height: 1;
}

@media (max-width: 768px) {
    .love-percentage {
        font-size: 5rem;
    }
}

@media (max-width: 480px) {
    .love-percentage {
        font-size: 4rem;
    }
}

.percentage-symbol {
    font-size: 2.5rem;
    color: var(--primary-light);
    margin-left: 5px;
}

@media (max-width: 768px) {
    .percentage-symbol {
        font-size: 2rem;
    }
}

.heartbeat-effect {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.percentage-wrapper.heartbeat {
    animation: heartbeat 0.9s ease-in-out;
}

@keyframes heartbeat {
    0% { transform: scale(1); }
    25% { transform: scale(1.1); }
    35% { transform: scale(1); }
    45% { transform: scale(1.05); }
    55% { transform: scale(1); }
}

/* Love Message */
.love-message {
    text-align: center;
    font-size: 1.3rem;
    line-height: 1.6;
    color: var(--text-dark);
    margin: 25px 0;
    padding: 25px;
    background: rgba(156, 39, 176, 0.05);
    border-radius: 25px;
    border-left: 4px solid var(--primary-purple);
    word-break: break-word;
}

@media (max-width: 768px) {
    .love-message {
        font-size: 1.1rem;
        padding: 20px 15px;
        margin: 20px 0;
        border-radius: 20px;
    }
}

.message-line {
    margin: 8px 0;
}

.nickname-display {
    text-align: center;
    margin: 15px 0;
}

.nickname-badge {
    display: inline-block;
    padding: 10px 25px;
    background: linear-gradient(135deg, #ffd1dc, #ffe4e1);
    border-radius: 50px;
    color: var(--text-dark);
    font-size: 1.2rem;
    font-style: italic;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    max-width: 100%;
    word-break: break-word;
}

@media (max-width: 768px) {
    .nickname-badge {
        padding: 8px 20px;
        font-size: 1rem;
    }
}

/* Result Actions */
.result-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin: 25px 0;
    flex-wrap: wrap;
}

@media (max-width: 768px) {
    .result-actions {
        flex-direction: column;
        gap: 12px;
        margin: 20px 0;
    }
}

.action-btn {
    padding: 12px 25px;
    border: none;
    border-radius: 50px;
    background: white;
    color: var(--text-dark);
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    min-height: 48px; /* Better touch target */
}

@media (max-width: 768px) {
    .action-btn {
        width: 100%;
        padding: 14px 20px;
        font-size: 1rem;
    }
}

.action-btn:active {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(156, 39, 176, 0.2);
}

/* Social Sharing */
.social-sharing {
    margin-top: 30px;
    padding: 25px;
    background: white;
    border-radius: 25px;
    width: 100%;
}

@media (max-width: 768px) {
    .social-sharing {
        margin-top: 20px;
        padding: 20px 15px;
        border-radius: 20px;
    }
}

.sharing-title {
    color: var(--text-dark);
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.2rem;
}

.share-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

@media (max-width: 768px) {
    .share-buttons {
        flex-direction: column;
        gap: 10px;
    }
}

.share-btn {
    padding: 12px 20px;
    border-radius: 50px;
    text-decoration: none;
    color: white;
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
    cursor: pointer;
    border: none;
    min-width: 120px;
    min-height: 48px; /* Better touch target */
}

@media (max-width: 768px) {
    .share-btn {
        width: 100%;
        min-width: auto;
        padding: 14px 20px;
    }
}

.share-btn.whatsapp { background: #25D366; }
.share-btn.facebook { background: #1877F2; }
.share-btn.twitter { background: #1DA1F2; }
.share-btn.telegram { background: #0088cc; }
.share-btn.copy-link { background: var(--primary-purple); }

.share-btn:active {
    transform: translateY(-2px);
    filter: brightness(110%);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

/* Love History */
.love-history {
    margin-top: 25px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 20px;
    width: 100%;
}

@media (max-width: 768px) {
    .love-history {
        margin-top: 20px;
        padding: 15px;
    }
}

.love-history h4 {
    color: var(--text-dark);
    margin-bottom: 15px;
    font-size: 1.1rem;
    text-align: center;
}

.love-history ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.love-history li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(156, 39, 176, 0.1);
    flex-wrap: wrap;
    gap: 8px;
}

@media (max-width: 768px) {
    .love-history li {
        flex-direction: column;
        align-items: flex-start;
        padding: 12px 0;
    }
}

.history-names {
    font-size: 1rem;
    color: var(--text-dark);
    font-weight: 500;
    word-break: break-word;
}

.history-percentage {
    font-weight: bold;
    color: var(--primary-purple);
    font-size: 1.1rem;
}

.history-time {
    font-size: 0.9rem;
    color: #999;
}

/* Watermark (for downloaded images) */
.watermark {
    position: absolute;
    bottom: 10px;
    right: 10px;
    font-size: 0.8rem;
    color: rgba(156, 39, 176, 0.3);
    display: none;
    z-index: 100;
}

/* Notifications */
.love-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    left: 20px;
    padding: 16px 20px;
    border-radius: 12px;
    background: white;
    color: var(--text-dark);
    box-shadow: 0 5px 20px rgba(0,0,0,0.2);
    transform: translateY(-120%);
    transition: transform 0.3s ease;
    z-index: 9999;
    max-width: 350px;
    margin: 0 auto;
    text-align: center;
    font-weight: 500;
}

@media (min-width: 768px) {
    .love-notification {
        left: auto;
        right: 20px;
        transform: translateX(120%);
    }
    
    .love-notification.show {
        transform: translateX(0);
    }
}

.love-notification.show {
    transform: translateY(0);
}

.love-notification.success {
    border-left: 4px solid #4CAF50;
}

.love-notification.error {
    border-left: 4px solid #f44336;
}

.love-notification.info {
    border-left: 4px solid var(--primary-purple);
}

/* Utility Classes */
.is-scrolling {
    pointer-events: none;
}

/* Fix for iOS viewport height */
@supports (-webkit-touch-callout: none) {
    .love-calculator-container {
        min-height: -webkit-fill-available;
    }
}

/* Landscape mode optimization */
@media (max-width: 768px) and (orientation: landscape) {
    .love-calculator-container {
        padding: 15px;
    }
    
    .love-calculator-card {
        padding: 15px;
    }
    
    .form-actions {
        flex-direction: row;
    }
    
    .share-buttons {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .share-btn {
        width: auto;
        flex: 1;
    }
}

/* Dark Mode (Optional) */
.love-calculator-container[data-theme="dark"] {
    --gradient-start: #2c1a3a;
    --gradient-end: #1a1a2e;
    --text-dark: #e1bee7;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
}

.love-calculator-container[data-theme="dark"] .love-calculator-card {
    background: rgba(30, 30, 40, 0.98);
    border-color: rgba(255, 255, 255, 0.1);
}

.love-calculator-container[data-theme="dark"] input {
    background: #2a2a3a;
    color: white;
    border-color: rgba(255, 255, 255, 0.1);
}

/* Print Styles */
@media print {
    .flowers-container,
    .hearts-container,
    .form-actions,
    .result-actions,
    .social-sharing,
    .love-history {
        display: none !important;
    }
    
    .love-calculator-card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}