/* ========================================
   raxtin AI – Complete White Theme
   ======================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #ffffff;
    color: #1a1a2e;
    line-height: 1.6;
}

a {
    color: #7c6df0;
    text-decoration: none;
}
a:hover {
    color: #5a4bd1;
}

/* ---------- Buttons ---------- */
.btn-primary {
    display: inline-block;
    background: #7c6df0;
    border: none;
    padding: 0.7rem 2rem;
    border-radius: 30px;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}
.btn-primary:hover {
    background: #5a4bd1;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(124, 109, 240, 0.3);
}

/* ---------- Header ---------- */
header {
    padding: 1.2rem 5%;
    background: #ffffff;
    border-bottom: 1px solid #eaeaea;
    position: sticky;
    top: 0;
    z-index: 100;
}
nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
}
.logo {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: #1a1a2e;
}
.logo span {
    color: #7c6df0;
}
nav ul {
    list-style: none;
    display: flex;
    gap: 2rem;
    align-items: center;
}
nav ul li a {
    color: #555;
    font-weight: 500;
    transition: 0.2s;
}
nav ul li a:hover {
    color: #1a1a2e;
}
nav ul li .btn-primary {
    padding: 0.5rem 1.8rem;
}

/* ---------- Hero ---------- */
.hero {
    min-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: #f8f9fa;
    padding: 2rem;
}
.hero h1 {
    font-size: 4.2rem;
    font-weight: 800;
    color: #1a1a2e;
}
.hero h1 span {
    color: #7c6df0;
}
.hero .subhead {
    font-size: 1.3rem;
    color: #555;
    margin: 1rem auto 2rem;
}
.cta-box {
    background: #ffffff;
    border: 1px solid #eaeaea;
    border-radius: 24px;
    padding: 2.5rem 3rem;
    max-width: 650px;
    margin: 2rem auto;
    box-shadow: 0 10px 40px rgba(0,0,0,0.05);
}
.cta-box h2 {
    font-size: 2rem;
    color: #1a1a2e;
    margin-bottom: 0.5rem;
}
.cta-box p {
    color: #666;
    margin-bottom: 1.8rem;
}
.btn-cta {
    display: inline-block;
    background: #7c6df0;
    color: #fff;
    font-weight: 700;
    padding: 0.9rem 3.5rem;
    border-radius: 50px;
    font-size: 1.2rem;
    transition: 0.3s;
}
.btn-cta:hover {
    background: #5a4bd1;
    transform: scale(1.05);
}
.cta-note {
    display: block;
    margin-top: 0.8rem;
    font-size: 0.9rem;
    color: #999;
}
.stats {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
    margin-top: 2rem;
}
.stats span {
    background: #ffffff;
    padding: 0.4rem 1.5rem;
    border-radius: 30px;
    border: 1px solid #eaeaea;
    color: #555;
}
.features {
    padding: 5rem 5%;
    background: #ffffff;
    text-align: center;
}
.features h2 {
    font-size: 2.8rem;
    margin-bottom: 3rem;
    color: #1a1a2e;
}
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}
.feature-item {
    background: #f8f9fa;
    padding: 2.5rem 1.8rem;
    border-radius: 16px;
    border: 1px solid #eaeaea;
    transition: 0.3s;
}
.feature-item:hover {
    transform: translateY(-6px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.04);
}
.feature-item h3 {
    font-size: 1.5rem;
    color: #1a1a2e;
}
.feature-item p {
    color: #666;
}

/* ---------- Auth Pages ---------- */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: #f8f9fa;
    padding: 1.5rem;
}
.auth-container {
    max-width: 460px;
    width: 100%;
    background: #ffffff;
    padding: 2.5rem 2rem;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.06);
    border: 1px solid #eaeaea;
}
.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}
.auth-header .logo {
    font-size: 2rem;
    font-weight: 800;
    color: #1a1a2e;
}
.auth-header .logo span {
    color: #7c6df0;
}
.auth-subtitle {
    color: #777;
}
.form-group {
    margin-bottom: 1.5rem;
}
.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.4rem;
    color: #333;
}
.form-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e2e2e6;
    border-radius: 12px;
    font-size: 1rem;
    background: #fafafa;
}
.form-group input:focus {
    border-color: #7c6df0;
    outline: none;
}
.form-group input.error {
    border-color: #ff6b6b;
}
.field-error {
    color: #ff6b6b;
    font-size: 0.85rem;
}
.password-wrapper {
    position: relative;
}
.password-wrapper input {
    padding-right: 3rem;
}
.toggle-password {
    position: absolute;
    right: 1rem;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: #999;
}
.btn-block {
    width: 100%;
    padding: 0.9rem;
    font-size: 1.1rem;
    border-radius: 50px;
    margin-top: 0.5rem;
}
.auth-footer {
    text-align: center;
    margin-top: 1.5rem;
    color: #666;
}
.auth-footer a {
    color: #7c6df0;
    font-weight: 600;
}
.auth-features {
    display: flex;
    justify-content: center;
    gap: 1.2rem;
    margin-top: 2rem;
    padding-top: 1.2rem;
    border-top: 1px solid #eee;
    flex-wrap: wrap;
}
.auth-features span {
    font-size: 0.85rem;
    color: #666;
}
.auth-features i {
    color: #7c6df0;
}
.alert {
    padding: 0.8rem 1rem;
    border-radius: 12px;
    margin-bottom: 1.2rem;
}
.alert-error {
    background: #fff5f5;
    border-left: 4px solid #ff6b6b;
    color: #c0392b;
}

/* ========================================
   DASHBOARD (White Theme)
   ======================================== */

.app-container {
    display: flex;
    height: 100vh;
    background: #f8f9fa;
}

/* Sidebar */
.sidebar {
    width: 280px;
    background: #ffffff;
    border-right: 1px solid #eaeaea;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}
.sidebar-header {
    padding: 1.5rem 1.2rem;
    border-bottom: 1px solid #eaeaea;
}
.sidebar-header .logo {
    font-size: 1.6rem;
    font-weight: 700;
    color: #1a1a2e;
}
.sidebar-header .logo span {
    color: #7c6df0;
}
.new-chat-btn {
    width: 100%;
    padding: 0.7rem;
    background: #7c6df0;
    border: none;
    border-radius: 10px;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    margin-top: 0.8rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: 0.2s;
}
.new-chat-btn:hover {
    background: #5a4bd1;
}

/* ---------- My Account button (top) ---------- */
.account-btn-top {
    width: 100%;
    margin-top: 0.5rem;
    padding: 0.7rem;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 500;
    color: #333;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}
.account-btn-top:hover {
    background: #e0e0e0;
}

.conversation-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0.5rem;
}

/* ---------- Group Headers ---------- */
.group-header {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #999;
    padding: 0.6rem 0.8rem 0.3rem;
    border-bottom: 1px solid #eee;
    margin-bottom: 0.2rem;
}

/* ---------- Show More Button ---------- */
.show-more-btn {
    display: block;
    width: 100%;
    background: none;
    border: none;
    padding: 0.6rem 0.8rem;
    text-align: center;
    color: #7c6df0;
    font-weight: 500;
    cursor: pointer;
    transition: 0.2s;
    border-top: 1px solid #eee;
    margin-top: 0.5rem;
}
.show-more-btn:hover {
    background: #f0f0f0;
}
.show-more-btn i {
    margin-right: 0.3rem;
}
.show-more-btn .fa-chevron-up {
    display: none;
}
.show-more-btn.expanded .fa-chevron-down {
    display: none;
}
.show-more-btn.expanded .fa-chevron-up {
    display: inline-block;
}

/* ---------- Hidden Conversations ---------- */
.hidden-conv {
    display: none;
}
.show-all .hidden-conv {
    display: flex;
}

.conv-item {
    display: flex;
    align-items: center;
    padding: 0.6rem 0.8rem;
    margin: 0.2rem 0;
    border-radius: 8px;
    color: #4a4a4a;
    text-decoration: none;
    transition: 0.2s;
}
.conv-item:hover {
    background: #f0f0f0;
}
.conv-item.active {
    background: #e8e4f9;
    color: #1a1a2e;
}
.conv-item i {
    margin-right: 0.8rem;
    color: #7c6df0;
}
.conv-item span {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.delete-conv {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    opacity: 0;
    transition: 0.2s;
}
.conv-item:hover .delete-conv {
    opacity: 0.7;
}
.delete-conv:hover {
    color: #ff6b6b;
}
.empty-state {
    text-align: center;
    color: #aaa;
    padding: 2rem 0;
    font-size: 0.9rem;
}

.sidebar-footer {
    padding: 1rem 1.2rem;
    border-top: 1px solid #eaeaea;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}
.user-info {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}
.user-info img {
    border-radius: 50%;
    width: 40px;
    height: 40px;
}
.user-name {
    font-weight: 600;
    font-size: 0.9rem;
}
.subscription-badge {
    font-size: 0.7rem;
    padding: 0.2rem 0.7rem;
    border-radius: 20px;
}
.subscription-badge.active {
    background: #d4edda;
    color: #155724;
}
.subscription-badge.inactive {
    background: #f8d7da;
    color: #721c24;
}

/* ---------- Credits ---------- */
.credits-display {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.8rem;
    background: #f0f0f0;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #333;
    margin: 0.3rem 0 0.6rem;
}
.credits-display i {
    color: #7c6df0;
}
.credit-note {
    font-size: 0.7rem;
    color: #999;
    margin-left: 0.3rem;
}
.sidebar-actions {
    display: flex;
    gap: 0.5rem;
    width: 100%;
}
.logout-btn {
    flex: 1;
    background: #f0f0f0;
    border: none;
    padding: 0.5rem 0.8rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    color: #333;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-decoration: none;
}
.logout-btn:hover {
    background: #e0e0e0;
    color: #ff6b6b;
}

/* ---------- Chat Main ---------- */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #ffffff;
}
.chat-header {
    padding: 0.8rem 2rem;
    border-bottom: 1px solid #eaeaea;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #ffffff;
}

/* ---------- Model Toggle ---------- */
.model-toggle {
    display: inline-flex;
    background: #f0f0f0;
    border-radius: 30px;
    padding: 3px;
    border: 1px solid #ddd;
    gap: 2px;
}
.model-toggle .model-option {
    padding: 0.3rem 1.2rem;
    border: none;
    background: transparent;
    border-radius: 30px;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    transition: 0.2s;
    color: #555;
}
.model-toggle .model-option.active {
    background: #7c6df0;
    color: #fff;
    box-shadow: 0 2px 8px rgba(124, 109, 240, 0.3);
}
.model-toggle .model-option:hover:not(.active) {
    background: #e0e0e0;
}

.header-actions button {
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    transition: 0.2s;
}
.header-actions button:hover {
    background: #f0f0f0;
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 2rem 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    background: #ffffff;
}
.welcome-message {
    text-align: center;
    margin: auto;
    color: #888;
}
.welcome-message h2 {
    font-size: 2rem;
    color: #1a1a2e;
}
.message {
    display: flex;
    gap: 1rem;
    max-width: 80%;
    align-self: flex-start;
}
.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}
.message .avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}
.message.user .avatar {
    background: #7c6df0;
    color: #fff;
}
.message .content {
    background: #f8f9fa;
    padding: 0.8rem 1.2rem;
    border-radius: 16px;
    border: 1px solid #eaeaea;
    line-height: 1.6;
    word-wrap: break-word;
    white-space: pre-wrap;
}
.message.user .content {
    background: #7c6df0;
    color: #fff;
    border: none;
}
.message .content code {
    background: #eaeaea;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
}
.message.user .content code {
    background: rgba(255,255,255,0.2);
    color: #fff;
}
.message .content pre {
    background: #1a1a2e;
    padding: 1rem;
    border-radius: 8px;
    overflow-x: auto;
    margin: 0.5rem 0;
}
.message .content pre code {
    background: none;
    padding: 0;
    color: #e8edf5;
}

.input-area {
    padding: 1rem 2rem;
    border-top: 1px solid #eaeaea;
    background: #ffffff;
}
.quick-actions {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.8rem;
    flex-wrap: wrap;
}
.quick-btn {
    background: #f8f9fa;
    border: 1px solid #ddd;
    color: #555;
    padding: 0.3rem 1.2rem;
    border-radius: 30px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: 0.2s;
}
.quick-btn:hover {
    background: #e8e4f9;
    border-color: #7c6df0;
}
.chat-form {
    display: flex;
    gap: 0.8rem;
    align-items: flex-end;
}
.chat-form textarea {
    flex: 1;
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 12px;
    color: #1a1a2e;
    padding: 0.8rem 1.2rem;
    resize: vertical;
    font-family: inherit;
    min-height: 50px;
}
.chat-form textarea:focus {
    border-color: #7c6df0;
    outline: none;
}
.chat-form button {
    background: #7c6df0;
    border: none;
    border-radius: 50%;
    width: 46px;
    height: 46px;
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    transition: 0.2s;
    flex-shrink: 0;
}
.chat-form button:hover {
    background: #5a4bd1;
}
#typingIndicator {
    color: #888;
    padding: 0.5rem 0;
}

/* ---------- Modal (used for My Account) ---------- */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.4);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}
.modal-content {
    background: #ffffff;
    padding: 2.5rem;
    border-radius: 16px;
    max-width: 500px;
    width: 90%;
    position: relative;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}
.modal-content .close {
    position: absolute;
    right: 1.2rem;
    top: 1rem;
    font-size: 2rem;
    cursor: pointer;
    color: #888;
}
.modal-content .close:hover {
    color: #1a1a2e;
}
.modal-content h2 {
    margin-bottom: 1.5rem;
}
.modal-content label {
    display: block;
    margin: 1rem 0 0.3rem;
    font-weight: 500;
}
.modal-content input {
    width: 100%;
    padding: 0.7rem 1rem;
    background: #f8f9fa;
    border: 1px solid #ddd;
    border-radius: 8px;
}
.modal-content input:focus {
    border-color: #7c6df0;
    outline: none;
}
.modal-content .btn-primary {
    width: 100%;
    margin-top: 1.5rem;
}
.modal-content hr {
    border-color: #eaeaea;
    margin: 1.5rem 0;
}
.account-details {
    margin-bottom: 1.5rem;
}
.account-details p {
    margin: 0.4rem 0;
    padding: 0.3rem 0;
    border-bottom: 1px solid #eee;
}
.account-details p:last-child {
    border-bottom: none;
}
.subscription-info p {
    margin: 0.3rem 0;
}
.subscribe-link {
    color: #7c6df0;
    font-weight: 600;
}

/* Subscription Page */
.subscription-container {
    max-width: 500px;
    margin: 5rem auto;
    background: #ffffff;
    padding: 2.5rem;
    border-radius: 20px;
    border: 1px solid #eaeaea;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0,0,0,0.04);
}
.plan .price {
    font-size: 3rem;
    font-weight: 700;
    color: #7c6df0;
}
.plan ul {
    list-style: none;
    padding: 1rem 0;
    text-align: left;
    max-width: 300px;
    margin: 0 auto;
}
.plan ul li {
    padding: 0.4rem 0;
    display: flex;
    align-items: center;
    gap: 0.8rem;
}
.plan ul li::before {
    content: '✅';
    color: #28a745;
}

/* Admin */
.admin-container {
    padding: 2rem 5%;
    max-width: 1400px;
    margin: 0 auto;
}
.admin-container table {
    width: 100%;
    border-collapse: collapse;
    background: #ffffff;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.04);
}
.admin-container th {
    background: #f8f9fa;
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid #eaeaea;
}
.admin-container td {
    padding: 0.8rem 1rem;
    border-bottom: 1px solid #eaeaea;
}
.admin-container tr:hover td {
    background: #fafafa;
}
.admin-container input {
    background: #f8f9fa;
    border: 1px solid #ddd;
    padding: 0.3rem 0.6rem;
    border-radius: 6px;
    width: 80px;
}
.admin-container button {
    background: #7c6df0;
    border: none;
    color: #fff;
    padding: 0.3rem 1rem;
    border-radius: 6px;
    cursor: pointer;
}
.admin-container button:hover {
    background: #5a4bd1;
}

footer {
    text-align: center;
    padding: 2rem;
    color: #888;
    border-top: 1px solid #eaeaea;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    /* Sidebar slides out */
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100%;
        transform: translateX(-100%);
        z-index: 1000;
        width: 280px;
        box-shadow: 2px 0 20px rgba(0,0,0,0.1);
    }
    .sidebar.open {
        transform: translateX(0);
    }

    /* Hamburger menu */
    .menu-toggle {
        display: block;
        background: none;
        border: none;
        font-size: 1.8rem;
        cursor: pointer;
        color: #1a1a2e;
        margin-right: 1rem;
    }

    .chat-main {
        padding: 0;
    }
    .chat-header {
        padding: 0.5rem 1rem;
        flex-wrap: wrap;
    }
    .messages-container {
        padding: 1rem;
    }
    .message {
        max-width: 95%;
    }
    .input-area {
        padding: 0.8rem 1rem;
    }

    .hero h1 {
        font-size: 2.8rem;
    }
    .cta-box {
        padding: 1.8rem;
        margin: 1rem;
    }
    .stats {
        gap: 1rem;
    }
    nav ul {
        gap: 1rem;
    }
}

@media (max-width: 480px) {
    .hero h1 {
        font-size: 2.2rem;
    }
    .feature-grid {
        grid-template-columns: 1fr;
    }
    .auth-container {
        padding: 1.5rem;
        margin: 1rem;
    }
}

/* Overlay for mobile sidebar */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.3);
    z-index: 999;
}
.sidebar-overlay.active {
    display: block;
}