/* Ureka Chat Container - Kid Friendly Theme */
@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800&display=swap');

#ureka-chat-wrapper {
    width: 100%;
    margin: 20px 0;
    font-family: 'Nunito', 'Segoe UI', sans-serif;
    /* Friendly rounded font */
    background: #ffffff;
    border-radius: 20px;
    /* Softer corners */
    box-shadow: 0 15px 35px rgba(50, 50, 93, 0.1), 0 5px 15px rgba(0, 0, 0, 0.07);
    overflow: hidden;
    position: relative;
    border: 4px solid #fff;
    /* White border for emphasis */
}

/* Tabs Header */
.uc-tabs {
    display: flex;
    background: #fdfdfd;
    padding: 10px 10px 0 10px;
    /* Reduced padding */
    border-bottom: none;
    background: linear-gradient(120deg, #89f7fe 0%, #66a6ff 100%);
}

.uc-tab {
    flex: 1;
    text-align: center;
    padding: 12px 5px;
    /* Compact padding */
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 12px 12px 0 0;
    cursor: pointer;
    font-weight: 700;
    color: #fff;
    transition: all 0.3s ease;
    font-size: 13px;
    /* Smaller font */
    margin: 0 3px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    letter-spacing: 0.5px;
}

.uc-tab:hover {
    background: rgba(255, 255, 255, 0.4);
    color: #fff;
}

.uc-tab.active {
    background: #fff;
    color: #2b6cb0;
    /* Deep Blue */
    box-shadow: 0 -4px 15px rgba(66, 153, 225, 0.4);
    /* Glowing effect */
    transform: translateY(0);
    position: relative;
    z-index: 1;
}

/* Add a glowing bottom border indicator */
.uc-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, #4facfe 0%, #00f2fe 100%);
    box-shadow: 0 0 10px #00f2fe;
}

/* Tab Content Pane */
.uc-content {
    background: #fff;
    min-height: 400px;
    background-image: radial-gradient(#e6e9f0 1px, transparent 1px);
    background-size: 20px 20px;
    /* Subtle grid pattern */
}

.uc-tab-pane {
    display: none;
    padding: 30px;
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.uc-tab-pane.active {
    display: block;
}

@keyframes popIn {
    0% {
        opacity: 0;
        transform: scale(0.95);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Inputs & Textareas */
#uc-word-input,
#uc-gk-input,
.uc-input-group math-field {
    width: 100%;
    padding: 15px;
    border: 3px solid #e0e7ff;
    border-radius: 15px;
    margin-bottom: 20px;
    font-size: 17px;
    transition: all 0.3s;
    box-sizing: border-box;
    font-family: inherit;
    background: #fbfdff;
    color: #333;
}

#uc-word-input:focus,
#uc-gk-input:focus,
.uc-input-group math-field:focus-within {
    border-color: #ff9a9e;
    /* Playful Pink/Orange focus */
    outline: none;
    box-shadow: 0 0 0 4px rgba(255, 154, 158, 0.2);
    transform: scale(1.01);
}

/* Math Toolbar */
.uc-toolbar {
    margin-bottom: 12px;
    background: #f1f5f9;
    padding: 5px;
    /* Minimal padding when closed */
    border-radius: 10px;
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
}

.uc-toolbar-toggle {
    width: 100%;
    background: transparent;
    border: none;
    color: #4a5568;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    padding: 5px;
    text-align: center;
    border-radius: 6px;
}

.uc-toolbar-toggle:hover {
    background: #e2e8f0;
    color: #2d3748;
}

.uc-toolbar-content {
    display: flex;
    /* Hidden by default via inline style, but this is for when open */
    flex-wrap: wrap;
    gap: 4px;
    padding-top: 8px;
    /* Space between toggle and buttons */
    margin-top: 5px;
    border-top: 1px solid #e2e8f0;
}

/* Ensure hidden state overrides display flex when toggled off via JS */
.uc-toolbar-content[style*="display: none"] {
    display: none !important;
}

.uc-sym-btn {
    padding: 5px 8px;
    /* Even smaller button */
    font-size: 13px;
    /* Smaller font */
    background: #fff;
    border: 1px solid #cbd5e0;
    /* Thinner border */
    border-radius: 6px;
    /* Slightly tighter radius */
    cursor: pointer;
    transition: all 0.2s;
    color: #2d3748;
    /* Darker text */
    font-weight: 700;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    /* Softer shadow */
    margin-bottom: 2px;
    flex-grow: 1;
    /* Allow buttons to grow to fill space */
    min-width: 30px;
    /* Minimum width for touch targets */
    text-align: center;
}

/* Specific styling for the fraction button to match sym-btn */
.uc-fraction-btn {
    padding: 5px 8px;
    font-size: 13px;
    background: #4a5568;
    /* Distinct dark color */
    color: #fff;
    border: 1px solid #2d3748;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 700;
    margin-bottom: 2px;
    flex-grow: 1;
    min-width: 40px;
}

.uc-fraction-btn:hover {
    background: #2d3748;
}

.uc-sym-btn:active {
    transform: translateY(1px);
    box-shadow: none;
}

.uc-sym-btn:hover {
    border-color: #66a6ff;
    color: #0056b3;
    background: #f0f7ff;
}

/* Primary Buttons */
.uc-solve-btn,
.uc-send-btn {
    background: linear-gradient(135deg, #ff9966 0%, #ff5e62 100%);
    /* Adjusted gradient angle */
    color: white;
    border: none;
    padding: 12px 25px;
    /* Slightly smaller */
    border-radius: 50px;
    cursor: pointer;
    font-size: 16px;
    /* Slightly smaller */
    font-weight: 700;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 10px rgba(255, 94, 98, 0.3);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.uc-solve-btn:hover,
.uc-send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(255, 94, 98, 0.4);
}

.uc-solve-btn:active,
.uc-send-btn:active {
    transform: translateY(1px);
}

/* Chat Interface */
.uc-chat-box {
    height: 400px;
    overflow-y: auto;
    border: 2px solid #e2e8f0;
    /* Thinner border */
    padding: 20px;
    margin-bottom: 20px;
    background: #f8fafc;
    /* Cleaner background */
    border-radius: 12px;
    display: flex;
    flex-direction: column;
}

.uc-message {
    padding: 12px 18px;
    margin-bottom: 12px;
    border-radius: 12px;
    max-width: 85%;
    /* Slightly wider */
    line-height: 1.5;
    position: relative;
    font-size: 15px;
    /* Comfortable reading size */
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    font-weight: 500;
    -webkit-font-smoothing: antialiased;
    /* Sharper text */
    -moz-osx-font-smoothing: grayscale;
}

.uc-ai-message {
    background: #ffffff;
    color: #1a202c;
    /* Deep black/gray for high contrast */
    align-self: flex-start;
    border-bottom-left-radius: 2px;
    border-left: 4px solid #3182ce;
    /* Solid blue accent */
    border: 1px solid #edf2f7;
    /* Subtle border definition */
}

.uc-user-message {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    /* Pure white */
    align-self: flex-end;
    border-bottom-right-radius: 2px;
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.1);
    /* Subtle text shadow for white text */
}

/* Chat Controls */
.uc-chat-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    justify-content: center;
    flex-wrap: wrap;
}

.uc-chat-controls select {
    padding: 10px 35px 10px 15px;
    border-radius: 20px;
    border: 1px solid #cbd5e0;
    background: #fff;
    cursor: pointer;
    font-size: 14px;
    color: #2d3748;
    font-weight: 600;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03);
}

.uc-chat-controls select:hover {
    border-color: #3182ce;
}

/* Result Areas */
#uc-math-result {
    margin-top: 25px;
    padding: 25px;
    background: #e0ffd4;
    /* Light Green */
    border: 3px dashed #76db91;
    border-radius: 15px;
    color: #00600f;
    position: relative;
}

#uc-math-result:before {
    content: "✨ Success!";
    position: absolute;
    top: -15px;
    left: 20px;
    background: #76db91;
    color: #fff;
    padding: 5px 15px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 14px;
}

#uc-math-result h3 {
    margin-top: 10px;
    color: #00600f;
}

.uc-step-item {
    margin-bottom: 15px;
    padding: 15px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border-left: 5px solid #ff9a9e;
    /* Pink accent */
}

/* Floating Button */
#uc-floating-ask-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: linear-gradient(45deg, #ff0844 0%, #ffb199 100%);
    color: white;
    width: 50px;
    /* Smaller */
    height: 50px;
    /* Smaller */
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 5px 15px rgba(255, 8, 68, 0.3);
    text-decoration: none;
    font-weight: 800;
    font-size: 14px;
    /* Smaller font */
    z-index: 9999;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 3px solid rgba(255, 255, 255, 0.8);
    /* Semi-transparent border */
    animation: pulse 3s infinite;
    opacity: 0.8;
    /* Transparent */
}

#uc-floating-ask-btn:hover {
    transform: scale(1.1) rotate(5deg);
    opacity: 1;
    /* Full visibility on hover */
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 8, 68, 0.4);
    }

    70% {
        box-shadow: 0 0 0 15px rgba(255, 8, 68, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(255, 8, 68, 0);
    }
}

/* Suggestion Chips */
.uc-suggestions-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
    margin-bottom: 15px;
    background: #fffff0;
    /* Very light yellow-white */
    padding: 15px;
    border-radius: 12px;
    border: 1px solid #fcfcda;
    align-self: flex-start;
    max-width: 80%;
    margin-left: 20px;
    /* Align with AI message */
}

.uc-suggestion-chip {
    background: transparent;
    border: none;
    color: #3182ce;
    /* Blue text */
    text-align: left;
    padding: 2px 0;
    cursor: pointer;
    text-decoration: underline;
    /* Looks like a link */
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: flex-start;
    transition: color 0.2s;
}

.uc-suggestion-chip::before {
    content: '•';
    color: #3182ce;
    margin-right: 10px;
    font-size: 18px;
    line-height: 1;
}

.uc-suggestion-chip:hover {
    color: #2c5282;
    /* Darker blue on hover */
    text-decoration: none;
    background: transparent !important;
}

/* Responsiveness */
@media (max-width: 600px) {
    #ureka-chat-wrapper {
        margin: 10px;
        border-width: 2px;
        border-radius: 15px;
    }

    .uc-tabs {
        flex-direction: row;
        padding: 5px;
    }

    .uc-tab {
        font-size: 14px;
        padding: 10px 5px;
        border-radius: 10px;
    }
}

/* Fraction Modal */
.uc-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    backdrop-filter: blur(2px);
}

.uc-modal-content {
    background: #fff;
    padding: 25px;
    border-radius: 20px;
    width: 300px;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.1);
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.uc-modal-content h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #2d3748;
}

.uc-fraction-input-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    margin-bottom: 20px;
    background: #f8fafc;
    padding: 15px;
    border-radius: 12px;
    border: 2px dashed #cbd5e0;
}

#uc-frac-num,
#uc-frac-den {
    width: 80%;
    text-align: center;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px;
    font-size: 18px;
    font-weight: bold;
}

#uc-frac-num:focus,
#uc-frac-den:focus {
    border-color: #3182ce;
    outline: none;
}

.uc-frac-line {
    width: 80%;
    height: 3px;
    background: #2d3748;
    border-radius: 2px;
}

.uc-modal-actions {
    display: flex;
    justify-content: space-around;
    gap: 10px;
}

#uc-insert-frac-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    flex: 1;
}

#uc-close-frac-btn {
    background: #edf2f7;
    color: #4a5568;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    flex: 1;
}