/* ========================================
   PREMIUM UX ENHANCEMENTS FOR UK CALCULATOR
   Standardized inputs, animations, feedback
   ======================================== */

/* ENHANCED INPUT STYLING */
.calc-input,
.input-group input,
.input-group select,
.input-group textarea {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    font-size: 1.05rem;
    font-family: inherit;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: white;
    color: #343a40;
    box-shadow: 0 2px 4px rgba(0,0,0,0.04);
}

.calc-input:hover,
.input-group input:hover,
.input-group select:hover {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
}

.calc-input:focus,
.input-group input:focus,
.input-group select:focus,
.input-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15),
                0 4px 12px rgba(102, 126, 234, 0.2);
    transform: translateY(-1px);
}

/* INPUT VALIDATION STATES */
.calc-input.valid,
.input-group input.valid {
    border-color: #28a745;
    background: #f8fff9;
}

.calc-input.invalid,
.input-group input.invalid {
    border-color: #dc3545;
    background: #fff8f8;
    animation: shake 0.4s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

/* INPUT WITH ICONS */
.input-with-icon {
    position: relative;
}

.input-with-icon input {
    padding-left: 45px;
}

.input-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #6c757d;
    font-size: 1.2rem;
    pointer-events: none;
}

/* PREMIUM BUTTON STYLING */
.calc-btn,
.calculate-btn {
    width: 100%;
    padding: 16px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.15rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    margin-top: 25px;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.25);
    position: relative;
    overflow: hidden;
}

.calc-btn::before,
.calculate-btn::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.6s ease;
}

.calc-btn:hover::before,
.calculate-btn:hover::before {
    left: 100%;
}

.calc-btn:hover,
.calculate-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(102, 126, 234, 0.35);
}

.calc-btn:active,
.calculate-btn:active {
    transform: translateY(-1px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.calc-btn:disabled,
.calculate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* LOADING STATE */
.calc-btn.loading,
.calculate-btn.loading {
    pointer-events: none;
    position: relative;
    color: transparent;
}

.calc-btn.loading::after,
.calculate-btn.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* CALCULATOR BOX - PREMIUM */
.calculator-box {
    background: white;
    border-radius: 20px;
    padding: 35px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    border: 1px solid rgba(102, 126, 234, 0.1);
}

.calculator-box:hover {
    box-shadow: 0 15px 50px rgba(0,0,0,0.12);
    transform: translateY(-2px);
}

/* RESULT DISPLAY - ENHANCED */
#result {
    margin-top: 30px;
    min-height: 50px;
    animation: fadeInUp 0.5s ease;
}

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

/* TRENDING BADGE - PREMIUM */
.trending-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a6f 100%);
    color: white;
    padding: 10px 20px;
    border-radius: 25px;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: 0 5px 15px rgba(255, 107, 107, 0.3);
    animation: pulse 2s ease-in-out infinite;
}

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

.trending-badge .fire-emoji {
    font-size: 1.2rem;
    animation: flicker 1.5s ease-in-out infinite;
}

@keyframes flicker {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.trending-badge .growth-stat {
    font-size: 0.85rem;
    opacity: 0.95;
}

/* TOOLTIP */
.tooltip {
    position: relative;
    display: inline-block;
    cursor: help;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 220px;
    background: #343a40;
    color: white;
    text-align: center;
    border-radius: 8px;
    padding: 10px;
    position: absolute;
    z-index: 1000;
    bottom: 125%;
    left: 50%;
    margin-left: -110px;
    opacity: 0;
    transition: all 0.3s ease;
    font-size: 0.85rem;
    line-height: 1.4;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

.tooltip .tooltiptext::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: #343a40 transparent transparent transparent;
}

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

/* PROGRESS INDICATOR */
.progress-indicator {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin: 20px 0;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 4px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.progress-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.4),
        transparent
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* COPY BUTTON */
.copy-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.copy-btn:hover {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(40, 167, 69, 0.3);
}

.copy-btn.copied {
    background: #17a2b8;
}

.copy-btn.copied::before {
    content: '✓ ';
}

/* RESET BUTTON */
.reset-btn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    margin-top: 15px;
}

.reset-btn:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

/* COMPARISON TABLE */
.comparison-table {
    width: 100%;
    margin: 25px 0;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
}

.comparison-table th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px;
    text-align: left;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
}

.comparison-table td {
    padding: 15px;
    background: white;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.3s ease;
}

.comparison-table tr:hover td {
    background: #f8f9fa;
}

.comparison-table tr:last-child td {
    border-bottom: none;
}

/* HIGHLIGHT NUMBER */
.highlight-number {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: inline-block;
    line-height: 1.2;
}

/* SUCCESS/ERROR MESSAGES */
.success-message {
    background: #d4edda;
    border: 2px solid #28a745;
    border-left: 5px solid #28a745;
    color: #155724;
    padding: 15px 20px;
    border-radius: 8px;
    margin: 20px 0;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideInRight 0.4s ease;
}

.error-message {
    background: #f8d7da;
    border: 2px solid #dc3545;
    border-left: 5px solid #dc3545;
    color: #721c24;
    padding: 15px 20px;
    border-radius: 8px;
    margin: 20px 0;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideInRight 0.4s ease;
}

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

/* SKELETON LOADER */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
    border-radius: 8px;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text {
    height: 20px;
    margin: 10px 0;
}

.skeleton-title {
    height: 30px;
    margin: 15px 0;
}

/* EMOJI ENHANCEMENT */
.emoji {
    font-size: 1.5rem;
    display: inline-block;
    vertical-align: middle;
    margin: 0 5px;
}

.emoji-large {
    font-size: 3rem;
}

/* DARK MODE ADJUSTMENTS */
.dark-mode .calc-input,
.dark-mode .input-group input,
.dark-mode .input-group select {
    background: #2c2c54;
    border-color: #706fd3;
    color: white;
}

.dark-mode .calculator-box {
    background: #2c2c54;
    border-color: #706fd3;
}

.dark-mode .comparison-table td {
    background: #2c2c54;
    border-color: #706fd3;
    color: white;
}

/* PRINT OPTIMIZATION */
@media print {
    .calc-btn,
    .calculate-btn,
    .reset-btn,
    .copy-btn,
    .trending-badge {
        display: none;
    }

    .calculator-box {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* MOBILE OPTIMIZATION */
@media (max-width: 768px) {
    .calc-btn,
    .calculate-btn {
        padding: 14px 20px;
        font-size: 1rem;
        letter-spacing: 1px;
    }

    .calc-input,
    .input-group input,
    .input-group select {
        padding: 12px 15px;
        font-size: 1rem;
    }

    .calculator-box {
        padding: 20px;
    }

    .highlight-number {
        font-size: 2rem;
    }

    .trending-badge {
        font-size: 0.85rem;
        padding: 8px 16px;
    }
}

/* ACCESSIBILITY - FOCUS VISIBLE */
.calc-input:focus-visible,
.calc-btn:focus-visible,
.calculate-btn:focus-visible {
    outline: 3px solid #667eea;
    outline-offset: 3px;
}

/* HIGH CONTRAST MODE */
@media (prefers-contrast: high) {
    .calc-input,
    .input-group input,
    .input-group select {
        border-width: 3px;
    }

    .calc-btn,
    .calculate-btn {
        border: 2px solid white;
    }
}

/* REDUCED MOTION */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
