:root {
    --color-bg: #f8fafb;
    --color-surface: #ffffff;
    --color-primary: #3b82f6;
    --color-primary-hover: #2563eb;
    --color-text: #1e293b;
    --color-text-muted: #64748b;
    --color-border: #e2e8f0;
    --color-button-disabled: #cbd5e1;
    --color-button-text: #ffffff;
    
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-card: 0 12px 24px -10px rgba(0, 0, 0, 0.08);
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--color-bg);
    color: var(--color-text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--color-primary-hover);
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.text-primary {
    color: var(--color-primary);
}

/* =========================================
   LOGIN PAGE SPECIFIC STYLES
   ========================================= */

.page-login main {
    position: relative;
    overflow: hidden;
    justify-content: center;
    align-items: center;
}

.login-wrapper {
    position: relative;
    width: 100%;
    max-width: 1200px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    z-index: 10;
}

/* DECORATIVE ELEMENTS */
.deco {
    position: absolute;
    z-index: -1;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(8px);
}

.deco-top-left {
    top: 5%;
    left: 10%;
    width: 200px;
    height: 160px;
    transform: rotate(-6deg);
    padding: 1.5rem;
    display: flex;
    align-items: flex-end;
    gap: 12px;
}

.deco-chart-bars {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    width: 100%;
    height: 100%;
}

.deco-chart-bars .bar {
    flex: 1;
    background-color: #e2e8f0;
    border-radius: 4px 4px 0 0;
}
.bar-1 { height: 40%; }
.bar-2 { height: 80%; }
.bar-3 { height: 30%; }

.deco-bottom-right {
    bottom: 10%;
    right: 15%;
    width: 240px;
    height: 180px;
    transform: rotate(8deg);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.deco-chart-pie .pie-line {
    height: 8px;
    background-color: #f1f5f9;
    border-radius: 4px;
    margin-bottom: 12px;
}
.pie-line:nth-child(1) { width: 60%; }
.pie-line:nth-child(2) { width: 90%; }
.pie-circle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 4px solid #e2e8f0;
    border-top-color: var(--color-primary);
    margin: 16px auto 0;
}


/* LOGIN CONTAINER */
.login-container {
    width: 100%;
    max-width: 440px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.logo-icon {
    width: 56px;
    height: 56px;
    background-color: var(--color-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    margin: 0 auto 1.5rem;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.login-header h1 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.login-header p {
    color: var(--color-text-muted);
    font-size: 0.95rem;
    line-height: 1.5;
    padding: 0 1rem;
}

/* LOGIN CARD */
.login-card {
    background: var(--color-surface);
    width: 100%;
    border-radius: var(--radius-xl);
    padding: 2.5rem;
    box-shadow: var(--shadow-card);
    border: 1px solid rgba(0,0,0,0.03);
    margin-bottom: 2rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--color-text);
    margin-bottom: 0.5rem;
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon {
    position: absolute;
    left: 1rem;
    color: var(--color-text-muted);
    font-size: 1.25rem;
    pointer-events: none;
}

.input-wrapper input {
    width: 100%;
    padding: 0.875rem 1rem;
    font-family: inherit;
    font-size: 1rem;
    color: var(--color-text);
    background-color: #fff;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
}

.input-wrapper input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.input-wrapper input[type="email"] {
    padding-left: 3rem;
}

.password-toggle {
    position: absolute;
    right: 1rem;
    background: none;
    border: none;
    color: var(--color-text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.password-toggle:hover {
    color: var(--color-text);
}

.form-options {
    display: flex;
    justify-content: center;
    margin-bottom: 1.5rem;
    margin-top: 1.5rem;
}

.forgot-link {
    font-size: 0.9rem;
    font-weight: 500;
}

/* BUTTONS */
.btn-primary {
    background-color: var(--color-button-disabled);
    color: white;
    border: none;
    border-radius: 9999px;
    padding: 0.875rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    cursor: not-allowed;
    transition: all 0.2s ease;
    width: 100%;
    display: inline-block;
    text-align: center;
}

.btn-primary.active {
    background-color: var(--color-primary);
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}

.btn-primary.active:hover {
    background-color: var(--color-primary-hover);
    transform: translateY(-1px);
}

/* SECURE NOTICE */
.secure-notice {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-top: 1.5rem;
    font-size: 0.8rem;
    color: var(--color-text-muted);
    line-height: 1.4;
}

.secure-notice i {
    color: var(--color-primary);
    font-size: 1.1rem;
    margin-top: 2px;
}

/* LOGIN FOOTER TEXT */
.login-footer-text {
    font-size: 0.9rem;
    color: var(--color-text-muted);
}


/* =========================================
   APP FOOTER
   ========================================= */
.app-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--color-border);
    font-size: 0.85rem;
    color: var(--color-text-muted);
    background: var(--color-bg);
}

.footer-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--color-text);
    font-size: 1rem;
}

.footer-right {
    display: flex;
    gap: 1.5rem;
}

.footer-right a {
    color: var(--color-text-muted);
}
.footer-right a:hover {
    color: var(--color-text);
}

/* RESPONSIVE */
@media (max-width: 768px) {
    .deco { display: none; }
    .app-footer {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    .footer-left {
        flex-direction: column;
        gap: 0.5rem;
    }
}

/* =========================================
   APP LAYOUT (HOME PAGE)
   ========================================= */
.page-home {
    background-color: var(--color-surface);
}

.page-home main {
    padding: 0;
}

.app-layout {
    display: flex;
    height: 100vh;
    width: 100%;
    overflow: hidden;
}

/* SIDEBAR */
.sidebar {
    width: 260px;
    background-color: var(--color-bg);
    border-right: 1px solid var(--color-border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 1.5rem;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: 1.25rem;
    color: var(--color-primary);
}

.sidebar-menu {
    flex: 1;
    overflow-y: auto;
    padding: 0 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    color: var(--color-text);
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.2s;
    position: relative;
}

.menu-item i {
    font-size: 1.1rem;
    color: var(--color-text-muted);
}

.menu-item:hover {
    background-color: #f1f5f9;
}

.menu-item.active {
    background-color: #e0f2fe;
    color: var(--color-primary);
}

.menu-item.active i {
    color: var(--color-primary);
}

.menu-item.active::before {
    content: '';
    position: absolute;
    left: -1rem;
    top: 50%;
    transform: translateY(-50%);
    height: 1.5rem;
    width: 4px;
    background-color: var(--color-primary);
    border-radius: 0 4px 4px 0;
}

.sidebar-section {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
}

.section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.75rem;
}

.history-item {
    display: block;
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    color: var(--color-text-muted);
    border-radius: var(--radius-md);
}

.history-item:hover {
    background-color: #f1f5f9;
    color: var(--color-text);
}

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

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid var(--color-border);
}

/* MAIN CONTENT */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    background-color: var(--color-surface);
}

.top-header {
    height: 64px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
    border-bottom: 1px solid var(--color-border);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    position: relative;
    padding: 0.5rem;
    border-radius: var(--radius-md);
}

.user-profile:hover {
    background-color: var(--color-bg);
}

.avatar {
    width: 32px;
    height: 32px;
    background-color: var(--color-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-name {
    font-weight: 500;
    font-size: 0.9rem;
}

/* DROPDOWN */
.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: white;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    min-width: 160px;
    padding: 0.5rem;
    z-index: 100;
    display: none;
    flex-direction: column;
}

.dropdown-trigger.active .dropdown-menu {
    display: flex;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    color: var(--color-text);
    font-size: 0.9rem;
}

.dropdown-item:hover {
    background-color: var(--color-bg);
}

.text-danger {
    color: #ef4444;
}

/* CHAT CONTAINER */
.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.chat-welcome {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

.welcome-icon {
    width: 64px;
    height: 64px;
    background-color: var(--color-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin-bottom: 1.5rem;
}

.chat-welcome h2 {
    font-size: 2rem;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 1rem;
}

.chat-welcome p {
    color: var(--color-text-muted);
    line-height: 1.6;
}

/* CHAT INPUT AREA & MESSAGES LIST */
.messages-list {
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
}

/* CHAT BUBBLE TYPOGRAPHY & LISTS */
.message-bubble {
    font-size: 0.85rem;
    line-height: 1.5;
}

.message-text ul,
.message-text ol {
    padding-left: 1.5rem;
    margin-bottom: 0.75rem;
    margin-top: 0.5rem;
}

.message-text ul li,
.message-text ol li {
    margin-bottom: 0.25rem;
}

.message-text p {
    margin-bottom: 0.75rem;
}

.message-text p:last-child {
    margin-bottom: 0;
}

.chat-input-wrapper {
    padding: 1.5rem 2rem;
    max-width: 800px;
    width: 100%;
    margin: 0 auto;
}

/* BASIC GRID FOR CHAT COMPONENTS */
.row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -15px;
    margin-left: -15px;
}
.col-12, .col-md-6 {
    position: relative;
    width: 100%;
    padding-right: 15px;
    padding-left: 15px;
}
@media (min-width: 768px) {
    .col-md-6 {
        flex: 0 0 50%;
        max-width: 50%;
    }
    .offset-md-3 {
        margin-left: 25%;
    }
}

.chat-input-box {
    display: flex;
    align-items: center;
    background: white;
    border: 1px solid var(--color-border);
    border-radius: 9999px;
    padding: 0.5rem 0.5rem 0.5rem 1rem;
    box-shadow: var(--shadow-sm);
    gap: 0.5rem;
    position: relative;
}

.chat-input-box:focus-within {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.chat-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 0.75rem 0;
    font-size: 1rem;
    outline: none;
    font-family: inherit;
}

.btn-icon {
    background: none;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    transition: all 0.2s;
}

.action-btn i {
    font-size: 1.25rem;
    color: var(--color-text-muted);
}
.action-btn i.text-primary {
    color: var(--color-primary);
}

.action-btn:hover {
    background-color: var(--color-bg);
}

.send-btn {
    background-color: var(--color-text);
    color: white;
}

.send-btn:hover {
    background-color: #000;
}

.add-menu {
    top: auto;
    bottom: 100%;
    left: 0;
    margin-bottom: 0.5rem;
}

.chat-suggestions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    margin-top: 1rem;
    flex-wrap: wrap;
}

.suggestion-chip {
    background: white;
    border: 1px solid var(--color-border);
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    font-size: 0.85rem;
    color: var(--color-text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.suggestion-chip:hover {
    background: var(--color-bg);
    color: var(--color-text);
}

/* =========================================
   HISTORY PAGE SPECIFIC STYLES
   ========================================= */
.history-page-wrapper {
    flex: 1;
    overflow-y: auto;
    width: 100%;
}

.history-page-content {
    padding: 3rem 2rem;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

.page-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.page-title-row h1 {
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--color-text);
}

.page-title-row h1 i {
    color: var(--color-primary);
}

.page-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-outline {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: white;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-outline:hover {
    background: var(--color-bg);
}

.btn-icon-outline {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: white;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-icon-outline:hover {
    background: var(--color-bg);
}

.search-input-wrapper {
    position: relative;
    margin-bottom: 2rem;
}

.search-input-wrapper i {
    position: absolute;
    left: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--color-text-muted);
    font-size: 1.2rem;
}

.search-input-wrapper input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    border: 1px solid var(--color-border);
    border-radius: 9999px;
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.search-input-wrapper input:focus {
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.history-list {
    display: flex;
    flex-direction: column;
}

.history-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 0;
    border-bottom: 1px solid var(--color-border);
    text-decoration: none;
    color: inherit;
}

.history-list-item:hover .history-title {
    color: var(--color-primary);
}

.history-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.history-title {
    font-weight: 500;
    color: var(--color-text);
    transition: color 0.2s;
}

.history-date {
    font-size: 0.85rem;
    color: var(--color-text-muted);
}

.history-action i {
    color: var(--color-text-muted);
    font-size: 1.2rem;
}
