/* Custom styles for BetHelp */

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

.pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Chat message animations */
@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.message-ai {
    animation: slideInLeft 0.3s ease-out;
}

.message-user {
    animation: slideInRight 0.3s ease-out;
}

/* Custom scrollbar for chat */
#chat-messages::-webkit-scrollbar {
    width: 6px;
}

#chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

#chat-messages::-webkit-scrollbar-thumb {
    background: #10b981;
    border-radius: 3px;
}

#chat-messages::-webkit-scrollbar-thumb:hover {
    background: #059669;
}

/* Enhanced prediction cards */
.prediction-card {
    transition: all 0.3s ease;
    border: 1px solid #e5e7eb;
    min-height: 140px;
    position: relative;
    overflow: hidden;
}

.prediction-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #10b981, #059669);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.prediction-card:hover::before {
    transform: scaleX(1);
}

.prediction-card:hover {
    border-color: #10b981;
    transform: translateY(-1px);
    box-shadow: 0 8px 25px rgba(16, 185, 129, 0.15);
}

/* Enhanced responsive improvements for prediction cards */
@media (max-width: 640px) {
    .prediction-card {
        min-height: 120px !important;
        padding: 16px !important;
        margin-bottom: 12px;
    }
    
    .prediction-card h3 {
        font-size: 14px !important;
        line-height: 1.3;
        font-weight: 700 !important;
    }
    
    .prediction-card .w-8.h-8 {
        width: 32px !important;
        height: 32px !important;
        font-size: 16px !important;
    }
    
    .prediction-value {
        font-size: 36px !important;
        font-weight: 900 !important;
    }
    
    .prediction-card .text-xs {
        font-size: 12px !important;
    }
    
    .prediction-card .px-3.py-2 {
        padding: 8px 12px !important;
        font-size: 12px !important;
    }
}

@media (min-width: 641px) and (max-width: 1023px) {
    .prediction-card {
        min-height: 150px !important;
        padding: 14px !important;
    }
    
    .prediction-card h3 {
        font-size: 12px !important;
    }
    
    .prediction-value {
        font-size: 28px !important;
    }
}

@media (min-width: 1024px) {
    .prediction-card {
        min-height: 170px !important;
        padding: 16px !important;
    }
    
    .prediction-card h3 {
        font-size: 14px !important;
    }
    
    .prediction-value {
        font-size: 32px !important;
    }
}
}

/* Button hover effects */
.btn-primary {
    transition: all 0.2s ease;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

/* Language switcher */
.lang-button-active {
    background-color: #10b981;
    color: white;
}

.lang-button-inactive {
    background-color: transparent;
    color: #6b7280;
}

.lang-button-inactive:hover {
    background-color: #f3f4f6;
}

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

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

/* Progress bars for predictions */
.progress-bar {
    height: 8px;
    background-color: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background-color: #10b981;
    transition: width 0.8s ease-out;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .chat-container {
        height: 300px;
    }
    
    .prediction-form {
        padding: 1rem;
    }
    
    .plan-card {
        margin-bottom: 1rem;
    }
}

/* Mobile Chat Optimizations */
@media (max-width: 640px) {
    #chat-window {
        /* Mobile: Full screen overlay */
        position: fixed !important;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100vw !important;
        height: 100vh !important;
        max-height: 100vh !important;
        border-radius: 0 !important;
    }
    
    #chat-messages {
        max-height: calc(100vh - 140px) !important;
    }
}

/* Ensure chat window is visible when shown */
#chat-window[style*="flex"] {
    display: flex !important;
}

/* Chat button hover effects */
#chat-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 10px 25px rgba(16, 185, 129, 0.3);
}

/* Improved z-index management */
.chat-overlay {
    z-index: 9998;
}

.chat-window {
    z-index: 9999;
}

/* Text wrapping fixes for multilingual content (Russian, Uzbek, English) */
* {
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

/* Prevent improper breaking of Cyrillic text */
[lang="ru"], [lang="uz"], .cyrillic-text {
    word-break: keep-all;
    overflow-wrap: break-word;
    hyphens: manual;
}

/* Specific text handling for titles and headings */
h1, h2, h3, h4, h5, h6 {
    word-break: keep-all;
    overflow-wrap: anywhere;
    hyphens: none;
}

/* Button text wrapping */
button {
    word-break: keep-all;
    overflow-wrap: break-word;
    hyphens: none;
}

/* Card content text wrapping */
.plan-card, .prediction-card, .chat-message {
    word-break: normal;
    overflow-wrap: break-word;
    hyphens: auto;
}

/* Mobile text optimization */
@media (max-width: 768px) {
    body {
        word-break: normal;
        overflow-wrap: break-word;
        line-height: 1.5;
    }
    
    /* Prevent text overflow in small containers */
    .text-sm, .text-xs {
        word-break: keep-all;
        overflow-wrap: break-word;
    }
    
    /* Ensure proper spacing for mobile */
    p, span, div {
        word-spacing: normal;
        letter-spacing: normal;
    }
}

/* Error states */
.error-message {
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 0.75rem;
    border-radius: 0.375rem;
    margin-top: 0.5rem;
}

.success-message {
    background-color: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
    padding: 0.75rem;
    border-radius: 0.375rem;
    margin-top: 0.5rem;
}

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

.tooltip .tooltiptext {
    visibility: hidden;
    width: 200px;
    background-color: #1f2937;
    color: white;
    text-align: center;
    border-radius: 6px;
    padding: 8px;
    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;
}

/* Form validation styles */
.input-error {
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.input-success {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

/* Loading spinner */
.spinner {
    border: 2px solid #f3f3f3;
    border-top: 2px solid #10b981;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* API-Football Widget Styles */
.widget-panel {
    min-height: 400px;
}

/* Widget containers using official API-Football IDs */
#wg-api-football-games,
#wg-api-football-standings, 
#wg-api-football-players {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e5e7eb;
}

/* Widget loading state */
.widget-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    background: #f9fafb;
    border-radius: 8px;
}

/* Widget error state */
.widget-error {
    text-align: center;
    padding: 2rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 8px;
    color: #dc2626;
}

/* Custom styling for API-Football widgets to match our design */
#wg-api-football-games table,
#wg-api-football-standings table,
#wg-api-football-players table {
    width: 100%;
    border-collapse: collapse;
    font-family: inherit;
}

#wg-api-football-games th,
#wg-api-football-games td,
#wg-api-football-standings th,
#wg-api-football-standings td,
#wg-api-football-players th,
#wg-api-football-players td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
    font-size: 14px;
}

#wg-api-football-games th,
#wg-api-football-standings th,
#wg-api-football-players th {
    background-color: #f9fafb;
    font-weight: 600;
    color: #374151;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

#wg-api-football-games tr:hover,
#wg-api-football-standings tr:hover,
#wg-api-football-players tr:hover {
    background-color: #f9fafb;
}

/* Toolbar styling for games widget */
#wg-api-football-games .toolbar {
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
    padding: 8px;
}

#wg-api-football-games .toolbar button {
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    padding: 4px 8px;
    margin: 0 2px;
    font-size: 12px;
    color: #6b7280;
}

#wg-api-football-games .toolbar button.active {
    background: #10b981;
    color: #fff;
    border-color: #10b981;
}

/* Live games animations and styles */
.live-indicator {
    display: flex;
    align-items: center;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Mobile responsiveness for widgets */
@media (max-width: 768px) {
    .widget-panel {
        min-height: 300px;
    }
    
    #wg-api-football-games,
    #wg-api-football-standings,
    #wg-api-football-players {
        font-size: 12px;
    }
    
    #wg-api-football-games th,
    #wg-api-football-games td,
    #wg-api-football-standings th,
    #wg-api-football-standings td,
    #wg-api-football-players th,
    #wg-api-football-players td {
        padding: 6px 8px;
        font-size: 12px;
    }
    
    #wg-api-football-games .toolbar {
        padding: 6px;
    }
    
    #wg-api-football-games .toolbar button {
        padding: 3px 6px;
        font-size: 11px;
    }
}
