* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    /* 📱 MOBILE TEXT OVERFLOW FIX */
    max-width: 100%;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Touch-friendly scrolling */
body {
    -webkit-overflow-scrolling: touch;
    touch-action: manipulation; /* Disable double-tap zoom */
}

:root {
    --primary: #667eea;
    --primary-dark: #5568d3;
    --secondary: #764ba2;
    --accent: #f093fb;
    --bg: #f8f9fa;
    --surface: #ffffff;
    --text: #2d3748;
    --text-light: #718096;
    --border: #e2e8f0;
    --success: #48bb78;
    --error: #f56565;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    /* 📱 MOBILE TEXT OVERFLOW FIX */
    overflow-x: hidden;
    max-width: 100vw;
    word-wrap: break-word;
}

/* Screens */
.screen {
    display: none !important;
}

.screen.active {
    display: flex !important;
}

/* Main Screen Layout */
#mainScreen {
    min-height: 100vh;
    width: 100%;
}

/* Login Screen */
#loginScreen {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
}

.login-container {
    background: var(--surface);
    border-radius: 20px;
    padding: 40px;
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 400px;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-header h1 {
    font-size: 32px;
    margin-bottom: 8px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-header p {
    color: var(--text-light);
    font-size: 14px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 15px;
    transition: all 0.3s;
}

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

.error-message {
    color: var(--error);
    font-size: 14px;
    margin-top: 10px;
    display: none;
}

.error-message.show {
    display: block;
}

/* Main App */
.app-container {
    display: flex;
    flex-direction: column; /* DESKTOP: sidebar top, content below */
    min-height: 100vh;
    /* 📱 MOBILE TEXT OVERFLOW FIX */
    max-width: 100vw;
    overflow-x: hidden;
}

/* Sidebar - HORIZONTAL DESKTOP */
.sidebar {
    width: 100%;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 12px 30px;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 100;
}

.sidebar-header {
    display: none; /* Hidden - info only in mobile header */
}

.sidebar-nav {
    display: flex;
    flex-direction: row;
    gap: 8px;
    padding: 0;
    flex-wrap: nowrap;
    flex: 1;
}

.nav-item {
    padding: 10px 20px;
    border: none;
    background: none;
    font-size: 15px;
    color: var(--text);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    white-space: nowrap;
}

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

.nav-item.active {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
}

.sidebar-footer {
    display: none; /* Hidden - logout only in mobile header */
}

/* Desktop Logout Button */
.desktop-logout-btn {
    padding: 10px 24px;
    border: none;
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 15px;
    white-space: nowrap;
}

.desktop-logout-btn:hover {
    background: var(--bg);
    border-color: var(--primary);
    color: var(--primary);
}

/* Main Content - PERFECTLY CENTERED */
.main-content {
    flex: 1;
    padding: 40px 20px;
    overflow-y: auto;
    overflow-x: hidden;
    width: 100%;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center; /* CENTER CONTENT */
}

.content-section {
    display: none;
    width: 100%;
    max-width: 900px; /* Limit width for readability */
    margin: 0 auto; /* CENTER */
}

.content-section.active {
    display: block;
    animation: fadeIn 0.3s;
}

/* Hidden sections that should NEVER be shown in nav */
.hidden-section {
    display: none !important;
}

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

.section-header {
    margin-bottom: 30px;
    text-align: center; /* CENTER TEXT */
}

.section-header h1 {
    font-size: 32px;
    margin-bottom: 8px;
}

.section-header p {
    color: var(--text-light);
    font-size: 16px;
}

/* Forms */
.blueprint-form {
    background: var(--surface);
    padding: 30px;
    border-radius: 16px;
    box-shadow: var(--shadow);
    margin: 0 auto 30px auto; /* CENTER with auto margins */
    max-width: 900px; /* Reasonable form width */
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text);
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    max-width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    transition: all 0.3s;
    box-sizing: border-box; /* 📱 CRITICAL: Prevent overflow */
}

/* 📱 Date/Time inputs - prevent overflow on mobile */
.form-group input[type="date"],
.form-group input[type="time"] {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 12px 16px;
    min-height: 48px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 15px;
    -webkit-appearance: none;
    appearance: none;
    background-color: var(--surface);
}

.form-group textarea {
    min-height: 120px; /* SAME AS CHAT */
    resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-ghost {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}

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

.btn-large {
    padding: 16px 32px;
    font-size: 16px;
    width: 100%;
}

.btn-small {
    padding: 8px 16px;
    font-size: 13px;
}

/* Tarot Section */
.tarot-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
}

.tab-btn {
    padding: 12px 24px;
    border: none;
    background: var(--surface);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
}

.tab-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.tarot-upload-area {
    background: var(--surface);
    padding: 30px;
    border-radius: 16px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.upload-zone {
    border: 3px dashed var(--border);
    border-radius: 12px;
    padding: 60px 20px;
    text-align: center;
    transition: all 0.3s;
    cursor: pointer;
}

.upload-zone:hover {
    border-color: var(--primary);
    background: var(--bg);
}

.upload-zone.dragover {
    border-color: var(--primary);
    background: var(--bg);
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.upload-zone h3 {
    margin-bottom: 8px;
    color: var(--text);
}

.upload-zone p {
    color: var(--text-light);
    margin-bottom: 20px;
}

.image-preview {
    text-align: center;
    padding: 20px;
}

.image-preview img {
    max-width: 100%;
    max-height: 400px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}

/* Results */
.result-container {
    background: var(--surface);
    border-radius: 16px;
    box-shadow: var(--shadow);
    padding: 30px;
    margin: 30px auto; /* CENTER with auto margins */
    max-width: 1200px; /* Not TOO wide */
    overflow-x: hidden;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border);
}

.result-header h2 {
    font-size: 24px;
}

.blueprint-content,
.tarot-content {
    line-height: 1.8;
    color: var(--text);
    /* 📱 MOBILE TEXT OVERFLOW FIX */
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    max-width: 100%;
    overflow-x: hidden;
}

.blueprint-content h2,
.blueprint-content h3,
.tarot-content h2,
.tarot-content h3 {
    margin-top: 24px;
    margin-bottom: 12px;
    color: var(--primary);
}

.blueprint-content p,
.tarot-content p {
    margin-bottom: 16px;
}

.blueprint-content strong,
.tarot-content strong {
    color: var(--secondary);
}

/* Loading */
.loading-container {
    text-align: center;
    padding: 60px 20px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.loading-container p {
    font-size: 18px;
    color: var(--text);
    margin-bottom: 8px;
}

.loading-subtext {
    font-size: 14px;
    color: var(--text-light);
}

/* Chat - MODERN DESKTOP DESIGN */
.chat-container {
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 180px);
    min-height: 600px;
    max-width: 900px;
    margin: 0 auto;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 40px 20px;
    margin-bottom: 0;
    -webkit-overflow-scrolling: touch;
    overflow-anchor: auto;
    background: transparent;
}

.message {
    margin-bottom: 32px;
    animation: fadeIn 0.4s ease-in-out;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.message-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-light);
    padding: 0 4px;
    letter-spacing: 0.3px;
}

.message-content {
    width: 100%;
    padding: 20px 24px;
    border-radius: 16px;
    line-height: 1.7;
    font-size: 15.5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    transition: all 0.2s ease;
}

.message-content:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.bot-message .message-content {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.08), rgba(118, 75, 162, 0.08));
    border: 1px solid rgba(102, 126, 234, 0.15);
    color: var(--text);
}

.user-message {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.user-message .message-content {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
}

.chat-input-container {
    display: flex;
    gap: 12px;
    padding: 24px 20px;
    padding-bottom: 32px;
    background: var(--surface);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.03);
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
}

.chat-input-container textarea {
    flex: 1;
    padding: 16px 20px;
    border: 2px solid var(--border);
    border-radius: 16px;
    resize: none;
    font-family: inherit;
    font-size: 15.5px;
    line-height: 1.6;
    min-height: 120px;
    max-height: 250px;
    transition: all 0.3s ease;
    appearance: none;
    -webkit-appearance: none;
    background: var(--bg);
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.04);
}

.chat-input-container textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--surface);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1), inset 0 1px 3px rgba(0,0,0,0.02);
    transform: translateY(-1px);
}

.chat-input-container button {
    align-self: flex-end;
    flex-shrink: 0;
    padding: 14px 28px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 12px;
    min-height: 52px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    transition: all 0.2s ease;
}

.chat-input-container button:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.chat-input-container button:active:not(:disabled) {
    transform: translateY(0);
}

/* History */
.history-list {
    display: grid;
    gap: 20px;
}

.history-item {
    background: var(--surface);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all 0.3s;
}

.history-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.empty-state {
    text-align: center;
    color: var(--text-light);
    padding: 60px 20px;
}

/* MEGA Analysis Styles */
.mega-notice {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    border-left: 4px solid var(--primary);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 30px;
}

.mega-notice h3 {
    margin-bottom: 12px;
    color: var(--primary);
}

.mega-notice ul {
    margin: 12px 0 12px 20px;
}

.mega-notice li {
    margin-bottom: 8px;
}

.mega-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    background-size: 200% 100%;
    animation: gradientShift 3s ease infinite;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.mega-content {
    line-height: 1.8;
    color: var(--text);
    /* 📱 MOBILE TEXT OVERFLOW FIX */
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    max-width: 100%;
    overflow-x: hidden;
}

.mega-content h2 {
    color: var(--primary);
    margin-top: 32px;
    margin-bottom: 16px;
    font-size: 24px;
}

.mega-content h3 {
    color: var(--secondary);
    margin-top: 24px;
    margin-bottom: 12px;
    font-size: 20px;
}

.mega-content p {
    margin-bottom: 16px;
}

.mega-content strong {
    color: var(--primary);
}

.upload-zone-small {
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 30px 20px;
    text-align: center;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    margin: 0 auto;
}

.upload-zone-small:hover {
    border-color: var(--primary);
    background: var(--bg);
}

.upload-icon-small {
    font-size: 32px;
    margin-bottom: 12px;
}

.image-preview-small {
    text-align: center;
    padding: 15px;
}

.image-preview-small img {
    max-width: 100%;
    max-height: 200px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 12px;
}

/* Single Tarot Card Upload */
.tarot-card-single {
    display: block;
    margin: 15px auto 0 auto;
    max-width: 400px;
    text-align: center;
}

/* New Analysis Button */
.new-analysis-section {
    text-align: center;
    padding: 40px 20px;
    margin-top: 40px;
}

.new-analysis-section .btn-large {
    font-size: 1.2em;
    padding: 20px 40px;
}

.tarot-cards-upload .upload-zone-small {
    padding: 20px 15px;
    min-height: 150px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.tarot-cards-upload .upload-icon-small {
    font-size: 40px;
    margin-bottom: 8px;
}

.tarot-cards-upload .image-preview-small {
    position: relative;
    padding: 10px;
}

.tarot-cards-upload .image-preview-small img {
    max-height: 180px;
    width: 100%;
    object-fit: contain;
}

.tarot-cards-upload .image-preview-small button {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 30px;
    height: 30px;
    padding: 0;
    border-radius: 50%;
    font-size: 18px;
    line-height: 1;
    background: var(--error);
    color: white;
    border: none;
}

/* Numerology Number Highlighting */
.numerology-number {
    color: var(--accent);
    font-weight: 700;
    padding: 2px 8px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15), rgba(118, 75, 162, 0.15));
    border-radius: 6px;
    display: inline-block;
    margin: 0 2px;
    transition: all 0.3s;
}

.numerology-number:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.25), rgba(118, 75, 162, 0.25));
    transform: scale(1.05);
}

/* Session Control Bar */
.session-control {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: 15px 30px;
    margin-bottom: 30px;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
}

.session-info {
    display: flex;
    gap: 20px;
    align-items: center;
}

.session-active-indicator {
    font-weight: 700;
    padding: 5px 15px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 20px;
}

/* Session Sections */
.session-section {
    margin-top: 40px;
    padding: 30px;
    background: var(--surface);
    border-radius: 16px;
    box-shadow: var(--shadow);
    border: 2px solid var(--accent);
}

.card-count-info {
    background: var(--bg);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.card-count-info p {
    margin: 8px 0;
    font-size: 16px;
}

/* Chat History */
.chat-history {
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 20px;
    padding: 20px;
    background: var(--bg);
    border-radius: 12px;
}

.chat-message {
    margin-bottom: 20px;
    padding: 15px;
    border-radius: 12px;
}

.chat-message.user {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    margin-left: 40px;
}

.chat-message.violeta {
    background: linear-gradient(135deg, rgba(118, 75, 162, 0.15), rgba(240, 147, 251, 0.15));
    margin-right: 40px;
}

.chat-message-header {
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--primary);
}

.chat-input-area {
    display: flex;
    gap: 15px;
    align-items: flex-end;
    padding: 20px;
    background: var(--bg);
    border-top: 1px solid var(--border);
}

.chat-input-area textarea {
    flex: 1;
    min-height: 120px;
    padding: 16px;
    font-size: 16px;
    line-height: 1.6;
    resize: vertical;
    border-radius: 12px;
    border: 2px solid var(--border);
    transition: border-color 0.3s;
}

.chat-input-area textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.chat-input-area button {
    white-space: nowrap;
    min-height: 56px;
    padding: 16px 32px;
    font-size: 17px;
}

.form-note {
    font-size: 13px;
    color: var(--text-light);
    margin-top: 8px;
    text-align: center;
}

.highlight {
    color: var(--secondary);
    font-weight: 500;
    font-size: 15px;
}

/* Face Reading Styles */
.face-reading-info {
    background: var(--surface);
    padding: 24px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.face-reading-info h3 {
    color: var(--primary);
    margin-bottom: 12px;
}

.face-reading-info ul {
    margin: 12px 0 12px 20px;
}

.face-reading-info li {
    margin-bottom: 8px;
}

.face-content {
    line-height: 1.8;
    color: var(--text);
}

.face-content h2,
.face-content h3 {
    color: var(--primary);
    margin-top: 24px;
    margin-bottom: 12px;
}

.face-content p {
    margin-bottom: 16px;
}

/* ============================================
   MOBILE HAMBURGER MENU
   ============================================ */

/* Mobile Header - hidden on desktop, shown on mobile */
.mobile-header {
    display: none; /* Hidden by default on desktop */
}

/* Mobile styles defined only in @media queries below */

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

/* Responsive - ONLY Mobile (NOT Desktop!) */
@media (max-width: 768px) {
    /* Mobile Header */
    .mobile-header {
        display: flex !important;
        position: sticky;
        top: 0;
        left: 0;
        right: 0;
        background: var(--surface);
        border-bottom: 1px solid var(--border);
        padding: 12px 16px;
        align-items: center;
        justify-content: space-between;
        z-index: 1000;
        box-shadow: var(--shadow);
    }
    
    .mobile-logo {
        font-size: 18px;
        font-weight: 600;
        margin: 0;
        flex: 1;
        text-align: center;
    }
    
    /* Hamburger Button */
    .hamburger-btn {
        width: 44px;
        height: 44px;
        background: none;
        border: none;
        cursor: pointer;
        padding: 10px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 5px;
        border-radius: 8px;
        transition: all 0.3s ease;
    }
    
    .hamburger-btn:active {
        background: var(--bg);
    }
    
    .hamburger-btn span {
        display: block;
        width: 24px;
        height: 3px;
        background: var(--text);
        border-radius: 2px;
        transition: all 0.3s ease;
    }
    
    .hamburger-btn.active span:nth-child(1) {
        transform: rotate(45deg) translate(7px, 7px);
    }
    
    .hamburger-btn.active span:nth-child(2) {
        opacity: 0;
    }
    
    .hamburger-btn.active span:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -7px);
    }
    
    /* Mobile Logout Button */
    .mobile-logout-btn {
        background: none;
        border: none;
        color: var(--primary);
        font-size: 14px;
        font-weight: 600;
        cursor: pointer;
        padding: 8px 12px;
        border-radius: 8px;
        transition: all 0.3s ease;
    }
    
    .mobile-logout-btn:active {
        background: var(--bg);
    }
    
    /* Sidebar Overlay */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 998;
        opacity: 0;
        transition: opacity 0.3s ease;
    }
    
    .sidebar-overlay.active {
        display: block;
        opacity: 1;
    }

    .app-container {
        flex-direction: column;
        min-height: 100dvh;
    }

    /* Sidebar becomes slide-in menu */
    .sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 280px;
        height: 100vh;
        background: var(--surface);
        border-right: 1px solid var(--border);
        z-index: 999;
        transition: left 0.3s ease;
        overflow-y: auto;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }

    .sidebar.active {
        left: 0;
    }

    .sidebar-nav {
        display: flex;
        flex-direction: column;
        padding: 20px 10px;
        gap: 8px;
        flex: 1;
    }

    .nav-item {
        width: 100%;
        padding: 14px 20px;
        font-size: 16px;
        text-align: left;
        border-radius: 10px;
    }
    
    .desktop-logout-btn {
        display: none; /* Hidden on mobile - logout in header */
    }

    /* Main content with top padding for mobile header */
    .main-content {
        padding: 16px;
        padding-top: 70px; /* 📱 Reduced from 80px - closer to menu */
        max-width: 100%;
        overflow-x: hidden;
    }

    .content-section {
        padding: 0 16px 20px 16px; /* 📱 NO top padding - flush with menu */
    }
    
    .section-header {
        margin-top: 0;
        padding-top: 0;
        margin-bottom: 20px; /* 📱 Reduced spacing */
    }
    
    .section-header h1 {
        margin-top: 0;
        padding-top: 0;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .login-container {
        max-width: 90%;
        padding: 40px 32px;
    }

    /* Additional mobile styles */
    body {
        font-size: 16px;
    }

    .section-header {
        margin-bottom: 24px;
        text-align: center;
    }

    .section-header h2 {
        font-size: 26px;
        line-height: 1.3;
        margin-bottom: 12px;
    }

    .section-header p {
        font-size: 16px;
        line-height: 1.5;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .form-group label {
        font-size: 15px;
    }

    .form-group input,
    .form-group select {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 14px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    /* 📱 Date/Time inputs mobile fix */
    .form-group input[type="date"],
    .form-group input[type="time"] {
        font-size: 16px;
        padding: 12px 8px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        -webkit-appearance: none;
        appearance: none;
    }
    
    .form-group textarea {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 14px;
        min-height: 120px; /* SAME AS CHAT */
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    /* Larger touch targets */
    .btn {
        padding: 16px 32px;
        font-size: 17px;
        min-height: 52px;
        width: 100%;
        border-radius: 12px;
        font-weight: 600;
    }

    .btn-large {
        padding: 20px 32px;
        font-size: 19px;
        min-height: 60px;
        width: 100%;
        border-radius: 12px;
        font-weight: 600;
    }

    .btn-ghost {
        padding: 12px 20px;
        min-height: 44px;
        width: auto;
    }

    /* Upload zones - Mobile */
    .upload-zone {
        padding: 30px 20px;
        min-height: 180px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
    }

    .upload-zone h3 {
        font-size: 16px;
        margin-bottom: 8px;
    }

    .upload-zone p {
        font-size: 14px;
        margin-bottom: 16px;
    }

    .upload-icon {
        font-size: 40px;
        margin-bottom: 12px;
    }

    .upload-text {
        font-size: 16px;
    }

    .upload-hint {
        font-size: 13px;
    }
    
    /* Upload zone button - ensure visible on mobile */
    .upload-zone .btn {
        width: auto;
        min-width: 180px;
        padding: 14px 24px;
        font-size: 15px;
    }

    /* Image previews */
    .image-preview img {
        max-width: 100%;
        max-height: 250px;
    }

    /* Results */
    .result-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .result-header h2 {
        font-size: 22px;
    }

    .mega-content {
        font-size: 16px;
        line-height: 1.7;
    }

    .mega-content h2 {
        font-size: 20px;
    }

    .mega-content h3 {
        font-size: 18px;
    }

    /* Session controls */
    .session-control-bar {
        flex-direction: column;
        gap: 15px;
        padding: 20px 15px;
    }

    .session-info {
        text-align: center;
    }

    .session-buttons {
        flex-direction: column;
        gap: 10px;
        width: 100%;
    }

    .session-buttons .btn {
        width: 100%;
    }

    /* Chat - Modern Mobile */
    #chat-section .section-header {
        display: none;
    }
    
    .chat-container {
        height: calc(100vh - 60px);
        min-height: 500px;
        max-width: 100%;
    }
    
    .chat-messages {
        padding: 20px 16px;
        padding-bottom: 20px;
    }
    
    .message {
        margin-bottom: 24px;
    }
    
    .message-label {
        font-size: 12px;
        padding: 0 8px;
    }
    
    .message-content {
        padding: 16px 18px;
        font-size: 15px;
        border-radius: 14px;
    }
    
    .chat-input-container {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        padding: 12px 16px;
        padding-bottom: max(12px, env(safe-area-inset-bottom));
        background: var(--surface);
        border-top: 1px solid var(--border);
        display: flex;
        flex-direction: column;
        gap: 12px;
        z-index: 1000;
        box-shadow: 0 -2px 12px rgba(0,0,0,0.08);
        max-width: 100%;
    }
    
    .chat-input-container textarea {
        width: 100%;
        font-size: 16px !important;
        min-height: 120px;
        max-height: 180px;
        padding: 14px 16px;
        border-radius: 16px;
        border: 2px solid var(--border);
        background: var(--bg);
        line-height: 1.5;
    }
    
    .chat-input-container textarea:focus {
        border-color: var(--primary);
        background: var(--surface);
        box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    }
    
    .chat-input-container button {
        width: 100%;
        min-height: 52px;
        padding: 14px 24px;
        border-radius: 14px;
        background: linear-gradient(135deg, var(--primary), var(--secondary));
        font-size: 16px;
        font-weight: 600;
        align-self: stretch;
    }

    /* Download section */
    .download-all-section {
        padding: 25px 15px;
    }

    .download-all-section .btn-primary {
        width: 100%;
        min-width: auto;
    }

    /* New analysis button */
    .new-analysis-section {
        padding: 20px 15px;
    }

    .new-analysis-section .btn {
        width: 100%;
    }
} /* End of @media (max-width: 768px) */

/* iPhone 17 Pro & Modern Phones (390px - 430px) */
@media (max-width: 430px) {
    body {
        font-size: 17px;
        -webkit-text-size-adjust: 100%;
    }

    .app-container {
        min-height: 100vh;
        min-height: 100dvh; /* Dynamic viewport for mobile */
    }

    /* Sticky header with safe area */
    .sidebar {
        padding: 12px 16px;
        padding-top: max(12px, env(safe-area-inset-top));
        box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    }

    .sidebar-nav {
        gap: 10px;
        padding: 10px 0;
    }

    .nav-item {
        min-width: 130px;
        padding: 14px 20px;
        font-size: 16px;
        font-weight: 500;
    }

    /* Main content with safe areas */
    .main-content {
        padding: 20px 20px;
        padding-bottom: max(20px, env(safe-area-inset-bottom));
    }

    .content-section {
        padding: 28px 20px;
    }

    /* Headers optimized */
    .section-header {
        margin-bottom: 28px;
    }

    .section-header h2 {
        font-size: 28px;
        line-height: 1.2;
        font-weight: 700;
    }

    .section-header p {
        font-size: 17px;
        line-height: 1.5;
        margin-top: 10px;
    }

    /* Forms full width */
    .form-group {
        margin-bottom: 24px;
    }

    .form-group label {
        font-size: 16px;
        font-weight: 600;
        margin-bottom: 10px;
        display: block;
    }

    .form-group input,
    .form-group select {
        font-size: 17px;
        padding: 16px;
        border-radius: 12px;
        width: 100%;
        border: 2px solid var(--border);
    }
    
    .form-group textarea {
        font-size: 17px;
        padding: 16px;
        border-radius: 12px;
        width: 100%;
        border: 2px solid var(--border);
        min-height: 130px; /* SAME AS CHAT */
    }

    /* Touch-optimized buttons */
    .btn {
        padding: 18px 24px;
        font-size: 18px;
        min-height: 56px;
        width: 100%;
        border-radius: 14px;
        font-weight: 600;
        letter-spacing: 0.3px;
    }

    .btn-large {
        padding: 20px 24px;
        font-size: 19px;
        min-height: 60px;
        border-radius: 14px;
    }

    .btn-ghost {
        padding: 14px 20px;
        min-height: 48px;
        width: auto;
        font-size: 16px;
    }

    /* Upload zones */
    .upload-zone {
        min-height: 200px;
        padding: 32px 20px;
        border-radius: 16px;
        border-width: 3px;
    }

    .upload-icon {
        font-size: 56px;
        margin-bottom: 16px;
    }

    .upload-text {
        font-size: 17px;
        font-weight: 600;
        margin-bottom: 8px;
    }

    .upload-hint {
        font-size: 14px;
        opacity: 0.7;
    }

    /* Image previews */
    .image-preview {
        margin: 20px 0;
        border-radius: 16px;
        overflow: hidden;
    }

    .image-preview img {
        max-width: 100%;
        height: auto;
        max-height: 300px;
        object-fit: contain;
    }

    /* Results sections */
    .result-container {
        margin: 24px 0;
        border-radius: 16px;
        padding: 24px 20px;
    }

    .result-header {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
        margin-bottom: 24px;
    }

    .result-header h2 {
        font-size: 24px;
        line-height: 1.3;
    }

    .mega-content {
        font-size: 17px;
        line-height: 1.7;
    }

    .mega-content h2 {
        font-size: 22px;
        margin-top: 32px;
        margin-bottom: 16px;
    }

    .mega-content h3 {
        font-size: 19px;
        margin-top: 24px;
        margin-bottom: 12px;
    }

    .mega-content p {
        margin-bottom: 18px;
    }

    /* Chat optimized for iPhone - ChatGPT Style */
    #chat-section .section-header {
        display: none; /* Hide title on iPhone */
    }
    
    .chat-container {
        height: calc(100dvh - 60px);
        min-height: 500px;
        top: 60px;
    }
    
    .chat-messages {
        padding: 20px 18px;
        padding-bottom: 20px;
    }
    
    .message {
        margin-bottom: 28px;
    }
    
    .message-label {
        font-size: 12px;
        padding: 0 8px;
        font-weight: 600;
    }
    
    .message-content {
        padding: 18px 20px;
        font-size: 16px;
        line-height: 1.65;
        border-radius: 16px;
    }
    
    .chat-input-container {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        padding: 14px 18px;
        padding-bottom: max(18px, env(safe-area-inset-bottom));
        background: var(--surface);
        border-top: 1px solid var(--border);
        display: flex;
        flex-direction: column;
        gap: 12px;
        box-shadow: 0 -3px 15px rgba(0,0,0,0.08);
        z-index: 1000;
    }

    .chat-input-container textarea {
        width: 100%;
        font-size: 17px !important;
        padding: 16px 18px;
        border-radius: 18px;
        min-height: 130px;
        max-height: 180px;
        resize: none;
        border: 2px solid var(--border);
        background: var(--bg);
        line-height: 1.6;
        box-shadow: inset 0 1px 3px rgba(0,0,0,0.04);
    }
    
    .chat-input-container textarea:focus {
        border-color: var(--primary);
        background: var(--surface);
        box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1), inset 0 1px 3px rgba(0,0,0,0.02);
    }

    .chat-input-container button {
        width: 100%;
        min-height: 54px;
        padding: 16px 24px;
        border-radius: 16px;
        font-size: 17px;
        font-weight: 600;
        background: linear-gradient(135deg, var(--primary), var(--secondary));
    }

    .chat-message {
        margin-bottom: 16px;
        padding: 14px 18px;
        border-radius: 16px;
        font-size: 16px;
        line-height: 1.5;
    }

    /* Session controls */
    .session-control-bar {
        flex-direction: column;
        gap: 16px;
        padding: 20px 20px;
        border-radius: 16px;
    }

    .session-info {
        text-align: center;
        font-size: 16px;
    }

    .session-buttons {
        flex-direction: column;
        gap: 12px;
        width: 100%;
    }

    /* Download section */
    .download-all-section {
        padding: 28px 20px;
        margin: 32px 0;
        border-radius: 16px;
    }

    .download-all-section .btn-primary {
        width: 100%;
        font-size: 18px;
    }

    /* New analysis */
    .new-analysis-section {
        padding: 24px 20px;
        padding-bottom: max(24px, env(safe-area-inset-bottom));
    }

    /* Login screen mobile */
    .login-screen {
        padding: 20px;
        padding-top: max(20px, env(safe-area-inset-top));
        padding-bottom: max(20px, env(safe-area-inset-bottom));
    }

    .login-container {
        max-width: 100%;
        width: 100%;
        padding: 32px 24px;
        border-radius: 20px;
    }

    .login-header h1 {
        font-size: 36px;
        line-height: 1.2;
        margin-bottom: 12px;
    }

    .login-header p {
        font-size: 17px;
        line-height: 1.4;
    }

    .login-form .form-group {
        margin-bottom: 20px;
    }

    .login-form input {
        font-size: 17px;
        padding: 18px;
        border-radius: 12px;
        width: 100%;
    }

    .login-form .btn-large {
        margin-top: 24px;
        width: 100%;
        font-size: 19px;
        padding: 20px;
        border-radius: 14px;
    }
}

/* Download All Cards Section */
.download-all-section {
    text-align: center;
    margin: 50px 0 30px 0;
    padding: 30px 20px;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.05) 0%, rgba(167, 139, 250, 0.05) 100%);
    border-radius: 16px;
    border: 2px solid rgba(139, 92, 246, 0.2);
}

.download-all-section .btn-primary {
    background: linear-gradient(135deg, #8B5CF6 0%, #6B46C1 100%);
    color: white;
    padding: 18px 40px;
    font-size: 1.1em;
    font-weight: 600;
    min-width: 320px;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
    transition: all 0.3s ease;
}

.download-all-section .btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(139, 92, 246, 0.4);
}

.new-analysis-section {
    text-align: center;
    margin: 30px 0;
}

/* ============================================
   HISTORY / ISTORIJA STYLES
   ============================================ */

.history-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.history-item {
    background: var(--surface);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.history-item:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.history-item-type {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Delete session button */
.btn-delete-session {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 18px;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.2s;
    opacity: 0.5;
}

.btn-delete-session:hover {
    background: rgba(239, 68, 68, 0.1);
    opacity: 1;
}

.history-item:hover .btn-delete-session {
    opacity: 0.8;
}

.history-item-type.mega {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
}

.history-item-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text);
}

.history-item-date {
    font-size: 14px;
    color: var(--text-light);
    margin-bottom: 12px;
}

.history-item-info {
    display: flex;
    gap: 16px;
    font-size: 14px;
    color: var(--text-light);
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.history-item-actions {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.history-item-actions .btn {
    flex: 1;
    padding: 8px 16px;
    font-size: 14px;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
    font-size: 16px;
}

.empty-state p {
    margin-bottom: 8px;
}

/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    padding: 20px;
    overflow-y: auto;
}

.modal-content {
    background: var(--surface);
    border-radius: 20px;
    max-width: 900px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 30px;
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-size: 24px;
    margin: 0;
}

.modal-close {
    width: 40px;
    height: 40px;
    border: none;
    background: var(--bg);
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.modal-close:hover {
    background: var(--error);
    color: white;
}

.modal-body {
    padding: 30px;
}

.session-detail-section {
    margin-bottom: 30px;
}

.session-detail-section h3 {
    color: var(--primary);
    margin-bottom: 16px;
    font-size: 20px;
}

.session-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.session-info-item {
    background: var(--bg);
    padding: 16px;
    border-radius: 12px;
}

.session-info-item label {
    display: block;
    font-size: 12px;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.session-info-item value {
    display: block;
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

.analysis-content {
    background: var(--bg);
    padding: 24px;
    border-radius: 12px;
    margin-bottom: 20px;
    line-height: 1.8;
    white-space: pre-wrap;
}

.chat-history-item {
    margin-bottom: 20px;
    padding: 16px;
    border-radius: 12px;
    background: var(--bg);
}

.chat-history-item.user {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
}

.chat-history-item.assistant {
    background: var(--bg);
}

.chat-history-role {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    color: var(--primary);
}

.chat-history-message {
    line-height: 1.6;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .history-list {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .history-item {
        padding: 20px;
    }

    .modal-content {
        max-width: 100%;
        max-height: 95vh;
        margin: 10px;
    }

    .modal-header {
        padding: 20px;
    }

    .modal-body {
        padding: 20px;
    }

    .session-info-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   COUPLE & FAMILY ANALYSIS STYLES
   ============================================ */

/* Person Section Styling */
.person-section {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05), rgba(118, 75, 162, 0.05));
    border: 2px solid rgba(102, 126, 234, 0.2);
    border-radius: 16px;
    padding: 30px;
    margin-bottom: 30px;
}

.person-title {
    color: var(--primary);
    font-size: 24px;
    margin-bottom: 20px;
    text-align: center;
}

/* Couple Notice */
.couple-notice,
.family-notice {
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.1), rgba(147, 51, 234, 0.1));
    border-left: 4px solid #ec4899;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 30px;
}

.couple-notice h3,
.family-notice h3 {
    margin-bottom: 12px;
    color: #ec4899;
}

.couple-notice ul,
.family-notice ul {
    margin: 12px 0 12px 20px;
}

/* Family Members Container */
#familyMembersContainer {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.family-member {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    position: relative;
}

.family-member-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.family-member-title {
    font-size: 20px;
    font-weight: 600;
    color: var(--primary);
}

.remove-member-btn {
    background: var(--error);
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.remove-member-btn:hover {
    background: #c53030;
    transform: scale(1.1);
}

/* Upload zones for couple/family */
.upload-zone-small {
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.upload-zone-small:hover {
    border-color: var(--primary);
    background: rgba(102, 126, 234, 0.05);
}

.upload-icon-small {
    font-size: 36px;
    margin-bottom: 8px;
}

.image-preview-small {
    text-align: center;
    padding: 16px;
    position: relative;
}

.image-preview-small img {
    max-width: 200px;
    max-height: 200px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.image-preview-small .btn {
    margin-top: 12px;
}

/* Responsive for couple/family */
@media (max-width: 768px) {
    .person-section {
        padding: 20px;
    }

    .person-title {
        font-size: 20px;
    }

    .family-member {
        padding: 16px;
    }

    .family-member-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}

/* ═══════════════════════════════════════════════════════════
   VIOLETA CHAT - BRAND NEW SYSTEM
   ═══════════════════════════════════════════════════════════ */

.violeta-chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 250px);
    min-height: 500px;
    max-width: 1000px;
    margin: 0 auto;
    background: var(--surface);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.violeta-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    background: linear-gradient(to bottom, #f8f9fa 0%, #ffffff 100%);
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.violeta-message {
    display: flex;
    gap: 12px;
    animation: violetaFadeIn 0.3s ease;
}

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

.violeta-message.violeta-user {
    flex-direction: row-reverse;
}

.violeta-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.violeta-bot .violeta-avatar {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
}

.violeta-user .violeta-avatar {
    background: var(--bg);
    color: var(--text);
    border: 2px solid var(--border);
}

.violeta-bubble {
    max-width: 70%;
    padding: 16px 20px;
    border-radius: 18px;
    line-height: 1.6;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.violeta-bot .violeta-bubble {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(118, 75, 162, 0.1));
    border: 2px solid rgba(102, 126, 234, 0.2);
    border-bottom-left-radius: 4px;
}

.violeta-user .violeta-bubble {
    background: var(--bg);
    border: 2px solid var(--border);
    border-bottom-right-radius: 4px;
}

.violeta-bubble strong {
    color: var(--primary);
    display: block;
    margin-bottom: 4px;
}

.violeta-bubble p {
    margin: 8px 0;
}

.violeta-bubble p:first-child {
    margin-top: 0;
}

.violeta-bubble p:last-child {
    margin-bottom: 0;
}

.violeta-chat-input-area {
    border-top: 2px solid var(--border);
    padding: 20px;
    background: var(--surface);
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.violeta-chat-textarea {
    flex: 1;
    padding: 14px 18px;
    border: 2px solid var(--border);
    border-radius: 16px;
    font-size: 16px;
    font-family: inherit;
    line-height: 1.5;
    resize: none;
    transition: all 0.3s;
    min-height: 80px;
}

.violeta-chat-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.violeta-send-btn {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    border-radius: 50%;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.violeta-send-btn:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.violeta-send-btn:active:not(:disabled) {
    transform: scale(0.95);
}

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

.violeta-send-icon {
    font-size: 20px;
    margin-left: 2px;
}

.violeta-send-text {
    display: none;
}

.violeta-typing {
    display: flex;
    gap: 4px;
    padding: 12px;
}

.violeta-typing span {
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    animation: violetaTyping 1.4s infinite;
}

.violeta-typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.violeta-typing span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes violetaTyping {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Mobile Optimization */
@media (max-width: 768px) {
    .violeta-chat-container {
        height: calc(100vh - 120px);
        border-radius: 0;
        max-width: 100%;
    }

    .violeta-chat-messages {
        padding: 20px 16px;
        padding-bottom: 100px;
    }

    .violeta-bubble {
        max-width: 85%;
        padding: 14px 16px;
    }

    .violeta-chat-input-area {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        padding: 16px;
        padding-bottom: max(16px, env(safe-area-inset-bottom));
        background: var(--surface);
        border-top: 2px solid var(--border);
        box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.05);
        z-index: 100;
    }

    .violeta-chat-textarea {
        min-height: 120px;
        font-size: 17px;
        padding: 16px;
    }

    .violeta-send-btn {
        width: 52px;
        height: 52px;
    }
}

@media (max-width: 430px) {
    #chat-section .section-header {
        display: none;
    }

    .violeta-chat-container {
        height: 100vh;
        min-height: 100vh;
    }

    .violeta-chat-messages {
        padding: 16px;
        padding-bottom: 120px;
    }

    .violeta-chat-textarea {
        min-height: 140px;
    }
}

/* ============================================
   TOAST NOTIFICATIONS - Professional Alerts
   ============================================ */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background: white;
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    max-width: 450px;
    animation: toastSlideIn 0.3s ease;
    pointer-events: auto;
    border-left: 4px solid;
}

.toast.success {
    border-left-color: var(--success);
}

.toast.error {
    border-left-color: var(--error);
}

.toast.warning {
    border-left-color: #f59e0b;
}

.toast.info {
    border-left-color: var(--primary);
}

.toast-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    font-size: 15px;
    margin-bottom: 2px;
    color: var(--text);
}

.toast-message {
    font-size: 13px;
    color: var(--text-light);
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.2s;
    padding: 0;
    color: var(--text);
}

.toast-close:hover {
    opacity: 1;
}

.toast.hiding {
    animation: toastSlideOut 0.3s ease forwards;
}

@keyframes toastSlideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes toastSlideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

@media (max-width: 768px) {
    .toast-container {
        top: auto;
        bottom: 20px;
        left: 10px;
        right: 10px;
    }
    
    .toast {
        min-width: auto;
        max-width: none;
    }
}

/* ============================================
   SESSION CHAT - Klausk Violetos (Poros/Šeimos)
   ============================================ */
.session-chat-section {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05), rgba(118, 75, 162, 0.05));
    border-radius: 20px;
    padding: 25px;
    margin-top: 30px;
    border: 1px solid rgba(102, 126, 234, 0.15);
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.1);
}

.chat-section-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(102, 126, 234, 0.1);
}

.chat-icon {
    font-size: 40px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.chat-title h2 {
    font-size: 22px;
    margin: 0;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.chat-title p {
    font-size: 14px;
    color: var(--text-light);
    margin: 4px 0 0 0;
}

.session-chat-history {
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 20px;
    padding: 15px;
    background: white;
    border-radius: 12px;
    min-height: 100px;
}

.session-chat-history:empty::before {
    content: "Čia bus tavo pokalbis su Violeta...";
    color: var(--text-light);
    font-style: italic;
    display: block;
    text-align: center;
    padding: 30px;
}

.session-chat-message {
    margin-bottom: 15px;
    animation: fadeIn 0.3s ease;
}

.session-chat-message.user {
    text-align: right;
}

.session-chat-message.user .message-bubble {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    margin-left: 20%;
}

.session-chat-message.violeta .message-bubble {
    background: #f8f9fa;
    color: var(--text);
    margin-right: 20%;
    border: 1px solid var(--border);
}

.message-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    display: inline-block;
    max-width: 100%;
    text-align: left;
    line-height: 1.5;
}

.session-chat-input {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.session-chat-input textarea {
    flex: 1;
    border: 2px solid var(--border);
    border-radius: 16px;
    padding: 14px 18px;
    font-size: 15px;
    resize: none;
    transition: all 0.3s;
    font-family: inherit;
}

.session-chat-input textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.chat-send-btn {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    border: none;
    border-radius: 16px;
    padding: 14px 24px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    white-space: nowrap;
}

.chat-send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.chat-send-btn:active {
    transform: translateY(0);
}

.send-icon {
    font-size: 18px;
}

.chat-loading {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
    background: rgba(102, 126, 234, 0.05);
    border-radius: 12px;
    margin-top: 15px;
}

.chat-typing-indicator {
    display: flex;
    gap: 4px;
}

.chat-typing-indicator span {
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.chat-typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.chat-typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-8px); opacity: 1; }
}

/* Mobile adjustments for session chat */
@media (max-width: 768px) {
    .session-chat-section {
        padding: 20px 15px;
        margin-top: 20px;
        border-radius: 16px;
    }

    .chat-section-header {
        gap: 12px;
    }

    .chat-icon {
        font-size: 32px;
    }

    .chat-title h2 {
        font-size: 18px;
    }

    .session-chat-input {
        flex-direction: column;
        gap: 12px;
    }

    .session-chat-input textarea {
        width: 100%;
        min-height: 120px;
        max-height: 200px;
        font-size: 16px !important;
        padding: 16px;
        border-radius: 16px;
        border: 2px solid var(--border);
        box-sizing: border-box;
        -webkit-appearance: none;
        appearance: none;
    }

    .session-chat-input textarea:focus {
        border-color: var(--primary);
        box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    }

    .chat-send-btn {
        width: 100%;
        justify-content: center;
        padding: 16px;
        min-height: 52px;
        font-size: 16px;
    }

    .session-chat-history {
        max-height: 250px;
    }

    .session-chat-message.user .message-bubble,
    .session-chat-message.violeta .message-bubble {
        margin-left: 0;
        margin-right: 0;
    }
}

/* ============================================
   PROFILES SYSTEM STYLES
   ============================================ */

/* Profile Autofill Section in Forms */
.profile-autofill-section {
    background: linear-gradient(135deg, #f0f4ff 0%, #e8f0fe 100%);
    border: 2px dashed var(--primary);
    border-radius: 12px;
    padding: 15px 20px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.profile-autofill-section label {
    font-weight: 600;
    color: var(--primary-dark);
    white-space: nowrap;
}

.profile-select {
    flex: 1;
    min-width: 200px;
    padding: 12px 15px;
    border: 2px solid var(--primary);
    border-radius: 8px;
    font-size: 15px;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
}

.profile-select:hover {
    border-color: var(--secondary);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.profile-select:focus {
    outline: none;
    border-color: var(--secondary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.15);
}

/* Profiles Container */
.profiles-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-top: 20px;
}

/* Profile Create Card */
.profile-create-card {
    background: var(--surface);
    border-radius: 16px;
    padding: 25px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.profile-create-card h3 {
    color: var(--primary);
    margin-bottom: 20px;
    font-size: 18px;
}

.profile-form .form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.profile-form .form-group {
    margin-bottom: 15px;
}

.profile-form .upload-zone {
    min-height: 100px;
    padding: 15px;
}

/* Profiles List Container */
.profiles-list-container {
    background: var(--surface);
    border-radius: 16px;
    padding: 25px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.profiles-list-container h3 {
    color: var(--text);
    margin-bottom: 20px;
    font-size: 18px;
}

.profiles-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 500px;
    overflow-y: auto;
}

/* Individual Profile Card */
.profile-card {
    background: linear-gradient(135deg, #f8f9ff 0%, #f0f4ff 100%);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: all 0.2s;
}

.profile-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
    border-color: var(--primary);
}

.profile-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary);
    flex-shrink: 0;
}

.profile-avatar-placeholder {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
    flex-shrink: 0;
}

.profile-info {
    flex: 1;
    min-width: 0;
}

.profile-name {
    font-weight: 600;
    font-size: 16px;
    color: var(--text);
    margin-bottom: 4px;
}

.profile-details {
    font-size: 13px;
    color: var(--text-light);
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.profile-details span {
    background: rgba(102, 126, 234, 0.1);
    padding: 2px 8px;
    border-radius: 4px;
}

.profile-relationship {
    background: rgba(118, 75, 162, 0.15) !important;
    color: var(--secondary) !important;
    font-weight: 500;
}

.profile-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.profile-actions .btn-edit,
.profile-actions .btn-delete {
    padding: 8px 12px;
    font-size: 12px;
    border-radius: 6px;
}

.profile-actions .btn-edit {
    background: var(--primary);
    color: white;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.profile-actions .btn-edit:hover {
    background: var(--secondary);
    transform: translateY(-1px);
}

.profile-actions .btn-delete {
    background: transparent;
    color: var(--error);
    border: 1px solid var(--error);
    cursor: pointer;
}

.profile-actions .btn-delete:hover {
    background: var(--error);
    color: white;
}

/* Empty State */
#profilesEmpty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .profiles-container {
        grid-template-columns: 1fr;
    }

    .profile-autofill-section {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .profile-select {
        min-width: 100%;
    }

    .profile-form .form-row {
        grid-template-columns: 1fr;
    }

    .profile-card {
        flex-wrap: wrap;
    }

    .profile-actions {
        width: 100%;
        justify-content: flex-end;
        margin-top: 10px;
    }
}

