/* Custom CSS for Party Calculator */

:root {
    --primary-purple: #9333ea;
    --primary-pink: #ec4899;
    --secondary-blue: #3b82f6;
    --secondary-orange: #f97316;
    --success-green: #10b981;
    --warning-yellow: #f59e0b;
    --gray-light: #f3f4f6;
    --gray-dark: #374151;
}

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

body {
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    color: var(--gray-dark);
}

/* Animation Classes */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

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

.slide-up {
    animation: slideUp 0.6s ease-out;
}

/* Results Section Entry Animation */
#resultsSection {
    animation-fill-mode: both;
}

#resultsSection > div {
    animation: slideUp 0.6s ease-out;
    animation-fill-mode: both;
}

#resultsSection > div:nth-child(1) {
    animation-delay: 0.1s;
}

#resultsSection > div:nth-child(2) {
    animation-delay: 0.2s;
}

#resultsSection > div:nth-child(3) {
    animation-delay: 0.3s;
}

#resultsSection > div:nth-child(4) {
    animation-delay: 0.4s;
}

#resultsSection > div:nth-child(5) {
    animation-delay: 0.5s;
}

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

.pulse-animation {
    animation: pulse 2s infinite;
}

/* Custom Input Styling */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
}

/* Custom Checkbox Styling */
input[type="checkbox"] {
    accent-color: var(--primary-purple);
}

input[type="checkbox"]:checked + div {
    color: var(--primary-purple);
}

/* Range Slider Styling */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: #ddd;
    outline: none;
    opacity: 0.7;
    -webkit-transition: .2s;
    transition: opacity .2s;
    border-radius: 5px;
}

input[type="range"]:hover {
    opacity: 1;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--primary-purple);
    cursor: pointer;
    border-radius: 50%;
}

input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--primary-purple);
    cursor: pointer;
    border-radius: 50%;
}

/* Card Hover Effects */
.hover-card {
    transition: all 0.3s ease;
}

.hover-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: var(--primary-purple);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-pink);
}

/* Result Item Styling */
.result-item {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 0.75rem;
    transition: transform 0.3s ease;
}

.result-item:hover {
    transform: translateX(5px);
}

.result-item-food {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.result-item-beverage {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, .3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Loading spinner for button */
.loading-spinner {
    display: inline-flex;
    align-items: center;
}

/* Ensure smooth layout preservation */
#resultsSection {
    min-height: 0;
    transition: min-height 0.5s ease-out;
}

#resultsSection:not(.hidden) {
    min-height: 400px;
}

/* Form section should not move when results appear */
#partyForm {
    position: relative;
    z-index: 1;
}

/* Smooth content flow */
main {
    padding-bottom: 2rem;
}

/* Print Styles */
@media print {
    body {
        background: white;
    }
    
    header, footer, #resetBtn, #printBtn, #shareBtn, #recalculateBtn {
        display: none;
    }
    
    #resultsSection {
        display: block !important;
    }
    
    .bg-gradient-to-r {
        background: #10b981 !important;
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    h2 {
        font-size: 1.25rem;
    }
    
    .grid {
        grid-template-columns: 1fr !important;
    }
}

/* Custom Tooltip */
.tooltip {
    position: relative;
    display: inline-block;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 200px;
    background-color: var(--gray-dark);
    color: #fff;
    text-align: center;
    border-radius: 6px;
    padding: 5px 10px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.875rem;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* Success Message Animation */
.success-message {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 2rem;
    border-radius: 0.5rem;
    position: fixed;
    top: 100px;
    right: 20px;
    z-index: 1000;
    animation: slideIn 0.5s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
    }
    to {
        transform: translateX(0);
    }
}

/* Focus Styles */
input:focus,
select:focus,
button:focus {
    outline: none;
    ring: 2px;
    ring-color: var(--primary-purple);
}

/* Gradient Text */
.gradient-text {
    background: linear-gradient(135deg, var(--primary-purple) 0%, var(--primary-pink) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Shadow Effects */
.shadow-purple {
    box-shadow: 0 10px 25px rgba(147, 51, 234, 0.3);
}

.shadow-pink {
    box-shadow: 0 10px 25px rgba(236, 72, 153, 0.3);
}

/* Button Glow Effect */
.glow-button {
    position: relative;
    overflow: hidden;
}

.glow-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.glow-button:hover::before {
    left: 100%;
}

/* Custom Alert Styling */
.custom-alert {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
}

.alert-info {
    background-color: #dbeafe;
    color: #1e40af;
    border-left: 4px solid #3b82f6;
}

.alert-success {
    background-color: #d1fae5;
    color: #065f46;
    border-left: 4px solid #10b981;
}

.alert-warning {
    background-color: #fed7aa;
    color: #92400e;
    border-left: 4px solid #f97316;
}

.alert-error {
    background-color: #fee2e2;
    color: #991b1b;
    border-left: 4px solid #ef4444;
}

/* Email Section Styling */
.email-section {
    background: linear-gradient(135deg, rgba(147, 51, 234, 0.05) 0%, rgba(236, 72, 153, 0.05) 100%);
    border: 2px solid rgba(147, 51, 234, 0.2);
    position: relative;
    overflow: hidden;
}

.email-section::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(147, 51, 234, 0.1) 0%, transparent 70%);
    animation: pulse 4s ease-in-out infinite;
}

/* Buy Now Button Special Effect */
#buyNowBtn {
    position: relative;
    overflow: hidden;
}

#buyNowBtn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

#buyNowBtn:hover::after {
    width: 300px;
    height: 300px;
}

/* Email Input Focus Effect */
#emailAddress:focus {
    box-shadow: 0 0 0 3px rgba(147, 51, 234, 0.1);
    border-color: #9333ea;
}

/* Subscribe Button Animation */
#subscribeBtn {
    width: 100px;
    height: 50px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

#subscribeBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(147, 51, 234, 0.3);
}

#subscribeBtn:active {
    transform: translateY(0);
}