* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: #0a0a0a;
    color: #d0d0d0;
    line-height: 1.6;
}

.app {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-width: 900px;
    margin: 0 auto;
    background-color: #000000;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
}

/* =============================================================================
   HEADER
   ============================================================================= */
.header {
    position: relative;
    padding: 20px;
    background-color: #1a1a1a;
    color: #e8e8e8;
    text-align: center;
    border-bottom: 1px solid #2a2a2a;
}

.header__main {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 8px;
}

.header__logo {
    width: 50px;
    height: 50px;
}

.header__text {
    text-align: center;
}

.header h1 {
    font-size: 1.5rem;
    margin-bottom: 4px;
    color: #d8d8d8;
}

.header__subtitle {
    font-size: 0.85rem;
    color: #707070;
}

.header__links {
    margin-top: 12px;
    font-size: 0.8rem;
    display: flex;
    justify-content: center;
    gap: 16px;
    padding-left: 62px;
}

.header__link {
    color: #00b4d8;
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 16px;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.header__link:hover {
    background-color: #00b4d8;
    color: #ffffff;
}

/* =============================================================================
   MODEL SELECTOR (top-left of header, aligned with title)
   ============================================================================= */
.model-selector {
    position: absolute;
    top: 23px;
    left: 16px;
    z-index: 50;
}

.model-selector__button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid #333333;
    border-radius: 6px;
    color: #e0e0e0;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.model-selector__button:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: #505050;
}

.model-selector__label {
    font-weight: 500;
}

.model-selector__chevron {
    color: #707070;
    font-size: 0.65rem;
    transition: transform 0.2s ease;
}

.model-selector__dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    width: 220px;
    background-color: #1a1a1a;
    border: 1px solid #333333;
    border-radius: 8px;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s ease;
    z-index: 100;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.model-selector__dropdown--open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.model-selector__option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    cursor: pointer;
    transition: background-color 0.1s ease;
}

.model-selector__option:hover {
    background-color: #252525;
}

.model-selector__option:not(:last-child) {
    border-bottom: 1px solid #2a2a2a;
}

.model-selector__option-content {
    flex: 1;
}

.model-selector__option-name {
    font-weight: 500;
    font-size: 0.85rem;
    color: #e0e0e0;
    margin-bottom: 1px;
}

.model-selector__option-desc {
    font-size: 0.7rem;
    color: #707070;
}

.model-selector__check {
    color: #00b4d8;
    font-size: 0.8rem;
    margin-top: 2px;
}

/* =============================================================================
   CHAT
   ============================================================================= */
.chat {
    position: relative;
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    background-color: #000000;
}

.messages {
    display: none;
    flex-direction: column;
    gap: 16px;
}

/* =============================================================================
   WELCOME SCREEN
   ============================================================================= */
.welcome {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    text-align: center;
    padding: 20px;
    padding-top: 80px;
    max-width: 600px;
    margin: 0 auto;
}

.welcome__logo {
    width: 100px;
    height: 100px;
    margin-bottom: 20px;
}

.welcome__title {
    font-size: 1.8rem;
    color: #d8d8d8;
    margin-bottom: 12px;
}

.welcome__text {
    font-size: 1rem;
    color: #909090;
    margin-bottom: 16px;
}

.welcome__cold-start {
    font-size: 0.85rem;
    color: #707070;
    margin-bottom: 20px;
    padding: 10px 16px;
    background-color: #111111;
    border-radius: 8px;
    border-left: 3px solid #505050;
}

.welcome__cold-start i {
    margin-right: 6px;
}

/* =============================================================================
   TOAST NOTIFICATION
   ============================================================================= */
.toast {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 20px;
    background-color: #1a3a4a;
    border: 1px solid #00b4d8;
    border-radius: 10px;
    font-size: 0.9rem;
    color: #d0d0d0;
    max-width: 680px;
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transition: opacity 3s ease, visibility 3s ease;
}

.toast--visible {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.toast--fading {
    opacity: 0;
    visibility: hidden;
    transition: opacity 3s ease, visibility 3s ease;
}

.toast i {
    color: #00b4d8;
    font-size: 1.2rem;
    margin-top: 2px;
}

.toast strong {
    color: #00b4d8;
}

.welcome__starters-label {
    font-size: 0.9rem;
    color: #707070;
    margin-bottom: 12px;
}

.welcome__starters-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.welcome__starter-btn {
    background-color: transparent;
    border: 1px solid #00b4d8;
    color: #ffffff;
    padding: 10px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.welcome__starter-btn:hover {
    background-color: #00b4d8;
    color: #000000;
    box-shadow: 0 0 12px rgba(0, 180, 216, 0.4);
}

/* =============================================================================
   MESSAGES
   ============================================================================= */
.message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 12px;
    animation: fadeIn 0.3s ease;
}

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

.message--user {
    align-self: flex-end;
    background-color: #5b68a0;
    color: #e8e8e8;
    border-bottom-right-radius: 4px;
}

.message--ai {
    align-self: flex-start;
    background-color: #222222;
    color: #d0d0d0;
    border-bottom-left-radius: 4px;
}

.message--error {
    align-self: center;
    background-color: #802020;
    color: #f0f0f0;
}

.message__content {
    white-space: pre-wrap;
}

.message__meta {
    font-size: 0.75rem;
    opacity: 0.6;
    margin-top: 8px;
}

/* =============================================================================
   RETRY BUTTON (for error messages)
   ============================================================================= */
.message__retry {
    margin-top: 12px;
    text-align: center;
}

.retry__button {
    background-color: transparent;
    border: 1px solid #f0f0f0;
    color: #f0f0f0;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.retry__button:hover {
    background-color: #f0f0f0;
    color: #802020;
}

.retry__button i {
    font-size: 0.8rem;
}

/* =============================================================================
   SUGGESTED BUTTON
   ============================================================================= */
.suggested {
    margin-top: 12px;
}

.suggested__button {
    background-color: transparent;
    border: 1px solid #00b4d8;
    color: #c0c0c0;
    padding: 8px 14px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.suggested__button:hover {
    background-color: #00b4d8;
    color: #000000;
    box-shadow: 0 0 12px rgba(0, 180, 216, 0.4);
}

/* =============================================================================
   LOADING INDICATORS
   ============================================================================= */
.loading {
    align-self: flex-start;
    animation: fadeIn 0.3s ease;
}

.loading__bubble {
    display: inline-block;
    padding: 12px 16px;
    background-color: #222222;
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    width: 420px;
    box-sizing: border-box;
}

.loading__message, .loading__dots {
    font-style: italic;
    font-size: 0.9rem;
    color: #909090;
    transition: opacity 0.2s ease;
}

.loading__subtext {
    margin-top: 8px;
    font-size: 0.8rem;
    color: #606060;
    padding-left: 4px;
}

.loading__subtext i {
    margin-right: 6px;
    color: #00b4d8;
}

/* =============================================================================
   INPUT BAR
   ============================================================================= */
.input-bar {
    display: flex;
    flex-direction: column;
    padding: 16px 20px;
    background-color: #000000;
}

.input-bar__loader {
    display: none;
    justify-content: center;
    padding: 12px 0 16px 0;
}

.input-bar__loader--visible {
    display: flex;
}

.input-bar__row {
    display: flex;
    gap: 10px;
}

.input-bar__input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #333333;
    border-radius: 24px;
    font-size: 1rem;
    outline: none;
    background-color: #1a1a1a;
    color: #e0e0e0;
}

.input-bar__input:focus {
    border-color: #00b4d8;
}

.input-bar__input:disabled {
    background-color: #0f0f0f;
    color: #505050;
}

.input-bar__input::placeholder {
    color: #505050;
}

.input-bar__button {
    padding: 12px 24px;
    background-color: #5b68a0;
    color: #ffffff;
    border: none;
    border-radius: 24px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.input-bar__button:hover:not(:disabled) {
    background-color: #5b68a0;
    box-shadow: 0 0 6px rgba(98, 99, 141, 0.4);
}

.input-bar__button:disabled {
    background-color: #333333;
    color: #606060;
}

.loading__video {
    width: 120px;
    height: auto;
}

.loading__video--paused {
    filter: grayscale(0.8);
    opacity: 0.5;
}

/* =============================================================================
   MODALS
   ============================================================================= */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.85);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow-y: auto;
}

.modal--open {
    display: flex;
}

.modal__content {
    background-color: #1a1a1a;
    border: 1px solid #333333;
    border-radius: 16px;
    max-width: 700px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 28px;
    position: relative;
    animation: modalFadeIn 0.3s ease;
}

.modal__content--wide {
    max-width: 900px;
}

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

.modal__close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    color: #707070;
    font-size: 1.8rem;
    cursor: pointer;
}

.modal__close:hover {
    color: #ffffff;
}

.modal__title {
    font-size: 1.4rem;
    color: #e8e8e8;
    margin-bottom: 20px;
}

.modal__intro {
    color: #909090;
    font-size: 0.95rem;
    margin-bottom: 24px;
    line-height: 1.6;
}

.modal__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.modal__grid--3col {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

.modal__link {
    color: #00b4d8;
    text-decoration: none;
}

.modal__link:hover {
    text-decoration: underline;
}

.modal__section {
    margin-bottom: 16px;
}

.modal__section-title {
    font-size: 1rem;
    color: #00b4d8;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal__list {
    list-style: none;
    padding: 0;
}

.modal__list li {
    color: #909090;
    font-size: 0.85rem;
    padding: 4px 0 4px 16px;
    position: relative;
}

.modal__list li::before {
    content: "•";
    color: #00b4d8;
    position: absolute;
    left: 0;
}

.modal__list li strong {
    color: #d0d0d0;
}

.modal__section--contact {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid #333333;
    text-align: center;
}

.modal__section--note {
    margin-top: 20px;
    padding: 14px;
    background-color: #111111;
    border-radius: 8px;
    border-left: 3px solid #00b4d8;
}

.modal__section--note p {
    font-size: 0.85rem;
    color: #909090;
    margin: 0;
}

.modal__section--note i {
    color: #00b4d8;
    margin-right: 6px;
}

.modal__text {
    color: #b0b0b0;
    font-size: 0.9rem;
    margin-bottom: 12px;
}

.modal__contact-links {
    display: flex;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 16px;
}

.modal__contact-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #ffffff;
    text-decoration: none;
    padding: 10px 20px;
    border: 1px solid #00b4d8;
    border-radius: 24px;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.modal__contact-link:hover {
    background-color: #00b4d8;
    color: #000000;
    box-shadow: 0 0 12px rgba(0, 180, 216, 0.4);
}

/* Models Modal Specific Styles */
.modal__models-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.modal__model-card {
    background-color: #111111;
    border: 1px solid #2a2a2a;
    border-radius: 12px;
    padding: 20px;
}

.modal__model-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.modal__model-header h3 {
    font-size: 1rem;
    color: #e0e0e0;
    font-weight: 600;
}

.modal__model-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-size: 1.1rem;
}

.modal__model-icon--groq {
    background: linear-gradient(135deg, #00b4d8 0%, #0077b6 100%);
    color: #ffffff;
}

.modal__model-icon--custom {
    background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
    color: #ffffff;
}

.modal__model-card .modal__list {
    margin-bottom: 12px;
}

.modal__model-note {
    font-size: 0.8rem;
    color: #707070;
    font-style: italic;
    margin: 0;
    padding-top: 12px;
    border-top: 1px solid #2a2a2a;
}

/* =============================================================================
   STARTUP SCREEN
   ============================================================================= */
.startup {
    display: flex;
    flex: 1;
    align-items: center;
    justify-content: center;
    background-color: #000000;
    padding: 20px;
}

.startup__content {
    text-align: center;
}

.startup__logo {
    width: 80px;
    height: 80px;
    margin-bottom: 24px;
    animation: pulse 2s ease-in-out infinite;
}

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

.startup__text {
    font-size: 1.1rem;
    color: #909090;
}

.startup__error-icon {
    font-size: 3rem;
    color: #cc4444;
    margin-bottom: 20px;
}

.startup--error .startup__text {
    font-size: 1.3rem;
    color: #d0d0d0;
    margin-bottom: 12px;
}

.startup__error-detail {
    font-size: 0.95rem;
    color: #707070;
    margin-bottom: 24px;
}

.startup__retry-btn {
    background-color: #00a0c6;
    color: #ffffff;
    border: none;
    border-radius: 24px;
    padding: 12px 28px;
    font-size: 1rem;
    cursor: pointer;
}

.startup__retry-btn:hover {
    background-color: #00b4d8;
}

/* =============================================================================
   SCROLLBAR
   ============================================================================= */
.chat::-webkit-scrollbar {
    width: 6px;
}

.chat::-webkit-scrollbar-track {
    background: #000000;
}

.chat::-webkit-scrollbar-thumb {
    background: #333333;
    border-radius: 3px;
}

/* =============================================================================
   RESPONSIVE
   ============================================================================= */
@media (max-width: 600px) {
    .header h1 { font-size: 1.2rem; }
    .message { max-width: 90%; }
    .welcome__starter-btn { font-size: 0.8rem; padding: 8px 12px; }
    .modal__grid { grid-template-columns: 1fr; }
    .modal__models-grid { grid-template-columns: 1fr; }
}
