/* Custom Calculator Styles with Animations */
:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --animation-speed: 0.3s;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

@keyframes ripple {
    0% { transform: scale(0); opacity: 1; }
    100% { transform: scale(4); opacity: 0; }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-5px); }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 5px var(--primary-color); }
    50% { box-shadow: 0 0 20px var(--primary-color); }
}

/* Page Load Animation */
body {
    animation: fadeIn 0.8s ease-out;
}

#resultDisplay {
    font-family: 'Courier New', monospace;
    font-weight: bold;
    padding: 20px;
    background-color: #f8f9fa;
    border-radius: 5px;
    border-left: 5px solid #28a745;
    animation: fadeIn 0.5s ease-out;
}

.callout {
    border-radius: 10px;
    padding: 20px;
    animation: fadeIn 0.5s ease-out;
}

.form-control:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    transition: all 0.3s ease;
}

/* Enhanced Button Animations */
.btn-primary {
    background: linear-gradient(45deg, #007bff, #6610f2);
    border: none;
    padding: 12px 30px;
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-primary:hover {
    background: linear-gradient(45deg, #0069d9, #5a0bd9);
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

.btn-primary:active {
    transform: translateY(-1px) scale(0.98);
}

.btn-primary:active::before {
    width: 200px;
    height: 200px;
}

.btn-default {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.btn-default:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

/* Card Animations */
.card {
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
    border: none;
    border-radius: 15px;
    margin-bottom: 20px;
    animation: fadeIn 0.6s ease-out;
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    transform: translateY(-5px);
}

.card-primary {
    animation: slideInLeft 0.6s ease-out;
}

.card-secondary {
    animation: slideInRight 0.6s ease-out;
}

.card-header {
    border-radius: 15px 15px 0 0 !important;
    background: linear-gradient(45deg, #4e73df, #224abe);
    color: white;
    position: relative;
    overflow: hidden;
}

.card-header::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.7s;
}

.card:hover .card-header::after {
    left: 100%;
}

/* Table Animations */
.table-hover tbody tr {
    animation: fadeIn 0.5s ease-out;
    animation-fill-mode: both;
    transition: all 0.3s ease;
}

.table-hover tbody tr:nth-child(odd) {
    animation-delay: 0.1s;
}

.table-hover tbody tr:nth-child(even) {
    animation-delay: 0.2s;
}

.table-hover tbody tr:hover {
    background-color: rgba(0, 123, 255, 0.1);
    transform: translateX(5px);
}

.table-hover tbody tr:hover td {
    animation: pulse 0.3s ease;
}

/* Input Group Animations */
.input-group {
    transition: all 0.3s ease;
}

.input-group:focus-within {
    transform: translateY(-2px);
}

.input-group-text {
    background-color: #e9ecef;
    border: 1px solid #ced4da;
    transition: all 0.3s ease;
}

.input-group:focus-within .input-group-text {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Badge Animations */
.badge {
    font-size: 0.9em;
    padding: 5px 10px;
    transition: all 0.3s ease;
    animation: bounce 1s ease;
}

.badge:hover {
    transform: scale(1.1);
    animation: pulse 0.5s ease;
}

/* Navbar Animations */
.nav-link {
    position: relative;
    transition: all 0.3s ease;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background-color: var(--primary-color);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.nav-link:hover::after {
    width: 100%;
}

.nav-link:hover {
    transform: translateY(-2px);
}

/* History Count Animation */
#historyCount {
    animation: float 2s ease-in-out infinite;
}

/* Select Dropdown Animation */
select.form-control {
    transition: all 0.3s ease;
}

select.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    transform: translateY(-2px);
}

/* Result Display Specific */
#resultContainer, #errorContainer {
    animation: fadeIn 0.5s ease-out;
}

/* Success Animation */
.success-animation {
    animation: pulse 0.5s ease, glow 1.5s ease-in-out infinite;
}

/* Error Animation */
.error-animation {
    animation: shake 0.5s ease;
}

/* Loading Animation */
.loading-dots {
    display: inline-block;
    position: relative;
    width: 80px;
    height: 80px;
}

.loading-dots div {
    position: absolute;
    top: 33px;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: var(--primary-color);
    animation-timing-function: cubic-bezier(0, 1, 1, 0);
}

.loading-dots div:nth-child(1) {
    left: 8px;
    animation: loading-dots1 0.6s infinite;
}

.loading-dots div:nth-child(2) {
    left: 8px;
    animation: loading-dots2 0.6s infinite;
}

.loading-dots div:nth-child(3) {
    left: 32px;
    animation: loading-dots2 0.6s infinite;
}

.loading-dots div:nth-child(4) {
    left: 56px;
    animation: loading-dots3 0.6s infinite;
}

@keyframes loading-dots1 {
    0% { transform: scale(0); }
    100% { transform: scale(1); }
}

@keyframes loading-dots3 {
    0% { transform: scale(1); }
    100% { transform: scale(0); }
}

@keyframes loading-dots2 {
    0% { transform: translate(0, 0); }
    100% { transform: translate(24px, 0); }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #resultDisplay {
        font-size: 2rem;
    }
    
    .btn-lg {
        padding: 10px 20px;
        font-size: 1rem;
    }
    
    .card {
        animation: slideInRight 0.5s ease-out;
    }
}

/* Print Animation */
@media print {
    .card {
        box-shadow: none !important;
        animation: none !important;
    }
}