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

html, body {
    height: 100%;
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #1e1f28;
    color: #e0e0e8;
    line-height: 1.6;
}

a {
    text-decoration: none;
    color: #61dafb;
    transition: color 0.2s ease;
}

a:hover {
    color: #4bb0e7;
}

.app {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.sidebar {
    width: 280px;
    background: #2a2b35;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #3a3b46;
}

.sidebar-header {
    padding: 20px 16px;
    border-bottom: 1px solid #3a3b46;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sidebar-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: #ffffff;
}

.new-chat-btn {
    padding: 12px;
    background: linear-gradient(145deg, #19c37d, #14a46a);
    border: none;
    border-radius: 10px;
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.new-chat-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.session-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.session-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 14px;
    transition: all 0.2s ease;
    cursor: pointer;
    background: #2a2b35;
}

.session-item:hover {
    background: #3c3d4b;
}


.session-item:hover {
    background: #3c3d4b;
}

.session-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.delete-btn {
    background: transparent;
    border: none;
    color: #ff5c5c;
    font-weight: bold;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0 6px;
}

.delete-btn:hover {
    color: #ff1f1f;
    transform: scale(1.2);
}

.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #1e1f28;
}

.top-bar {
    padding: 16px 24px;
    border-bottom: 1px solid #3a3b46;
    font-size: 16px;
    font-weight: 500;
    color: #ffffff;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.top-bar-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 16px;
}

.top-bar-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.control-btn {
    padding: 8px 14px;
    background: #3a3b4a;
    border: 1px solid #4b4c5a;
    border-radius: 8px;
    color: #e0e0e8;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.control-btn:hover {
    background: #4b4c5a;
    border-color: #61dafb;
    color: #61dafb;
}

.bg-color-picker {
    width: 40px;
    height: 40px;
    border: 2px solid #4b4c5a;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.bg-color-picker:hover {
    border-color: #61dafb;
    box-shadow: 0 0 8px rgba(97, 218, 251, 0.3);
}

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

.modal.hidden {
    display: none;
}

.modal-content {
    background: #2a2b35;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
    max-height: 85vh;
    overflow-y: auto;
    max-width: 900px;
    width: 90%;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #3a3b46;
    position: sticky;
    top: 0;
    background: #2a2b35;
    z-index: 10;
}

.modal-header h2 {
    font-size: 20px;
    color: #ffffff;
    margin: 0;
}

.modal-close {
    background: transparent;
    border: none;
    color: #e0e0e8;
    font-size: 28px;
    cursor: pointer;
    transition: color 0.2s ease;
}

.modal-close:hover {
    color: #ff5c5c;
}

.modal-body {
    padding: 24px;
}

.personal-data-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.personal-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: #3a3b4a;
    border-radius: 12px;
}

.personal-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(145deg, #19c37d, #14a46a);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: #ffffff;
    font-weight: bold;
    flex-shrink: 0;
}

.personal-info h3 {
    margin: 0 0 4px 0;
    color: #ffffff;
    font-size: 18px;
}

.personal-info p {
    margin: 0;
    color: #a0a0b0;
    font-size: 14px;
}

.data-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.data-section h4 {
    margin: 0;
    color: #61dafb;
    font-size: 16px;
    font-weight: 600;
}

.search-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.search-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: #3a3b4a;
    border-radius: 8px;
    font-size: 14px;
}

.search-query {
    color: #e0e0e8;
    flex: 1;
}

.search-date {
    color: #7a7a8a;
    font-size: 12px;
    margin-left: 12px;
}

.shopping-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.shopping-item {
    background: #3a3b4a;
    padding: 12px;
    border-radius: 8px;
}

.shopping-product {
    color: #ffffff;
    font-weight: 500;
    margin-bottom: 6px;
}

.shopping-details {
    display: flex;
    gap: 12px;
    font-size: 12px;
    color: #a0a0b0;
}

.shopping-price {
    color: #19c37d;
    font-weight: 600;
}

.shopping-date, .shopping-id {
    color: #7a7a8a;
}

.watch-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.watch-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: #3a3b4a;
    border-radius: 8px;
}

.watch-title {
    color: #e0e0e8;
    flex: 1;
    font-size: 14px;
}

.watch-info {
    color: #7a7a8a;
    font-size: 12px;
    margin-left: 12px;
}

.wishlist-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px;
}

.wishlist-item {
    background: #3a3b4a;
    padding: 12px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wishlist-product {
    color: #e0e0e8;
    font-weight: 500;
    font-size: 14px;
}

.wishlist-price {
    color: #19c37d;
    font-weight: 600;
    font-size: 15px;
}

.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 30px 0;
    background: #1e1f28;
}

.chat-wrapper {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
    background: #2c2d38;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.4);
    background-size: cover;
    background-position: center;
    background-attachment: local;
}

.chat-wrapper h2 {
    font-size: 22px;
    color: #ffffff;
    margin-bottom: 20px;
    font-weight: 600;
}

.chat-wrapper input,
.chat-wrapper textarea {
    width: 100%;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid #4b4c5a;
    background: #1f202b;
    color: #e0e0e8;
    font-size: 15px;
    transition: all 0.2s ease;
}

.chat-wrapper input:focus,
.chat-wrapper textarea:focus {
    border-color: #61dafb;
    outline: none;
    box-shadow: 0 0 8px rgba(97, 218, 251, 0.3);
}

.chat-wrapper .send-btn {
    padding: 12px 22px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(145deg, #19c37d, #14a46a);
    color: #ffffff;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-wrapper .send-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.3);
}

.chat-wrapper .chat-wrapper-message-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.message-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.message {
    line-height: 1.6;
    font-size: 15px;
    white-space: pre-wrap;
    word-wrap: break-word;
    padding: 14px 18px;
    border-radius: 12px;
    position: relative;
    background: rgba(44, 45, 56, 0.9);
    color: #e0e0e8;
    transition: background 0.2s ease;
    backdrop-filter: blur(4px);
}

.message.user {
    background: rgba(58, 59, 74, 0.95);
    margin-left: auto;
    max-width: 70%;
    backdrop-filter: blur(4px);
}

.message.character {
    background: rgba(44, 45, 56, 0.9);
    max-width: 80%;
    backdrop-filter: blur(4px);
}

.message h1, .message h2, .message h3, .message h4, .message h5, .message h6 {
    color: #ffffff;
    margin-bottom: 6px;
}

.message strong {
    font-weight: 600;
}

.message em {
    font-style: italic;
}

.message a {
    color: #61dafb;
    text-decoration: underline;
}

.message blockquote {
    border-left: 4px solid #61dafb;
    padding-left: 12px;
    color: #b0b0c0;
    margin: 6px 0;
    font-style: italic;
}

.message ul, .message ol {
    margin: 6px 0;
    padding-left: 20px;
}

.message code {
    background: #3b3c50;
    color: #f5f5f5;
    padding: 2px 6px;
    border-radius: 5px;
    font-family: monospace;
    font-size: 14px;
}

.message pre {
    background: #2c2d38;
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    font-family: monospace;
    font-size: 14px;
    margin: 8px 0;
}

.regenerate-btn {
    margin-top: 8px;
    padding: 4px 8px;
    font-size: 12px;
    background: transparent;
    border: 1px solid #61dafb;
    color: #61dafb;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    width: fit-content;
    display: flex;
    align-items: center;
    gap: 4px;
}

.regenerate-btn:hover:not(:disabled) {
    background: rgba(97, 218, 251, 0.1);
    box-shadow: 0 0 8px rgba(97, 218, 251, 0.3);
}

.regenerate-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.input-area {
    padding: 18px 24px;
    border-top: 1px solid #3a3b46;
    background: #1e1f28;
}

.input-wrapper {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    gap: 10px;
}

.input-wrapper input {
    flex: 1;
    width: 600px;
    padding: 14px 10px;
    border-radius: 12px;
    border: 1px solid #4b4c5a;
    background: #2c2d38;
    color: #e0e0e8;
    font-size: 15px;
}

.input-wrapper input:focus {
    border-color: #61dafb;
    outline: none;
    box-shadow: 0 0 8px rgba(97, 218, 251, 0.3);
}

.send-btn {
    padding: 14px 22px;
    border-radius: 12px;
    border: none;
    background: linear-gradient(145deg, #19c37d, #14a46a);
    color: #ffffff;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.send-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.25);
}

.auth-container {
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #1e1f28;
}

.auth-box {
    background: #2a2b35;
    padding: 40px;
    border-radius: 16px;
    width: 360px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.4);
}

.auth-box h2 {
    margin-bottom: 24px;
    font-size: 22px;
    color: #ffffff;
}

.auth-box input {
    width: 100%;
    padding: 14px;
    margin-bottom: 16px;
    border-radius: 10px;
    border: 1px solid #4b4c5a;
    background: #2c2d38;
    color: #e0e0e8;
}

.auth-box button {
    width: 100%;
    padding: 14px;
    border-radius: 10px;
    border: none;
    background: linear-gradient(145deg, #19c37d, #14a46a);
    color: #ffffff;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.auth-box button:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.3);
}

::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-thumb {
    background: #4b4c5a;
    border-radius: 6px;
}

::-webkit-scrollbar-thumb:hover {
    background: #61dafb;
}

::-webkit-scrollbar-track {
    background: #1e1f28;
}

@media (max-width: 768px) {
    .app {
        flex-direction: column;
        overflow-y: auto;
    }

    .sidebar {
        width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid #3a3b46;
    }

    .sidebar-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 12px 16px;
    }

    .new-chat-btn {
        padding: 10px;
        font-size: 13px;
    }

    .session-list {
        flex-direction: row;
        overflow-x: auto;
        padding: 8px;
        gap: 8px;
    }

    .session-item {
        flex: 0 0 auto;
        padding: 8px 12px;
        font-size: 13px;
    }

    .main {
        flex: 1;
    }

    .chat-wrapper {
        padding: 20px;
        border-radius: 12px;
        overflow-y: auto;
    }

    .chat-wrapper h2 {
        font-size: 20px;
    }

    .input-wrapper {
        flex-direction: column;
        gap: 8px;
    }

    .input-wrapper input {
        width: 100%;
    }

    .send-btn {
        width: 100%;
        padding: 12px;
    }
}