/* ==========================================================================
   QualityAI Hub - Master Stylesheet
   ========================================================================== */

/* Theme Variables */
:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --accent-blue: #0284c7;
    --accent-blue-hover: #0369a1;
    --accent-blue-light: #e0f2fe;
    --border-color: #e5e7eb;
    --card-bg: #ffffff;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --transition-speed: 0.25s;
    --border-radius: 12px;
}

/* Dark Mode Variables */
body.dark-mode {
    --bg-primary: #111827;
    --bg-secondary: #1f2937;
    --text-primary: #f9fafb;
    --text-secondary: #9ca3af;
    --accent-blue: #38bdf8;
    --accent-blue-hover: #0ea5e9;
    --accent-blue-light: #075985;
    --border-color: #374151;
    --card-bg: #1f2937;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
}

/* Global Resets & Setup */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

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

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ==========================================================================
   Navigation Header
   ========================================================================== */
.navbar {
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background-color var(--transition-speed) ease, border-color var(--transition-speed) ease;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1200px;
    margin: 0 auto;
    padding: 15px 20px;
}

.logo {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    letter-spacing: -0.025em;
}

.logo-accent {
    color: var(--accent-blue);
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nav-item {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: color var(--transition-speed) ease;
}

.nav-item:hover {
    color: var(--accent-blue);
}

.theme-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    color: var(--text-secondary);
    padding: 8px;
    border-radius: 50%;
    transition: background-color var(--transition-speed) ease, color var(--transition-speed) ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-btn:hover {
    background-color: var(--bg-secondary);
    color: var(--accent-blue);
}

/* ==========================================================================
   Hero Section
   ========================================================================== */
.hero-section {
    text-align: center;
    padding: 60px 20px 40px;
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -0.05em;
    margin-bottom: 10px;
    color: var(--text-primary);
}

.hero-subtitle {
    font-size: 1.15rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* ==========================================================================
   Interactive Module Cards Grid
   ========================================================================== */
.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 24px;
    margin-bottom: 50px;
}

.module-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    color: inherit;
    transition: transform var(--transition-speed) ease, box-shadow var(--transition-speed) ease, border-color var(--transition-speed) ease;
    display: flex;
    flex-direction: column;
}

.module-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--accent-blue);
}

.card-icon-wrapper {
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background-color: var(--accent-blue-light);
    color: var(--accent-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 16px;
}

.card-icon-wrapper .sigma-symbol {
    font-family: "Times New Roman", Times, serif;
    font-size: 1.6rem;
    line-height: 1;
}

.card-title {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.card-description {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.45;
}

/* ==========================================================================
   Interactive Widgets (Fun Features)
   ========================================================================== */
.interactive-widgets {
    margin-bottom: 50px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.widgets-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.widget-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.widget-title {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--accent-blue);
    display: flex;
    align-items: center;
    gap: 8px;
}

.widget-intro {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

/* Score Meter Elements */
.score-input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.score-input-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.85rem;
    resize: none;
    outline: none;
}

.score-input-group textarea:focus {
    border-color: var(--accent-blue);
}

.widget-btn {
    background-color: var(--accent-blue);
    color: white;
    border: none;
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.widget-btn:hover {
    background-color: var(--accent-blue-hover);
}

.widget-btn-secondary {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 16px;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.15s ease;
    align-self: flex-start;
}

.widget-btn-secondary:hover {
    background-color: var(--bg-primary);
}

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

.score-bar-bg {
    width: 100%;
    height: 8px;
    background-color: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.score-bar-fill {
    height: 100%;
    background-color: var(--accent-blue);
    width: 0%;
    transition: width 0.5s ease-out;
}

#score-value {
    font-size: 0.9rem;
    font-weight: 700;
    align-self: flex-end;
}

.score-feedback {
    font-size: 0.8rem;
    color: var(--text-secondary);
    min-height: 24px;
}

/* Coach & Challenge Specific styles */
.coach-advice-box {
    background-color: var(--bg-primary);
    border: 1px dashed var(--border-color);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 16px;
    text-align: center;
    font-style: italic;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    font-weight: 500;
}

.challenge-question {
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 12px;
}

.challenge-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.challenge-opt-btn {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 12px;
    font-size: 0.8rem;
    text-align: left;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.challenge-opt-btn:hover {
    border-color: var(--accent-blue);
    background-color: var(--accent-blue-light);
}

.challenge-feedback {
    font-size: 0.8rem;
    font-weight: 600;
    min-height: 20px;
}

/* ==========================================================================
   Future Expansion Tags
   ========================================================================== */
.future-expansion {
    text-align: center;
    padding: 40px 0;
    border-top: 1px solid var(--border-color);
    margin-bottom: 40px;
}

.expansion-title {
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 6px;
}

.expansion-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.expansion-tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.tag {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* ==========================================================================
   Chat Interface Styles (For upcoming Chat Module)
   ========================================================================== */
.chat-wrapper {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 120px);
    max-width: 900px;
    margin: 0 auto;
    padding: 20px 0;
}

.chat-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.chat-title-group h2 {
    font-size: 1.25rem;
    font-weight: 700;
}

.chat-subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.chat-history {
    flex-grow: 1;
    overflow-y: auto;
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.chat-message {
    display: flex;
    gap: 16px;
    padding: 16px;
    border-radius: var(--border-radius);
    max-width: 85%;
    line-height: 1.6;
}

.chat-message.user {
    background-color: var(--bg-secondary);
    align-self: flex-end;
}

.chat-message.assistant {
    background-color: transparent;
    border: 1px solid var(--border-color);
    align-self: flex-start;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--accent-blue-light);
    color: var(--accent-blue);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.chat-message.user .message-avatar {
    background-color: var(--border-color);
    color: var(--text-secondary);
}

.message-text {
    font-size: 0.95rem;
    word-break: break-word;
}

/* Preserve whitespace/formatting of structured AI outputs like lists, tables, DMAIC headings */
.message-text pre, .message-text code {
    background-color: var(--bg-secondary);
    padding: 4px 8px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.85rem;
}

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

.chat-input-container {
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-primary);
}

.input-box-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 6px 14px;
}

.input-box-wrapper:focus-within {
    border-color: var(--accent-blue);
}

.chat-input {
    flex-grow: 1;
    background: transparent;
    border: none;
    outline: none;
    padding: 8px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
}

.icon-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 1.1rem;
    color: var(--text-secondary);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.icon-btn:hover {
    background-color: var(--border-color);
    color: var(--accent-blue);
}

.icon-btn.active-recording {
    background-color: #ef4444;
    color: #ffffff !important;
    animation: pulse 1.5s infinite;
}

/* Auth Pages Style */
.auth-wrapper {
    max-width: 400px;
    margin: 60px auto;
    padding: 30px;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
}

.auth-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 20px;
    text-align: center;
}

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

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    outline: none;
    font-family: inherit;
}

.form-control:focus {
    border-color: var(--accent-blue);
}

.auth-btn {
    width: 100%;
    background-color: var(--accent-blue);
    color: #ffffff;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.auth-btn:hover {
    background-color: var(--accent-blue-hover);
}

.auth-footer {
    margin-top: 15px;
    font-size: 0.85rem;
    text-align: center;
    color: var(--text-secondary);
}

.auth-footer a {
    color: var(--accent-blue);
    text-decoration: none;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.footer {
    margin-top: auto;
    background-color: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    padding: 30px 20px;
    text-align: center;
    transition: background-color var(--transition-speed) ease, border-color var(--transition-speed) ease;
}

.footer-container p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.footer-subtext {
    margin-top: 6px;
    font-size: 0.75rem;
    color: var(--text-secondary);
    opacity: 0.8;
}

/* ==========================================================================
   Animations & Media Queries (Includes LinkedIn Mobile Tab Bar Layout)
   ========================================================================== */
@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

@media (max-width: 768px) {
    body {
        padding-bottom: 75px; /* Adds space so the fixed bottom bar never hides page contents */
    }
    
    .hero-title {
        font-size: 2rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    /* Keep branding header at the very top of the viewport (Static layout) */
    .navbar {
        position: static;
        border-bottom: 1px solid var(--border-color);
    }
    
    .nav-container {
        justify-content: center;
        padding: 12px 10px;
    }
    
    .logo {
        font-size: 1.15rem;
    }
    
    /* Reconstruct navigation links into a persistent bottom bar like LinkedIn */
    .nav-links {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: 62px;
        background-color: var(--bg-primary);
        border-top: 1px solid var(--border-color);
        border-bottom: none;
        display: flex;
        justify-content: space-around; /* Distribute tabs evenly across the bar */
        align-items: center;
        z-index: 1000;
        box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.05);
        padding: 0 5px;
    }
    
    body.dark-mode .nav-links {
        box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.35);
    }
    
    .nav-item {
        font-size: 0.75rem;
        font-weight: 600;
        padding: 12px 2px;
        text-align: center;
        flex-grow: 1;
        display: block;
        white-space: nowrap;
    }
    
    /* Adjust theme toggle button in the bottom tab bar */
    .theme-btn {
        font-size: 0.95rem;
        padding: 10px 2px;
        flex-grow: 1;
    }
}