/* ============================================
   Context Snipper - Combined Styles
   ============================================ */

/* === Reset & Base === */

:root {
    --primary-color: #4A90E2;
    --primary-dark: #357ABD;
    --secondary-color: #FFD700;
    --background: #f5f5f5;
    --text-primary: #333;
    --text-secondary: #666;
    --border-color: #ddd;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    
    /* Responsive scaling factor - adjust base font size */
    font-size: clamp(12px, 1vw, 16px);
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden;
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
        'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* === App Layout === */

.app {
    height: 100vh;
    overflow: hidden;
    background: linear-gradient(135deg, #1a0b2e 0%, #3a1c5d 100%);
    padding: clamp(0.5rem, 1vw, 0.75rem);
    display: flex;
    flex-direction: column;
}

.app-header {
    margin-bottom: clamp(0.3rem, 0.5vh, 0.5rem);
    color: white;
    flex-shrink: 0;
}

.app-header-content {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    position: relative;
}

.app-header-text {
    text-align: center;
    flex: 1;
}

.app-header h1 {
    margin: 0 0 0.25rem 0;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

.subtitle {
    margin: 0;
    font-size: clamp(0.85rem, 1.5vw, 1.2rem);
    opacity: 0.95;
}

.app-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr;
    gap: clamp(0.5rem, 1vw, 0.75rem);
    flex: 1;
    overflow: hidden;
    max-width: 1800px;
    margin: 0 auto;
    width: 100%;
}

.theme-picker-section {
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    height: 100%;
}

.idea-picker-section {
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* === Theme Picker Panel === */

.theme-picker {
    display: flex;
    flex-direction: column;
    gap: clamp(0.5rem, 1vh, 0.75rem);
    background: white;
    border-radius: clamp(8px, 1vw, 12px);
    padding: clamp(0.75rem, 1.5vh, 1rem);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    height: 100%;
    overflow-y: auto;
}

.theme-picker-header {
    margin: 0;
    padding-bottom: clamp(0.3rem, 0.5vh, 0.5rem);
    border-bottom: 2px solid #e0e0e0;
}

.theme-picker-header h2 {
    margin: 0;
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
    color: #333;
    font-weight: 700;
}

.theme-topic-selector {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: clamp(0.3rem, 0.5vh, 0.5rem);
    position: relative;
    z-index: 100;
}

.theme-topic-selector label {
    font-weight: 600;
    color: #555;
    font-size: clamp(0.9rem, 1.8vw, 1.2rem);
}

.theme-topic-dropdown-container {
    width: 100%;
}

.theme-spinner-container {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    margin-top: 0;
    padding: 0.5rem 0;
    overflow: hidden;
}

.theme-picker-empty {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
    font-style: italic;
    min-height: 0;
}

/* === Custom Dropdown === */

.custom-dropdown {
    position: relative;
    width: 100%;
    font-family: inherit;
}

button.dropdown-trigger {
    appearance: none;
    font-family: inherit;
    font-size: inherit;
    text-align: left;
    color: inherit;
}

.dropdown-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: clamp(8px, 1.5vh, 12px) clamp(12px, 2vw, 20px);
    background: white;
    border: 1px solid #e0e7ff;
    border-radius: clamp(8px, 1vw, 12px);
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: clamp(40px, 7vh, 56px);
}

.dropdown-trigger:hover {
    border-color: #832EC5;
    box-shadow: 0 2px 8px rgba(131, 46, 197, 0.05);
}

.is-open .dropdown-trigger {
    border-color: #832EC5;
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 4px;
}

.selected-value {
    display: flex;
    align-items: center;
    gap: clamp(8px, 1vw, 12px);
    font-size: clamp(1rem, 2.5vw, 1.375rem);
    font-weight: 600;
    color: #1a1a3a;
}

.selected-value.placeholder {
    color: #94a3b8;
    font-weight: 400;
}

.dropdown-emoji {
    font-size: clamp(1rem, 2vw, 1.4rem);
}

.dropdown-trigger.editable {
    padding: 0;
    overflow: hidden;
}

.dropdown-input {
    width: 100%;
    height: clamp(40px, 7vh, 56px);
    padding: clamp(8px, 1.5vh, 12px) clamp(12px, 2vw, 20px);
    border: none;
    font-size: clamp(1rem, 2.5vw, 1.375rem);
    font-weight: 600;
    color: #1a1a3a;
    background: transparent;
    font-family: inherit;
}

.dropdown-input:focus {
    outline: none;
}

.dropdown-input::placeholder {
    color: #94a3b8;
    font-weight: 400;
}

.dropdown-chevron {
    display: flex;
    align-items: center;
    transition: transform 0.3s ease;
    color: #1a1a3a;
}

.dropdown-chevron.up {
    transform: rotate(180deg);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e0e7ff;
    border-radius: clamp(8px, 1vw, 12px);
    box-shadow: 0 clamp(5px, 1.5vh, 10px) clamp(15px, 3vh, 25px) rgba(0, 0, 0, 0.08);
    z-index: 1000;
    max-height: clamp(200px, 35vh, 300px);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 4px 0;
}

.dropdown-menu::-webkit-scrollbar {
    width: clamp(6px, 1vw, 8px);
}

.dropdown-menu::-webkit-scrollbar-track {
    background: transparent;
}

.dropdown-menu::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 10px;
    border: 2px solid white;
}

.dropdown-menu::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: clamp(8px, 1vw, 12px);
    padding: clamp(10px, 1.5vh, 14px) clamp(12px, 2vw, 20px);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: clamp(1rem, 2.2vw, 1.25rem);
    font-weight: 500;
    color: #1a1a3a;
    line-height: 1.4;
}

.dropdown-item:hover {
    background-color: #f8f7ff;
}

.dropdown-item.selected {
    color: #832EC5;
    font-weight: 600;
}

.dropdown-divider {
    height: 1px;
    background-color: #f1f5f9;
    margin: 0;
}

.disabled .dropdown-trigger {
    opacity: 0.5;
    cursor: not-allowed;
}

/* === Topic Text Input === */

.topic-input {
    width: 100%;
    padding: clamp(8px, 1.5vh, 12px) clamp(12px, 2vw, 20px);
    background: white;
    border: 1px solid #e0e7ff;
    border-radius: clamp(8px, 1vw, 12px);
    font-size: clamp(1rem, 2.5vw, 1.375rem);
    font-weight: 600;
    color: #1a1a3a;
    font-family: inherit;
    min-height: clamp(40px, 7vh, 56px);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.topic-input:hover {
    border-color: #832EC5;
    box-shadow: 0 2px 8px rgba(131, 46, 197, 0.05);
}

.topic-input:focus {
    outline: none;
    border-color: #832EC5;
    box-shadow: 0 0 0 3px rgba(131, 46, 197, 0.1);
}

.topic-input::placeholder {
    color: #94a3b8;
    font-weight: 400;
}

/* === Context Wheel === */

.context-wheel-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: clamp(0.75rem, 2vh, 1.5rem);
    margin-top: 0;
    overflow: visible;
    width: 100%;
    height: 100%;
}

.details-placeholder {
    height: clamp(120px, 20vh, 220px);
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.wheel-wrapper {
    position: relative;
    width: min(400px, 40vw, 50vh);
    height: min(400px, 40vw, 50vh);
    aspect-ratio: 1 / 1;
    flex-shrink: 0;
    margin-top: clamp(5px, 1vh, 10px);
    margin-left: auto;
    margin-right: auto;
    overflow: visible;
}

.wheel {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    position: relative;
    overflow: hidden;
    border: 2px solid #1a1a3a;
    box-shadow: 0 0 clamp(20px, 4vw, 40px) rgba(0, 0, 0, 0.2);
    will-change: transform;
}

.wheel.spinning {
    box-shadow: 0 0 clamp(25px, 5vw, 50px) rgba(0, 0, 0, 0.25);
}


.wheel-segment {
    position: absolute;
    top: 50%;
    left: 50%;
    transform-origin: 0 0;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 0;
    height: 0;
    overflow: visible;
}

.wheel-tick {
    position: absolute;
    top: 0;
    left: 50%;
    width: 2px;
    height: clamp(12px, 2vh, 20px);
    background: rgba(0, 0, 0, 0.1);
    transform-origin: 0 min(200px, 20vw, 25vh);
    margin-left: -1px;
}

.segment-label {
    font-size: clamp(1rem, 2vw, 1.5rem);
    font-weight: 600;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.4);
    white-space: nowrap;
    display: inline-block;
    transform-origin: center center;
    text-align: center;
    max-width: none;
    overflow: visible;
    min-width: fit-content;
}

.wheel-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: clamp(60px, 8vw, 80px);
    height: clamp(60px, 8vw, 80px);
    background: white;
    border-radius: 50%;
    border: 2px solid #1a1a3a;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.spin-button {
    background: linear-gradient(90deg, #832EC5 0%, #B900FF 50%, #FFC700 100%);
    color: white;
    border: 2px solid #832EC5;
    border-radius: 50%;
    width: clamp(55px, 7.5vw, 75px);
    height: clamp(55px, 7.5vw, 75px);
    font-size: clamp(0.75rem, 1.5vw, 0.95rem);
    font-weight: 800;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 10px rgba(131, 46, 197, 0.3);
    text-transform: uppercase;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
}

.spin-button:hover:not(:disabled) {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(131, 46, 197, 0.4);
    filter: brightness(1.1);
}

.spin-button:active:not(:disabled) {
    transform: scale(0.95);
}

.spin-button:disabled {
    background: #e0e0e0;
    color: #a0a0a0;
    border-color: #d0d0d0;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* === Context Details (Speech Bubble) === */

.context-details-wrapper {
    position: relative;
    margin-bottom: clamp(-10px, -1.5vh, -15px);
    z-index: 40;
    filter: drop-shadow(0 clamp(5px, 1.5vh, 10px) clamp(8px, 2vh, 15px) rgba(131, 46, 197, 0.2));
}

.context-details {
    position: relative;
    background: white;
    min-width: clamp(150px, 20vw, 180px);
    max-width: clamp(250px, 35vw, 300px);
    width: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 3px;
    clip-path: polygon(25px 0, calc(100% - 25px) 0,
        calc(100% - 13px) 3px, calc(100% - 5px) 11px, 100% 25px,
        100% calc(100% - 50px), calc(100% - 5px) calc(100% - 37px), calc(100% - 13px) calc(100% - 29px), calc(100% - 25px) calc(100% - 25px),
        calc(50% + 20px) calc(100% - 25px), 50% 100%, calc(50% - 20px) calc(100% - 25px),
        25px calc(100% - 25px), 13px calc(100% - 29px), 5px calc(100% - 37px), 0 calc(100% - 50px),
        0 25px, 5px 11px, 13px 3px);
}

.context-details::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(from 0deg,
        transparent 0%,
        rgba(185, 0, 255, 0.4) 12%,
        rgba(255, 255, 255, 0.8) 25%,
        rgba(185, 0, 255, 0.4) 38%,
        transparent 50%);
    animation: rotate-glow 6s linear infinite;
    z-index: 1;
    filter: blur(4px);
}

.context-details-content {
    position: relative;
    z-index: 2;
    background: white;
    width: 100%;
    height: 100%;
    padding: clamp(0.8rem, 2vh, 1.2rem) clamp(1.5rem, 3vw, 2.2rem);
    padding-bottom: clamp(1.8rem, 3.5vh, 2.5rem);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    clip-path: polygon(24px 1px, calc(100% - 24px) 1px,
        calc(100% - 14px) 4px, calc(100% - 6px) 12px, calc(100% - 1px) 24px,
        calc(100% - 1px) calc(100% - 51px), calc(100% - 6px) calc(100% - 38px), calc(100% - 14px) calc(100% - 30px), calc(100% - 24px) calc(100% - 26px),
        calc(50% + 19px) calc(100% - 26px), 50% calc(100% - 1px), calc(50% - 19px) calc(100% - 26px),
        24px calc(100% - 26px), 14px calc(100% - 30px), 6px calc(100% - 38px), 1px calc(100% - 51px),
        1px 24px, 6px 12px, 14px 4px);
}

.context-details-wrapper::after {
    display: none;
}

.animate-reveal {
    animation: reveal-card 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes reveal-card {
    0% {
        opacity: 0;
        transform: translateY(clamp(30px, 5vh, 50px)) scale(0.5) rotate(-10deg);
    }
    60% {
        transform: translateY(clamp(-10px, -2vh, -15px)) scale(1.1) rotate(2deg);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1) rotate(0);
    }
}

.context-details h3 {
    margin: 0;
    color: #832EC5;
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.1;
    text-align: center;
    padding: 0;
}

.sports-tags {
    display: flex;
    flex-wrap: wrap;
    gap: clamp(0.3rem, 0.5vw, 0.5rem);
}

.sport-tag {
    background: #E8F4F8;
    color: #4A90E2;
    padding: clamp(0.2rem, 0.3vh, 0.25rem) clamp(0.5rem, 1vw, 0.75rem);
    border-radius: clamp(8px, 1vw, 12px);
    font-size: clamp(0.65rem, 1.1vw, 0.75rem);
    font-weight: 500;
}

/* Confetti */

.confetti-container {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    pointer-events: none;
    z-index: 100;
}

.confetti-particle {
    position: absolute;
    font-size: clamp(1rem, 2vw, 1.5rem);
    opacity: 0;
    animation: explode 0.8s ease-out var(--delay) forwards;
}

@keyframes explode {
    0% {
        transform: translate(-50%, -50%) rotate(0deg) scale(0);
        opacity: 0;
    }
    20% {
        opacity: 1;
    }
    100% {
        transform: translate(calc(cos(var(--angle)) * clamp(100px, 15vw, 150px)), calc(sin(var(--angle)) * clamp(100px, 15vw, 150px))) rotate(360deg) scale(1.2);
        opacity: 0;
    }
}

/* === Idea Picker Panel === */

.idea-picker {
    display: flex;
    flex-direction: column;
    gap: clamp(0.5rem, 1vh, 0.75rem);
    background: white;
    border-radius: clamp(8px, 1vw, 12px);
    padding: clamp(0.75rem, 1.5vh, 1rem);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    height: 100%;
    overflow: hidden;
}

.idea-picker-header {
    margin: 0;
    padding-bottom: clamp(0.3rem, 0.5vh, 0.5rem);
    border-bottom: 2px solid #e0e0e0;
    flex-shrink: 0;
}

.idea-picker-header h2 {
    margin: 0;
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
    color: #333;
    font-weight: 700;
}

.idea-picker-controls {
    display: flex;
    flex-direction: column;
    gap: clamp(0.5rem, 1vh, 0.75rem);
    flex-shrink: 0;
}

.controls-row {
    display: flex;
    gap: clamp(0.5rem, 1vw, 0.75rem);
    width: 100%;
}

.controls-row .control-group {
    flex: 1;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    position: relative;
    z-index: 100;
}

.control-group label {
    font-weight: 600;
    color: #555;
    font-size: clamp(0.9rem, 1.8vw, 1.2rem);
}

.theme-dropdown-container.glowing .dropdown-trigger {
    animation: border-glow 2s ease-in-out;
    border-color: #832EC5;
}

@keyframes border-glow {
    0% {
        box-shadow: 0 0 0 0 rgba(131, 46, 197, 0.7);
        border-color: #ddd;
    }
    30% {
        box-shadow: 0 0 0 10px rgba(131, 46, 197, 0);
        border-color: #832EC5;
    }
    60% {
        box-shadow: 0 0 0 15px rgba(131, 46, 197, 0);
        border-color: #832EC5;
    }
    100% {
        box-shadow: 0 0 0 0 rgba(131, 46, 197, 0);
        border-color: #ddd;
    }
}

/* === Generate Button === */

.generate-ideas-button {
    position: relative;
    width: 100%;
    padding: clamp(0.75rem, 1.5vh, 1rem) clamp(1rem, 2vw, 1.5rem);
    font-size: clamp(0.9rem, 1.8vw, 1.2rem);
    font-weight: 800;
    cursor: pointer;
    border-radius: clamp(8px, 1vw, 12px);
    border: none;
    background: #B900FF;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 20px rgba(131, 46, 197, 0.4);
    color: white;
    text-transform: none;
    letter-spacing: -0.02em;
    font-family: inherit;
}

.generate-ideas-button .button-content {
    position: relative;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(0.5rem, 1vw, 1rem);
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.generate-ideas-button::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(from 0deg,
        transparent 0%,
        #FFC700 8%,
        #B900FF 18%,
        #832EC5 30%,
        transparent 45%);
    animation: rotate-glow 2.5s linear infinite;
    z-index: 1;
    filter: blur(8px);
}

.generate-ideas-button::after {
    content: '';
    position: absolute;
    inset: 4px;
    background: linear-gradient(90deg, #832EC5 0%, #B900FF 50%, #FFC700 100%);
    border-radius: clamp(6px, 0.8vw, 8px);
    z-index: 2;
    transition: all 0.3s ease;
}

@keyframes rotate-glow {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.bot-emoji {
    width: clamp(20px, 3vw, 28px);
    height: clamp(20px, 3vw, 28px);
    flex-shrink: 0;
    background: white;
    border-radius: 50%;
    padding: clamp(3px, 0.5vw, 4px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.generate-ideas-button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(131, 46, 197, 0.6);
}

.generate-ideas-button:hover:not(:disabled)::after {
    background: linear-gradient(90deg, #913cd6 0%, #c41aff 50%, #ffd433 100%);
}

.generate-ideas-button:active:not(:disabled) {
    transform: translateY(0) scale(0.98);
}

.generate-ideas-button:disabled {
    background: #e0e0e0;
    color: #a0a0a0;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.generate-ideas-button:disabled::before {
    display: none;
}

.generate-ideas-button:disabled::after {
    background: #e0e0e0;
    inset: 0;
    border-radius: 12px;
}

/* === Ideas Results === */

.ideas-results {
    flex: 1;
    overflow: hidden;
    min-height: 0;
    position: relative;
    display: flex;
    flex-direction: column;
}

.ideas-grid {
    display: flex;
    flex-direction: column;
    gap: clamp(0.5rem, 1vh, 0.75rem);
    padding: clamp(0.15rem, 0.3vh, 0.25rem) 0;
    height: 100%;
}

/* === Idea Card === */

.idea-card {
    background: white;
    border-radius: clamp(8px, 1vw, 12px);
    padding: clamp(1rem, 2vh, 1.5rem);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    border: 1px solid rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    box-sizing: border-box;
}

.idea-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #832EC5, #B900FF, #FFC700);
}

.idea-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
}

.idea-header {
    margin-bottom: clamp(0.75rem, 1.5vh, 1.25rem);
    padding-bottom: clamp(0.5rem, 1vh, 0.75rem);
    border-bottom: 1px dashed #e2e8f0;
}

.idea-title {
    margin: 0;
    color: #1a365d;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.01em;
}

.section-content {
    margin: 0;
    color: #4a5568;
    line-height: 1.5;
    font-size: clamp(1.2rem, 2.2vw, 1.6rem);
}

.situation-section {
    padding: 0;
    flex: 1;
}

/* Math inline styling */
.math-inline {
    font-family: 'KaTeX_Math', 'Times New Roman', serif;
    color: #2c3e50;
}

.math-inline .katex {
    font-size: 1em;
}

/* Legacy format */
.idea-scenario h4 {
    margin: 0 0 clamp(0.3rem, 0.5vh, 0.5rem) 0;
    color: #832EC5;
    font-size: clamp(0.85rem, 1.5vw, 1rem);
    font-weight: 600;
}

.idea-scenario p {
    margin: 0;
    color: #555;
    line-height: 1.6;
    font-size: clamp(0.85rem, 1.6vw, 1.1rem);
}

/* === Generating Loader === */

.generating-loader-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #ffffff;
    backdrop-filter: blur(clamp(8px, 1.5vw, 12px));
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    border-radius: clamp(8px, 1vw, 12px);
    animation: fadeInOverlay 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.loader-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(1rem, 2vh, 1.5rem);
    max-width: 90%;
}

.bot-animation-container {
    position: relative;
    width: clamp(150px, 25vw, 240px);
    height: clamp(150px, 25vw, 240px);
}

.bot-animation-container::before {
    content: '';
    position: absolute;
    top: 15%;
    right: 5%;
    width: 140px;
    height: 140px;
    background: radial-gradient(circle, rgba(185, 0, 255, 0.25) 0%, rgba(131, 46, 197, 0.1) 40%, rgba(131, 46, 197, 0) 70%);
    border-radius: 50%;
    filter: blur(30px);
    animation: magic-flicker 3s infinite ease-in-out;
    z-index: 0;
    pointer-events: none;
}

.bot-animation-container::after {
    content: '';
    position: absolute;
    top: 22%;
    right: 12%;
    width: 60px;
    height: 60px;
    background: radial-gradient(circle, rgba(255, 199, 0, 0.3) 0%, rgba(255, 199, 0, 0) 70%);
    border-radius: 50%;
    filter: blur(15px);
    animation: magic-flicker 3s infinite reverse ease-in-out;
    z-index: 0;
    pointer-events: none;
}

.bot-magic-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    will-change: opacity;
    user-select: none;
    mix-blend-mode: multiply;
}

.frame-1 {
    z-index: 1;
}

.frame-2 {
    opacity: 0;
    z-index: 2;
    animation: discovery-crossfade 5s infinite cubic-bezier(0.45, 0.05, 0.55, 0.95);
    -webkit-mask-image: radial-gradient(circle at 82% 28%, black 0%, black 10%, transparent 20%);
    mask-image: radial-gradient(circle at 82% 28%, black 0%, black 10%, transparent 20%);
}

/* Sparkles */

.sparkles-overlay {
    position: absolute;
    top: 28%;
    right: 18%;
    width: 1px;
    height: 1px;
    pointer-events: none;
    z-index: 3;
}

.css-sparkle {
    position: absolute;
    background: white;
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.9), 0 0 15px rgba(255, 199, 0, 0.6);
    opacity: 0;
    animation: discovery-float 4.5s infinite ease-out;
    will-change: transform, opacity;
}

.css-sparkle::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 140%;
    height: 20%;
    background: rgba(255, 255, 255, 0.8);
    transform: translate(-50%, -50%);
    border-radius: 50%;
}

.css-sparkle::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20%;
    height: 140%;
    background: rgba(255, 255, 255, 0.8);
    transform: translate(-50%, -50%);
    border-radius: 50%;
}

.css-sparkle:nth-child(4n) {
    background: #FFC700;
    box-shadow: 0 0 12px rgba(255, 199, 0, 0.8);
}

.css-sparkle:nth-child(4n+1) {
    background: #B900FF;
    box-shadow: 0 0 12px rgba(185, 0, 255, 0.8);
}

.css-sparkle:nth-child(1) { --tx: clamp(-40px, -6vw, -60px); --ty: clamp(-55px, -8vh, -80px); animation-delay: 0s; width: clamp(4px, 0.6vw, 5px); height: clamp(4px, 0.6vw, 5px); }
.css-sparkle:nth-child(2) { --tx: clamp(50px, 7vw, 70px); --ty: clamp(-35px, -5vh, -50px); animation-delay: 0.3s; width: clamp(3px, 0.5vw, 4px); height: clamp(3px, 0.5vw, 4px); }
.css-sparkle:nth-child(3) { --tx: clamp(-30px, -4vw, -40px); --ty: clamp(-75px, -11vh, -110px); animation-delay: 0.6s; width: clamp(5px, 0.7vw, 6px); height: clamp(5px, 0.7vw, 6px); }
.css-sparkle:nth-child(4) { --tx: clamp(55px, 8vw, 80px); --ty: clamp(-15px, -2vh, -20px); animation-delay: 0.9s; width: clamp(2.5px, 0.4vw, 3px); height: clamp(2.5px, 0.4vw, 3px); }
.css-sparkle:nth-child(5) { --tx: clamp(-15px, -2vw, -20px); --ty: clamp(-50px, -7vh, -70px); animation-delay: 1.2s; width: clamp(4px, 0.6vw, 5px); height: clamp(4px, 0.6vw, 5px); }
.css-sparkle:nth-child(6) { --tx: clamp(35px, 5vw, 50px); --ty: clamp(-60px, -9vh, -90px); animation-delay: 1.5s; width: clamp(3px, 0.5vw, 4px); height: clamp(3px, 0.5vw, 4px); }
.css-sparkle:nth-child(7) { --tx: clamp(-20px, -3vw, -30px); --ty: clamp(-30px, -4vh, -40px); animation-delay: 1.8s; width: clamp(4px, 0.6vw, 5px); height: clamp(4px, 0.6vw, 5px); }
.css-sparkle:nth-child(8) { --tx: clamp(30px, 4vw, 40px); --ty: clamp(-85px, -12vh, -120px); animation-delay: 2.1s; width: clamp(2.5px, 0.4vw, 3px); height: clamp(2.5px, 0.4vw, 3px); }
.css-sparkle:nth-child(9) { --tx: clamp(-50px, -7vw, -70px); --ty: clamp(-30px, -4vh, -40px); animation-delay: 2.4s; width: clamp(5px, 0.7vw, 6px); height: clamp(5px, 0.7vw, 6px); }
.css-sparkle:nth-child(10) { --tx: clamp(60px, 9vw, 90px); --ty: clamp(-42px, -6vh, -60px); animation-delay: 0.5s; width: clamp(3px, 0.5vw, 4px); height: clamp(3px, 0.5vw, 4px); }
.css-sparkle:nth-child(11) { --tx: clamp(15px, 2vw, 20px); --ty: clamp(-90px, -13vh, -130px); animation-delay: 1.0s; width: clamp(4px, 0.6vw, 5px); height: clamp(4px, 0.6vw, 5px); }
.css-sparkle:nth-child(12) { --tx: clamp(-55px, -8vw, -80px); --ty: clamp(-20px, -3vh, -30px); animation-delay: 1.5s; width: clamp(3px, 0.5vw, 4px); height: clamp(3px, 0.5vw, 4px); }

/* Progress Bar */

.loader-progress-container {
    width: clamp(180px, 30vw, 260px);
    height: clamp(4px, 0.8vh, 6px);
    background: rgba(0, 0, 0, 0.04);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.loader-progress-bar {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #832EC5, #B900FF, #FFC700, #832EC5);
    background-size: 300% 100%;
    border-radius: 10px;
    position: absolute;
    left: 0;
    top: 0;
    transform-origin: left;
    animation:
        progress-increase 2s infinite cubic-bezier(0.65, 0, 0.35, 1),
        gradient-flow 3s infinite linear;
    box-shadow: 0 0 clamp(6px, 1.5vw, 10px) rgba(185, 0, 255, 0.3);
}

.loader-text {
    font-family: 'Poppins', 'Outfit', 'Inter', sans-serif;
    font-weight: 600;
    color: #2D3748;
    font-size: clamp(0.85rem, 1.5vw, 1rem);
    margin: 0;
    letter-spacing: -0.01em;
    animation: text-subtle-pulse 2.5s infinite ease-in-out;
    user-select: none;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.8);
}

/* === Keyframes === */

@keyframes discovery-crossfade {
    0%, 15%, 85%, 100% { opacity: 0; }
    40%, 60% { opacity: 1; }
}

@keyframes discovery-float {
    0% {
        transform: translate3d(0, 0, 0) scale(0) rotate(0deg);
        opacity: 0;
    }
    15% {
        opacity: 1;
        transform: translate3d(0, 0, 0) scale(1.2) rotate(45deg);
    }
    100% {
        transform: translate3d(var(--tx), var(--ty), 0) scale(0) rotate(270deg);
        opacity: 0;
    }
}

@keyframes magic-flicker {
    0%, 100% { transform: scale(1); opacity: 0.3; }
    50% { transform: scale(1.1); opacity: 0.5; }
}

@keyframes progress-increase {
    0% { transform: scaleX(0); }
    45% { transform: scaleX(0.7); }
    70% { transform: scaleX(0.85); }
    100% { transform: scaleX(1); }
}

@keyframes gradient-flow {
    0% { background-position: 0% 50%; }
    100% { background-position: 100% 50%; }
}

@keyframes text-subtle-pulse {
    0%, 100% { opacity: 0.7; transform: translateY(0); }
    50% { opacity: 1; transform: translateY(-2px); }
}

@keyframes fadeInOverlay {
    from { opacity: 0; backdrop-filter: blur(0px); }
    to { opacity: 1; backdrop-filter: blur(12px); }
}

/* === Responsive === */

@media (max-width: 1200px) {
    .app-content {
        grid-template-columns: 1fr;
    }

    .theme-picker-section,
    .idea-picker-section {
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    .app {
        padding: 1rem;
    }

    .app-header-content {
        flex-direction: column;
        align-items: center;
        gap: 0.75rem;
        padding-right: 0;
    }

    .app-header-text {
        width: 100%;
    }

    .app-header h1 {
        font-size: 2rem;
    }

    .subtitle {
        font-size: 1rem;
    }

    .ideas-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 600px) {
    .controls-row {
        flex-direction: column;
        gap: 1rem;
    }
}

/* === Settings Button & Modal === */

.settings-button {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-button:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-50%) scale(1.05);
}

.settings-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.settings-modal-content {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.settings-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid #eee;
}

.settings-modal-header h3 {
    margin: 0;
    font-size: 1.5rem;
    color: var(--text-primary);
}

.close-modal-button {
    background: none;
    border: none;
    font-size: 2rem;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.close-modal-button:hover {
    background: #f0f0f0;
    color: #333;
}

.settings-modal-body {
    padding: 1.5rem;
}

.settings-modal-body label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.api-key-input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    font-family: 'Courier New', monospace;
    transition: border-color 0.2s ease;
}

.api-key-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.settings-help-text {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.settings-help-text a {
    color: var(--primary-color);
    text-decoration: none;
}

.settings-help-text a:hover {
    text-decoration: underline;
}

.api-status {
    margin-top: 1rem;
    padding: 0.75rem;
    border-radius: 6px;
    font-size: 0.9rem;
    display: none;
}

.api-status.success {
    display: block;
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.api-status.error {
    display: block;
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.settings-modal-footer {
    padding: 1.5rem;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
}

.save-settings-button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.save-settings-button:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(74, 144, 226, 0.3);
}

.save-settings-button:active {
    transform: translateY(0);
}
