/* Enhanced Caffeine Calculator Styles */
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    transition: background 0.3s ease, color 0.3s ease;
}

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #0f0f0f 0%, #1a1a1a 50%, #0f0f0f 100%);
    background-attachment: fixed;
    height: 100vh;
    position: relative;
}

/* Light theme styles */
body.light-theme {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 50%, #f8fafc 100%) !important;
    color: #1a202c !important;
}

body.light-theme .bg-coffee-card {
    background: linear-gradient(145deg, #ffffff, #f8fafc) !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
    color: #1a202c !important;
}

body.light-theme .text-gray-400 {
    color: #718096 !important;
}

body.light-theme .text-gray-300 {
    color: #4a5568 !important;
}

body.light-theme input,
body.light-theme select,
body.light-theme textarea {
    background-color: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    color: #1a202c !important;
}

body.light-theme .calculator-glow {
    box-shadow: 0 0 50px rgba(59, 130, 246, 0.15) !important;
}

/* Theme transition animations */
* {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.bg-coffee-card {
    background: linear-gradient(145deg, #2a2a2a, #1f1f1f);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.calculator-glow {
    box-shadow: 0 0 50px rgba(245, 158, 11, 0.15);
}

.card-hover {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-hover:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 20px 40px rgba(245, 158, 11, 0.1);
}

.active-card {
    background: linear-gradient(145deg, #fbbf24, #f59e0b) !important;
    color: #000 !important;
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(245, 158, 11, 0.3);
}

.active-card svg {
    color: #000 !important;
}

.active-card h3,
.active-card p {
    color: #000 !important;
}

/* Ensure emoji icons remain flat without gradients */
#coffee-method-grid .text-xl,
#coffee-method-grid .text-2xl,
#coffee-method-grid .text-3xl,
#coffee-grid .text-2xl,
#coffee-grid .text-3xl,
#coffee-grid .text-4xl {
    background: none !important;
    -webkit-background-clip: initial !important;
    -webkit-text-fill-color: initial !important;
    background-clip: initial !important;
    color: inherit !important;
}

.active-card .text-xl,
.active-card .text-2xl,
.active-card .text-3xl,
.active-card .text-4xl {
    color: #000 !important;
    background: none !important;
    -webkit-background-clip: initial !important;
    -webkit-text-fill-color: initial !important;
    background-clip: initial !important;
}

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

@keyframes pulse-glow {
    0%, 100% { 
        box-shadow: 0 0 20px rgba(245, 158, 11, 0.2); 
    }
    50% { 
        box-shadow: 0 0 40px rgba(245, 158, 11, 0.4); 
    }
}

.input-glow:focus {
    text-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
}

/* Hide native input spinners */
#shots-input::-webkit-outer-spin-button,
#shots-input::-webkit-inner-spin-button,
#shots-input-desktop::-webkit-outer-spin-button,
#shots-input-desktop::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

#shots-input,
#shots-input-desktop {
    -moz-appearance: textfield;
    appearance: none;
    border: none;
    outline: none;
    background-color: transparent;
    text-align: left;
    caret-color: transparent;
    color: white;
}

#shots-input:focus,
#shots-input-desktop:focus {
    caret-color: #fbbf24;
}

.caffeine-display {
    background: linear-gradient(90deg, #fbbf24, #f59e0b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.health-indicator {
    transition: all 0.3s ease;
}

.gradient-text {
    background: linear-gradient(45deg, #fbbf24, #f59e0b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Floating particles animation */
.floating-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.particle {
    position: absolute;
    background: rgba(245, 158, 11, 0.1);
    border-radius: 50%;
    animation: float 15s infinite linear;
}

@keyframes float {
    0% { 
        transform: translateY(100vh) rotate(0deg); 
        opacity: 0; 
    }
    10% { 
        opacity: 1; 
    }
    90% { 
        opacity: 1; 
    }
    100% { 
        transform: translateY(-5vh) rotate(360deg); 
        opacity: 0; 
    }
}

/* Button enhancements */
button {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

button:active {
    transform: scale(0.95);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* Card styling improvements */
.bg-coffee-card {
    box-shadow: 
        0 4px 6px -1px rgba(0, 0, 0, 0.1), 
        0 2px 4px -1px rgba(0, 0, 0, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.card-hover:hover {
    border-color: rgba(245, 158, 11, 0.6) !important;
}

/* Hover glow effect to replace border hover */
.hover-glow:hover {
    box-shadow: 
        0 4px 6px -1px rgba(0, 0, 0, 0.1), 
        0 2px 4px -1px rgba(0, 0, 0, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 0 0 2px rgba(245, 158, 11, 0.6);
}

/* Brewing method grid specific styles */
#coffee-method-grid {
    grid-template-columns: repeat(8, minmax(0, 1fr));
}

#coffee-method-grid .bg-coffee-card {
    min-height: 70px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 0.5rem 0.25rem;
}

#coffee-method-grid .text-xs {
    font-size: 0.75rem;
    line-height: 1rem;
    text-align: center;
    word-break: break-word;
    hyphens: auto;
}

/* Responsive improvements */
@media (max-width: 640px) {
    body {
        padding: 0.25rem;
    }
    
    .calculator-glow {
        padding: 0.5rem !important;
        margin-bottom: 0.5rem !important;
    }
    
    .gradient-text {
        font-size: 1.75rem;
    }
    
    .card-hover {
        transform: none;
    }
    
    .card-hover:hover {
        transform: translateY(-2px);
    }
    
    /* Ensure brewing method cards fit on mobile */
    #coffee-method-grid .bg-coffee-card {
        min-height: 60px;
        padding: 0.25rem 0.125rem;
    }
    
    #coffee-method-grid .text-xl {
        font-size: 1rem;
        line-height: 1.25rem;
    }
    
    #coffee-method-grid .text-xs {
        font-size: 0.625rem;
        line-height: 0.875rem;
    }
    
    /* Reduce spacing for mobile */
    header {
        margin-bottom: 0.5rem !important;
    }
    
    .mb-4 {
        margin-bottom: 0.5rem !important;
    }
    
    /* Reduce grid spacing for mobile */
    #coffee-method-grid {
        gap: 0.25rem !important;
    }
    
    #coffee-grid {
        gap: 0.5rem !important;
    }
}

/* Mobile-specific calculator layout styling */
@media (max-width: 640px) {
    .mobile-calculator-layout {
        gap: 0.5rem;
    }
    
    .mobile-caffeine-info {
        text-align: center;
        margin-bottom: 0.25rem;
    }
    
    .mobile-shot-display {
        text-align: center;
        margin-bottom: 0.25rem;
    }
    
    .mobile-controls {
        justify-content: center;
        gap: 0.25rem;
    }
    
    /* Tighter internal spacing for mobile calculator sections */
    .mobile-caffeine-info .mb-2 {
        margin-bottom: 0.25rem !important;
    }
    
    .mobile-caffeine-info .mb-1 {
        margin-bottom: 0.125rem !important;
    }
    
    .mobile-caffeine-info .space-x-2 > * + * {
        margin-left: 0.25rem !important;
    }
    
    .mobile-controls .space-x-4 > * + * {
        margin-left: 0.5rem !important;
    }
    
    .mobile-shot-display .mobile-shot-number {
        margin-bottom: 0.125rem !important;
    }
    
    /* Make buttons touch-friendly */
    .mobile-button {
        width: 3rem !important;
        height: 3rem !important;
        font-size: 1.5rem !important;
        min-width: 48px;
        min-height: 48px;
    }
    
    /* Adjust input sizing for mobile */
    .mobile-input {
        max-width: calc(100vw - 8rem) !important;
        min-width: 3rem !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }
    
    /* Improve touch targets for mobile labels */
    #shots-label {
        font-size: 1.125rem;
        font-weight: 500;
    }
    
    /* Mobile 2-row shot display layout */
    .mobile-shot-two-row {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
    
    .mobile-shot-number {
        order: 1;
        margin-bottom: 0.125rem;
        text-align: center !important;
        width: auto !important;
        display: block !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }
    
    .mobile-shot-label {
        order: 2;
        font-size: 1.125rem !important;
        font-weight: 500 !important;
    }
}

@media (max-width: 480px) {
    body {
        padding: 0.25rem;
    }
    
    /* Ultra-mobile calculator adjustments */
    .calculator-glow {
        padding: 0.75rem;
    }
    
    /* Smaller text for very small screens */
    #calculator-title {
        font-size: 1.5rem;
    }
    
    .mobile-input {
        font-size: 2rem !important;
        max-width: calc(100vw - 6rem) !important;
        min-width: 2.5rem !important;
    }
    
    #caffeine-total {
        font-size: 2.5rem !important;
    }
    
    .mobile-button {
        width: 2.75rem !important;
        height: 2.75rem !important;
        font-size: 1.25rem !important;
        min-width: 44px !important;
        min-height: 44px !important;
    }
    
    /* Compact spacing for tiny screens */
    .mobile-calculator-layout {
        gap: 1rem;
    }
    
    .mobile-controls {
        gap: 0.75rem;
    }
    
    /* Adjust label size for tiny screens */
    #shots-label {
        font-size: 1rem;
    }
    
    /* Ultra-mobile 2-row shot display adjustments */
    .mobile-shot-label {
        font-size: 1rem !important;
    }
    
    .mobile-shot-number {
        text-align: center !important;
    }
    
    #coffee-method-grid .text-xs {
        font-size: 0.5rem;
        line-height: 0.75rem;
    }
    
    #coffee-method-grid .text-xl {
        font-size: 0.875rem;
        line-height: 1rem;
    }
    
    #coffee-method-grid .bg-coffee-card {
        min-height: 50px;
        padding: 0.25rem 0.0625rem;
    }
    
    .max-w-6xl {
        max-height: calc(100vh - 0.5rem);
    }
}

/* Additional visual enhancements */
.shadow-glow {
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.2);
}

.border-glow {
    border: 1px solid rgba(245, 158, 11, 0.3);
}

/* Achievement rarity glow effects */
.rarity-epic {
    box-shadow: 0 0 15px rgba(147, 51, 234, 0.3);
}

.rarity-rare {
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.3);
}

.rarity-uncommon {
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.3);
}

.rarity-common {
    box-shadow: 0 0 10px rgba(156, 163, 175, 0.2);
}

/* Achievement hover effects */
#achievements-grid > div:hover {
    transform: translateY(-2px) scale(1.05);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Progress bar animations */
.progress-bar-fill {
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Streak counter animation */
.streak-counter {
    animation: pulse-gentle 2s infinite ease-in-out;
}

/* Challenge completion animation */
.challenge-complete {
    animation: bounce-in 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Achievement notification enhancements */
.achievement-notification {
    backdrop-filter: blur(10px);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

/* Stats card hover effects */
.stats-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(245, 158, 11, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Ensure proper scrollable content area */
.max-w-6xl {
    max-height: calc(100vh - 1rem);
    padding-bottom: 1rem;
}

/* Optimize mobile container height */
@media (max-width: 640px) {
    .max-w-6xl {
        max-height: calc(100vh - 0.5rem);
        padding-bottom: 0.5rem;
    }
}

/* Prevent any element from causing overflow */
* {
    box-sizing: border-box;
}

/* Hide scrollbar while maintaining scroll functionality */
.overflow-y-auto {
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* Internet Explorer 10+ */
}

.overflow-y-auto::-webkit-scrollbar {
    display: none; /* Safari and Chrome */
}

/* Loading animation for cards */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card-hover {
    animation: fadeInUp 0.5s ease-out;
}

/* Advanced animation keyframes */
@keyframes fade-in-up {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slide-in-left {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slide-in-right {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scale-in {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes bounce-in {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Animation classes */
.animate-fade-in-up {
    animation: fade-in-up 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-slide-in-left {
    animation: slide-in-left 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-slide-in-right {
    animation: slide-in-right 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-scale-in {
    animation: scale-in 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.animate-bounce-in {
    animation: bounce-in 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Staggered animation delays */
.animate-stagger-1 { animation-delay: 0.1s; }
.animate-stagger-2 { animation-delay: 0.2s; }
.animate-stagger-3 { animation-delay: 0.3s; }
.animate-stagger-4 { animation-delay: 0.4s; }
.animate-stagger-5 { animation-delay: 0.5s; }

/* Smooth transitions for all interactive elements */
button, input, select, textarea, .card-hover {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Enhanced hover effects */
.card-hover:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 20px 40px rgba(245, 158, 11, 0.15);
}

.active-card {
    animation: bounce-in 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Pulse animation for important elements */
@keyframes gentle-pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.pulse-gentle {
    animation: gentle-pulse 2s infinite ease-in-out;
}

/* Feedback Modal Styles */
#feedback-modal {
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease-out;
}

#feedback-modal .bg-gray-800 {
    animation: slideUp 0.3s ease-out;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* Form input focus styles */
#feedback-modal input:focus,
#feedback-modal select:focus,
#feedback-modal textarea:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Removed footer styles - now using inline footer */

/* Responsive feedback button */
@media (max-width: 640px) {
    #feedback-btn {
        top: auto;
        bottom: 1.5rem;
        right: 1rem;
        padding: 0.75rem;
        font-size: 1.125rem;
        border-radius: 50%;
        width: 3.5rem;
        height: 3.5rem;
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    }
    
    /* Hide text on mobile, show only emoji */
    #feedback-btn .feedback-text {
        display: none;
    }
    
    #feedback-modal .bg-gray-800 {
        margin: 1rem;
        width: calc(100% - 2rem);
    }
}