/* Custom animations and transitions */
@keyframes buttonPress {
    0% { transform: scale(1); }
    50% { transform: scale(0.95); }
    100% { transform: scale(1); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

.calc-btn {
    @apply rounded-xl py-4 transition-all duration-200 active:scale-95 focus:outline-none focus:ring-2 focus:ring-orange-400 focus:ring-opacity-50 relative overflow-hidden;
}

.calc-btn::before {
    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.3s, height 0.3s;
}

.calc-btn:active::before {
    width: 100%;
    height: 100%;
}

.number-btn:hover {
    @apply shadow-md;
}

.operator-btn {
    @apply shadow-lg;
}

.operator-btn:hover {
    @apply shadow-xl;
}

.memory-btn {
    animation: fadeIn 0.3s ease-out;
}

.memory-btn:hover {
    @apply text-orange-600;
}

#display {
    animation: fadeIn 0.2s ease-out;
}

#history {
    animation: fadeIn 0.2s ease-out;
}

/* Dark mode styles */
body.dark-mode {
    @apply bg-gray-900;
}

.dark-mode .calculator-container {
    @apply bg-gray-800;
}

.dark-mode .bg-white {
    @apply bg-gray-800;
}

.dark-mode .bg-gray-50 {
    @apply bg-gray-700;
}

.dark-mode .bg-gray-100 {
    @apply bg-gray-600;
}

.dark-mode .bg-gray-200 {
    @apply bg-gray-600;
}

.dark-mode .text-gray-800 {
    @apply text-gray-200;
}

.dark-mode .text-gray-700 {
    @apply text-gray-300;
}

.dark-mode .text-gray-600 {
    @apply text-gray-400;
}

.dark-mode .border-gray-200 {
    @apply border-gray-600;
}

.dark-mode .calc-btn {
    @apply text-gray-200;
}

.dark-mode .number-btn {
    @apply bg-gray-700 hover:bg-gray-600;
}

.dark-mode .operator-btn {
    @apply bg-orange-600 hover:bg-orange-700;
}

.dark-mode .memory-btn {
    @apply bg-gray-700 hover:bg-gray-600 text-gray-400;
}

/* Responsive adjustments */
@media (max-width: 640px) {
    .calc-btn {
        @apply py-3 text-lg;
    }
    
    #display {
        @apply text-3xl;
    }
}

/* Smooth transitions for theme toggle */
* {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    @apply bg-gray-100;
}

::-webkit-scrollbar-thumb {
    @apply bg-orange-400 rounded-full;
}

::-webkit-scrollbar-thumb:hover {
    @apply bg-orange-500;
}

/* Focus styles for accessibility */
.calc-btn:focus-visible {
    @apply ring-2 ring-orange-400 ring-opacity-50 ring-offset-2;
}

/* Loading animation */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.calculating {
    animation: pulse 0.5s ease-in-out;
}