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

:root {
    /* Dark theme color palette */
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --bg-elevated: #282e36;
    --bg-surface: #30363d;
    
    --text-primary: #f0f6fc;
    --text-secondary: #8b949e;
    --text-muted: #656d76;
    
    --accent-primary: #238636;
    --accent-secondary: #2ea043;
    --accent-tertiary: #7c3aed;
    --accent-blue: #58a6ff;
    --accent-purple: #a855f7;
    
    --border-default: #30363d;
    --border-muted: #21262d;
    --border-accent: #58a6ff;
    
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);
    --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.6);
    
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif;
    background: linear-gradient(135deg, var(--bg-primary) 0%, #1c2128 50%, var(--bg-secondary) 100%);
    min-height: 100vh;
    padding: 20px;
    color: var(--text-primary);
    line-height: 1.6;
}

.container {
    max-width: 85%;
    margin: 0 auto;
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    border: 1px solid var(--border-default);
    overflow: hidden;
    animation: fadeInUp 0.8s ease-out;
    backdrop-filter: blur(10px);
}

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

.header {
    background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-purple) 100%);
    color: var(--text-primary);
    padding: 20px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.1) 50%, transparent 70%);
    animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
    0%, 100% { transform: translateX(-100%); }
    50% { transform: translateX(100%); }
}

.header h1 {
    font-size: 2.8em;
    margin-bottom: 10px;
    font-weight: 700;
    letter-spacing: -0.02em;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 1;

}

.header p {
    font-size: 1.2em;
    opacity: 0.9;
    font-weight: 400;
    position: relative;
    z-index: 1;
    color: #000;
}
.login-card { max-width: 560px; margin: 60px auto; background: var(--bg-tertiary); border: 1px solid var(--border-default); border-radius: 16px; padding: 28px; box-shadow: var(--shadow-md); }
        .login-actions { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
        .inline-note { color: var(--text-secondary); font-size: .95rem; }
        .input { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border-default); background: var(--bg-surface); color: var(--text-primary); font-size: 16px; }
        .btn { padding: 10px 16px; border-radius: 12px; border: 1px solid transparent; cursor: pointer; }
        .btn-primary { background: var(--accent-blue); color: white; }
        .btn-secondary { background: transparent; color: var(--text-primary); border-color: var(--border-default); }
        .muted { color: var(--text-secondary); }
        .row { display: grid; gap: 12px; }
        
        /* Confirmation Modal Styles */
        .modal-overlay { 
            position: fixed; 
            top: 0; 
            left: 0; 
            width: 100%; 
            height: 100%; 
            background: rgba(0, 0, 0, 0.6); 
            display: none; 
            align-items: center; 
            justify-content: center; 
            z-index: 1000;
            animation: fadeIn 0.2s ease-out;
        }
        .modal-overlay.show { display: flex; }
        .modal { 
            background: var(--bg-tertiary); 
            border: 1px solid var(--border-default); 
            border-radius: 16px; 
            padding: 24px; 
            max-width: 400px; 
            width: 90%; 
            box-shadow: var(--shadow-lg);
            transform: scale(0.9);
            animation: modalSlideIn 0.2s ease-out forwards;
        }
        .modal h3 { 
            margin: 0 0 16px 0; 
            color: var(--text-primary); 
            font-size: 1.25rem;
        }
        .modal p { 
            margin: 0 0 20px 0; 
            color: var(--text-secondary); 
            line-height: 1.5;
        }
        .modal-actions { 
            display: flex; 
            gap: 12px; 
            justify-content: flex-end; 
        }
        .btn-success { 
            background: var(--accent-primary); 
            color: white; 
        }
        .btn-cancel { 
            background: var(--bg-surface); 
            color: var(--text-primary); 
            border-color: var(--border-default); 
        }
        
        @keyframes fadeIn {
            from { opacity: 0; }
            to { opacity: 1; }
        }
        
        @keyframes modalSlideIn {
            from { transform: scale(0.9) translateY(-10px); opacity: 0; }
            to { transform: scale(1) translateY(0); opacity: 1; }
        }
        
        /* Info Section Styles */
        .info-section {
            max-width: 560px;
            margin: 30px auto 0;
            display: grid;
            gap: 20px;
        }
        
        .description-box, .credits-box {
            background: var(--bg-tertiary);
            border: 1px solid var(--border-default);
            border-radius: 12px;
            padding: 20px;
            box-shadow: var(--shadow-sm);
        }
        
        .description-box h3 {
            margin: 0 0 12px 0;
            color: var(--accent-blue);
            font-size: 1.1rem;
            font-weight: 600;
        }
        
        .description-box p {
            margin: 0;
            color: var(--text-secondary);
            line-height: 1.6;
            font-size: 0.95rem;
        }
        
        .credits-box h4 {
            margin: 0 0 16px 0;
            color: var(--accent-purple);
            font-size: 1rem;
            font-weight: 600;
        }
        
        .credits-content {
            color: var(--text-secondary);
            font-size: 0.9rem;
            line-height: 1.5;
        }
        
        .creator {
            margin-bottom: 12px;
        }
        
        .collaborators ul {
            margin: 8px 0 0 0;
            padding-left: 20px;
        }
        
        .collaborators li {
            margin-bottom: 4px;
        }
        
        .credits-content a {
            color: var(--accent-blue);
            text-decoration: none;
            margin-left: 8px;
        }
        
        .credits-content a:hover {
            text-decoration: underline;
        }
        
        /* Mobile responsiveness for info section */
        @media (max-width: 768px) {
            .info-section {
                margin: 20px auto 0;
                padding: 0 10px;
            }
            
            .description-box, .credits-box {
                padding: 16px;
            }
        }
/* Header with Logo Styles */
.header-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}

.header-logo {
  height: 40px;
  width: auto;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  transition: transform 0.3s ease;
  position: absolute;
  left: 0px;
  top: 0px;
}

.header-logo:hover {
    transform: scale(1.05);
}

.header-text {
    text-align: center;
}

.header-text h1 {
    margin: 0 0 5px 0;
    font-size: 2.5em;
    font-weight: 700;
    letter-spacing: -0.02em;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.header-text p {
    margin: 0;
    font-size: 1.2em;
    opacity: 0.9;
    font-weight: 400;
    color: #000;
}

/* Responsive header layout */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 15px;
    }
    
    .header-logo {
        height: 20px;
    }
    
    .header-text h1 {
        font-size: 2.2em;
    }
    
    .header-text p {
        font-size: 1.1em;
    }
}

.content {
    padding: 40px;
    background: var(--bg-secondary);
}

.question-container {
    margin-bottom: 30px;
    padding: 25px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-default);
    border-left: 4px solid var(--accent-blue);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.question-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, transparent, rgba(88, 166, 255, 0.05));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.question-container:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    border-left-color: var(--accent-secondary);
}

.question-container:hover::before {
    opacity: 1;
}

.question-text {
    font-size: 1.1em;
    margin-bottom: 15px;
    color: var(--text-primary);
    font-weight: 500;
    position: relative;
    z-index: 1;
}

.rating-scale {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 400px;
    margin: 20px auto;
}

.scale-label {
    font-size: 0.9em;
    color: var(--text-secondary);
    font-weight: 500;
}

.rating-options {
    display: flex;
    gap: 15px;
}

.rating-option {
    position: relative;
}

.rating-option input[type="radio"] {
    appearance: none;
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-default);
    border-radius: 50%;
    background: var(--bg-surface);
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    box-shadow: var(--shadow-sm);
}

.rating-option input[type="radio"]:hover {
    border-color: var(--accent-blue);
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(88, 166, 255, 0.3);
}

.rating-option input[type="radio"]:checked {
    background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-purple) 100%);
    border-color: var(--accent-blue);
    transform: scale(1.2);
    box-shadow: 0 0 25px rgba(88, 166, 255, 0.4);
}

.rating-option input[type="radio"]:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    background: var(--text-primary);
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.rating-option label {
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.8em;
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
}

.submit-btn {
    background: linear-gradient(135deg, var(--accent-primary) 0%, var(--accent-secondary) 100%);
    color: var(--text-primary);
    border: none;
    padding: 16px 40px;
    font-size: 1.1em;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: block;
    margin: 40px auto 0;
    min-width: 200px;
    font-weight: 600;
    letter-spacing: 0.5px;
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.submit-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.submit-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(35, 134, 54, 0.4);
}

.submit-btn:hover::before {
    left: 100%;
}

.submit-btn:active {
    transform: translateY(-1px);
}

.submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: var(--shadow-sm);
}

/* Results page styles */
.results-container {
    padding: 40px;
    background: var(--bg-secondary);
}

.score-item {
    background: linear-gradient(135deg, var(--accent-tertiary) 0%, var(--accent-purple) 100%);
    color: var(--text-primary);
    padding: 25px;
    margin: 20px 0;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    border: 1px solid rgba(168, 85, 247, 0.3);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.score-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, transparent, rgba(255, 255, 255, 0.1));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.score-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(168, 85, 247, 0.4);
}

.score-item:hover::before {
    opacity: 1;
}

.score-item h3 {
    font-size: 1.4em;
    margin-bottom: 10px;
    font-weight: 600;
    position: relative;
    z-index: 1;
}
.description-box, .credits-box {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow-sm);
  max-width: 800px;
  align-content: center;
  margin: auto;
  margin-bottom: 10px;
}
.description-box h3 {
    margin: 0 0 12px 0;
    color: var(--accent-blue);
    font-size: 1.1rem;
    font-weight: 600;
}

.description-box p {
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.6;
    font-size: 0.95rem;
}
.score-value {
    font-size: 2em;
    font-weight: bold;
    margin-bottom: 10px;
    position: relative;
    z-index: 1;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}
.description {
    background: var(--bg-tertiary);
    padding: 30px;
    border-radius: var(--radius-lg);
    margin: 30px 0;
    border: 1px solid var(--border-default);
    border-left: 4px solid var(--accent-blue);
    line-height: 1.8;
    font-size: 1.05em;
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

/* AI Profiling styles */
.chat-container {
    overflow-y: auto;
    background: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin: 20px 0;
    border: 1px solid var(--border-default);
    box-shadow: var(--shadow-sm);
}

.message {
    padding: 15px;
    margin: 10px 0;
    border-radius: var(--radius-lg);
    max-width: 80%;
    animation: slideIn 0.3s ease-out;
    box-shadow: var(--shadow-sm);
}

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

.user-message {
    background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-purple) 100%);
    color: var(--text-primary);
    margin-left: auto;
    text-align: right;
    border: 1px solid rgba(88, 166, 255, 0.3);
}

.ai-message {
    background: var(--bg-surface);
    color: var(--text-primary);
    margin-right: auto;
    border: 1px solid var(--border-default);
    border-left: 3px solid var(--accent-primary);
}

.system-message {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: var(--text-primary);
    text-align: center;
    max-width: 100%;
    font-style: italic;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.input-group {
    display: flex;
    gap: 10px;
    margin: 20px 0;
}

.input-group input {
    flex: 1;
    padding: 15px;
    border: 2px solid var(--border-default);
    border-radius: 25px;
    font-size: 16px; /* Prevent iOS zoom - must be 16px or larger */
    background: var(--bg-surface);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.input-group input:focus {
    outline: none;
    border-color: var(--accent-blue);
    box-shadow: 0 0 20px rgba(88, 166, 255, 0.3);
}

.input-group input::placeholder {
    color: var(--text-muted);
}

.input-group button {
    background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-purple) 100%);
    color: var(--text-primary);
    border: none;
    padding: 15px 25px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.input-group button:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 20px rgba(88, 166, 255, 0.4);
}

/* AI Chat input styling */
#chat-input {
    transition: all 0.3s ease;
}

#chat-input:focus {
    border-color: var(--accent-blue) !important;
    box-shadow: 0 0 20px rgba(88, 166, 255, 0.3) !important;
    outline: none;
}

#chat-input::placeholder {
    color: var(--text-muted);
}

#chat-input:disabled {
    background: var(--bg-muted) !important;
    color: var(--text-muted) !important;
    cursor: not-allowed;
    opacity: 0.6;
}

#send-button:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 20px rgba(88, 166, 255, 0.4) !important;
}

#send-button:disabled {
    background: var(--bg-muted) !important;
    cursor: not-allowed !important;
    transform: none !important;
    box-shadow: none !important;
    opacity: 0.6;
}

/* Final results page */
.final-results {
    display: grid;
    grid-template-columns: 1fr;
    gap: 25px;
    max-width: 1200px;
    margin: 0 auto;
}

.profile-summary-card, .big5-results, .topics-results, .interests-results, .ai-results {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(100, 255, 218, 0.2);
    border-radius: 15px;
    padding: 25px;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.profile-summary-card:hover, .big5-results:hover, .topics-results:hover, .interests-results:hover, .ai-results:hover {
    border-color: rgba(100, 255, 218, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(100, 255, 218, 0.1);
}

.profile-summary-card h3, .big5-results h3, .topics-results h3, .interests-results h3, .ai-results h3 {
    color: #64ffda;
    margin-bottom: 20px;
    font-size: 1.3em;
    font-weight: 600;
    border-bottom: 2px solid rgba(100, 255, 218, 0.3);
    padding-bottom: 10px;
}

/* Profile Summary Styling */
.profile-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.profile-detail {
    background: rgba(100, 255, 218, 0.05);
    padding: 15px;
    border-radius: 10px;
    border-left: 4px solid #64ffda;
}

.profile-detail strong {
    color: #64ffda;
    display: block;
    margin-bottom: 5px;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.profile-detail span {
    color: #e0e0e0;
    font-size: 1.1em;
}

/* Big 5 Results Styling */
.score-item {
    background: rgba(100, 255, 218, 0.05);
    margin-bottom: 15px;
    padding: 20px;
    border-radius: 12px;
    border-left: 4px solid #64ffda;
    transition: all 0.3s ease;
}

.score-item:hover {
    background: rgba(100, 255, 218, 0.08);
    transform: translateX(5px);
}

.score-item h4 {
    color: #64ffda;
    margin-bottom: 10px;
    font-size: 1.1em;
    font-weight: 500;
}

.score-value {
    color: #e0e0e0;
    font-size: 1em;
    line-height: 1.6;
}

/* Topics and Stances Styling */
.topics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 15px;
}

.topic-item {
    background: rgba(100, 255, 218, 0.05);
    padding: 20px;
    border-radius: 12px;
    border: 1px solid rgba(100, 255, 218, 0.1);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.topic-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #ff4757, #ff7675, #fdcb6e, #6c5ce7, #a29bfe);
    border-radius: 12px 12px 0 0;
}

.topic-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(100, 255, 218, 0.15);
}

.topic-name {
    color: #64ffda;
    font-weight: 600;
    font-size: 1.1em;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.topic-stance {
    color: #e0e0e0;
    margin-bottom: 10px;
    line-height: 1.6;
    font-style: italic;
}

.topic-polarity {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

.polarity-label {
    color: #64ffda;
    font-size: 0.9em;
    font-weight: 500;
}

.polarity-bar {
    flex: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.polarity-fill {
    height: 100%;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.polarity-value {
    color: #fff;
    font-weight: 600;
    font-size: 0.9em;
    min-width: 30px;
    text-align: center;
}

/* Polarity color coding */
.polarity-1 { background: linear-gradient(90deg, #ff4757, #ff3742); }
.polarity-2 { background: linear-gradient(90deg, #ff7675, #ff6b6b); }
.polarity-3 { background: linear-gradient(90deg, #fdcb6e, #f39c12); }
.polarity-4 { background: linear-gradient(90deg, #00b894, #00a085); }
.polarity-5 { background: linear-gradient(90deg, #6c5ce7, #5f3dc4); }

/* Topics of Interest Styling */
.interests-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.interest-tag {
    background: linear-gradient(135deg, #64ffda, #4ecdc4);
    color: #0a0a0a;
    padding: 10px 18px;
    border-radius: 25px;
    font-weight: 600;
    font-size: 0.9em;
    box-shadow: 0 4px 15px rgba(100, 255, 218, 0.3);
    transition: all 0.3s ease;
    cursor: default;
}

.interest-tag:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(100, 255, 218, 0.4);
}

.no-interests {
    color: #999;
    font-style: italic;
    text-align: center;
    padding: 20px;
}

/* Topics Selection Styling */
.topics-selection-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
}

.topics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.topic-option {
    background: rgba(255, 255, 255, 0.03);
    border: 2px solid rgba(100, 255, 218, 0.2);
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    backdrop-filter: blur(10px);
    user-select: none;
}

.topic-option:hover {
    border-color: rgba(100, 255, 218, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(100, 255, 218, 0.15);
}

.topic-option.selected {
    background: linear-gradient(135deg, rgba(100, 255, 218, 0.2), rgba(100, 255, 218, 0.1));
    border-color: #64ffda;
    box-shadow: 0 0 20px rgba(100, 255, 218, 0.3);
}

.topic-option.selected::before {
    content: '✓';
    position: absolute;
    top: 10px;
    right: 10px;
    background: #64ffda;
    color: #0a0a0a;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
}

.topic-option-title {
    color: #64ffda;
    font-weight: 600;
    font-size: 1.1em;
    margin-bottom: 8px;
}

.topic-option-description {
    color: var(--text-secondary);
    font-size: 0.9em;
    line-height: 1.4;
}

.topic-questionnaire-btn {
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.8em;
    font-weight: 600;
    cursor: pointer;
    margin-top: 10px;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.topic-questionnaire-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(88, 166, 255, 0.4);
}

.selected-topics-summary {
    background: rgba(100, 255, 218, 0.05);
    border: 1px solid rgba(100, 255, 218, 0.2);
    border-radius: 10px;
    padding: 20px;
    margin-bottom: 20px;
    text-align: center;
    display: none;
}

.selected-topics-summary h4 {
    color: #64ffda;
    margin-bottom: 10px;
    font-size: 1.1em;
}

.selected-topics-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 10px;
}

.selected-topic-tag {
    background: linear-gradient(135deg, #64ffda, #4ecdc4);
    color: #0a0a0a;
    padding: 5px 12px;
    border-radius: 15px;
    font-size: 0.8em;
    font-weight: 600;
}

.no-topics-selected {
    color: var(--text-muted);
    font-style: italic;
}

/* Loading state for topics */
.topics-loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.topics-loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(100, 255, 218, 0.3);
    border-radius: 50%;
    border-top-color: #64ffda;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

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

/* AI Profile Loading Popup Styles */
.ai-loading-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.ai-loading-content {
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-elevated) 100%);
    border: 2px solid var(--accent-blue);
    border-radius: var(--radius-xl);
    padding: 4px 5px;
    text-align: center;
    box-shadow: var(--shadow-xl);
    backdrop-filter: blur(10px);
    position: relative;
    z-index: 2;
    max-width: 450px;
    margin-right: 100px; /* Make space for arrow */
}

.ai-loading-icon {
    margin-bottom: 20px;
}

.brain-animation {
    font-size: 4rem;
    animation: pulse-brain 2s ease-in-out infinite;
    display: inline-block;
}

@keyframes pulse-brain {
    0%, 100% {
        transform: scale(1);
        opacity: 0.8;
    }
    50% {
        transform: scale(1.1);
        opacity: 1;
    }
}

.ai-loading-title {
    color: var(--accent-blue);
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 10px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.ai-loading-subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 30px;
    line-height: 1.5;
}

.loading-dots {
    display: flex;
    justify-content: center;
    gap: 8px;
}

.loading-dots span {
    width: 12px;
    height: 12px;
    background: var(--accent-blue);
    border-radius: 50%;
    animation: loading-bounce 1.4s ease-in-out infinite both;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }
.loading-dots span:nth-child(3) { animation-delay: 0s; }

@keyframes loading-bounce {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1.2);
        opacity: 1;
    }
}

/* Arrow pointer pointing to the right sidebar */
.arrow-pointer {
    position: absolute;
    right: 32%;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1;
}

.arrow-line {
    width: 80px;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-purple));
    border-radius: 2px;
    position: relative;
    animation: arrow-glow 2s ease-in-out infinite;
}

.arrow-head {
    position: absolute;
    right: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 15px solid var(--accent-purple);
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
    animation: arrow-glow 2s ease-in-out infinite;
}

.arrow-text {
    position: absolute;
    top: -35px;
    right: -40px;
    color: var(--accent-blue);
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
    animation: text-glow 2s ease-in-out infinite;
}

@keyframes arrow-glow {
    0%, 100% {
        opacity: 0.7;
        filter: brightness(1);
    }
    50% {
        opacity: 1;
        filter: brightness(1.3);
    }
}

@keyframes text-glow {
    0%, 100% {
        opacity: 0.8;
        text-shadow: 0 0 5px var(--accent-blue);
    }
    50% {
        opacity: 1;
        text-shadow: 0 0 15px var(--accent-blue);
    }
}

/* Responsive adjustments for AI loading popup */
@media (max-width: 768px) {
    .ai-loading-content {
        margin-right: 0;
        max-width: 90%;
        padding: 30px 25px;
    }
    
    .ai-loading-title {
        font-size: 1.5rem;
    }
    
    .brain-animation {
        font-size: 3rem;
    }
    
    .arrow-pointer {
        display: none; /* Hide arrow on mobile */
    }
}

@media (max-width: 1200px) {
    .arrow-pointer {
        right: 15%;
    }
    
    .arrow-line {
        width: 60px;
    }
}

/* Topic Questionnaire Modal Styles */
.topic-questionnaire-container {
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-elevated) 100%);
    border: 2px solid var(--accent-blue);
    border-radius: var(--radius-xl);
    padding: 30px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    backdrop-filter: blur(10px);
    position: relative;
}

.topic-questionnaire-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-default);
}

.topic-questionnaire-header h3 {
    color: var(--accent-blue);
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.close-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 2rem;
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: var(--bg-surface);
    color: var(--text-primary);
    transform: scale(1.1);
}

.topic-questionnaire-content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.topic-question {
    background: var(--bg-surface);
    padding: 25px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-default);
    border-left: 4px solid var(--accent-blue);
}

.topic-question p {
    font-size: 1em;
    color: var(--text-primary);
    font-weight: 500;
    line-height: 1.6;
}

.topic-rating-scale {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 500px;
    margin: 0 auto;
}

.topic-rating-options {
    display: flex;
    gap: 15px;
}

.topic-rating-option {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.topic-rating-option input[type="radio"] {
    appearance: none;
    width: 45px;
    height: 45px;
    border: 3px solid var(--border-default);
    border-radius: 50%;
    background: var(--bg-tertiary);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.topic-rating-option input[type="radio"]:hover {
    border-color: var(--accent-blue);
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(88, 166, 255, 0.3);
}

.topic-rating-option input[type="radio"]:checked {
    background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-purple) 100%);
    border-color: var(--accent-blue);
    transform: scale(1.2);
    box-shadow: 0 0 25px rgba(88, 166, 255, 0.4);
}

.topic-rating-option input[type="radio"]:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 15px;
    height: 15px;
    background: var(--text-primary);
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
}

.topic-rating-option label {
    margin-top: 8px;
    font-size: 0.9em;
    color: var(--text-secondary);
    font-weight: 600;
}

.topic-chat-section {
    background: var(--bg-surface);
    padding: 20px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-default);
}

.topic-chat-section h4 {
    color: var(--accent-blue);
    margin-bottom: 15px;
    font-size: 1.1em;
    font-weight: 600;
}

.topic-questionnaire-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.topic-progress {
    text-align: center;
    margin-top: 20px;
}

.topic-progress-text {
    color: var(--text-secondary);
    font-size: 0.9em;
    margin-bottom: 10px;
    display: block;
}

.topic-progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-surface);
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid var(--border-default);
}

.topic-progress-bar div {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-purple));
    transition: width 0.3s ease;
    border-radius: 4px;
}

/* Progress Indicator Styles */
.progress-indicator {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 10px 0;
    gap: 20px;
}

.step {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.1em;
    background: var(--bg-surface);
    border: 2px solid var(--border-default);
    color: var(--text-muted);
    transition: all 0.3s ease;
    position: relative;
}

.step::after {
    content: '';
    position: absolute;
    top: 50%;
    left: calc(100% + 10px);
    width: 20px;
    height: 2px;
    background: var(--border-default);
    transform: translateY(-50%);
    transition: all 0.3s ease;
}

.step:last-child::after {
    display: none;
}

.step.active {
    background: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-purple) 100%);
    border-color: var(--accent-blue);
    color: white;
    box-shadow: 0 0 20px rgba(88, 166, 255, 0.3);
}

.step.completed {
    background: var(--accent-primary);
    border-color: var(--accent-secondary);
    color: white;
}

.step.completed::after {
    background: var(--accent-primary);
}

.step.active::after {
    background: var(--accent-blue);
}

/* Responsive design for topic questionnaire */
@media (max-width: 768px) {
    .topic-questionnaire-container {
        width: 95%;
        padding: 10px;
        max-height: 90vh;
    }
    
    .topic-rating-scale {
        flex-direction: row;
        gap: 8px;
        text-align: center;
        max-width: none;
        align-items: center;
        justify-content: space-between;
    }
    
    .scale-label {
        font-size: 0.75em;
        flex-shrink: 0;
        padding-top: 20px;
    }
    
    .topic-rating-options {
        gap: 8px;
        flex: 1;
        justify-content: center;
    }
    
    .topic-rating-option input[type="radio"] {
        width: 32px;
        height: 32px;
        border-width: 2px;
    }
    
    .topic-rating-option label {
        font-size: 0.8em;
        margin-top: 6px;
    }
    
    .topic-questionnaire-actions {
        flex-direction: column;
        display: inline;
        align-content: center;
        margin: auto;
    }
    
   
    
    /* Mobile-friendly topics grid */
    .topics-selection-container {
        padding: 0 10px;
    }
    
    .topics-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 10px;
        margin-bottom: 20px;
    }
    
    .topic-option {
        padding: 15px 10px;
        min-height: 60px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 0.9em;
        line-height: 1.3;
    }
    
    .topic-option.selected {
        background: rgba(100, 255, 218, 0.15);
        border-color: #64ffda;
        transform: scale(1.02);
    }
    
    /* Better mobile typography for main page */
    .header h1 {
        font-size: 1.4em;
    margin-top: 20px;
    }
    
    .header a {
        font-size: 0.85em;
        padding: 6px 12px;
    }
    
    #topics-section h2 {
        font-size: 1.4em;
        margin-bottom: 20px;
        padding: 0 10px;
    }
    
    .submit-btn {
        max-width: 300px;
        padding: 12px 20px;
        font-size: 1em;
        min-width: 170px;
    }
}

/* iPhone-specific tweaks for Profile Maker layout and Profiler Refiner */
@media (max-width: 480px) {
    /* Edge-to-edge content on very small screens */
    body { padding: 0 !important; }
    .container { max-width: 100% !important; border-radius: 0 !important; }
    .content { padding: 8px !important; }

    /* Profiler Refiner block */
    #results-section h3 { font-size: 1.1em; margin-bottom: 12px !important; }
    #results-section p { font-size: 0.95em; margin-bottom: 12px !important; }

    /* Make the chat area taller and more usable on iPhone */
    #results-section #chat-container {
        height: 30svh !important;      /* use small viewport height on iOS */
        max-height: 55svh !important;
        padding: 12px !important;
        border-radius: 12px !important;
    }

    /* Keep input row visible; add safe-area padding */
    #results-section #chat-container + div {
        position: sticky;
        bottom: 0;
        background: var(--bg-tertiary);
        padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
        z-index: 1;
    }

    /* Prevent iOS zoom and ensure comfortable tap targets */
    #results-section #chat-input { font-size: 16px !important; padding: 12px !important; }
    #results-section #send-button { min-height: 44px !important; padding: 12px 16px !important; }
    
    /* Prevent iOS zoom on all input fields */
    input, textarea, select {
        font-size: 16px !important;
    }
}

/* Tablet-sized refinements for a better mobile experience on larger phones/tablets */
@media (max-width: 768px) {
    /* Make questionnaire taller on tablets too */
    .topic-questionnaire-container { max-height: 100dvh; }
    .topic-questionnaire-actions button { 
        min-height: 44px;
        min-width: 0px;
        display: inline; 
        margin: auto;
    }
}

/* Disable background scroll when any modal is open */
body.modal-open {
    overflow: hidden;
    height: 100%;
    position: fixed;
    width: 100%;
    touch-action: none;
}
