:root {
    --sage-green: #8DA399;
    --serene-blue: #5B7C99;
    --sand: #E6E2DD;
    --deep-blue: #0F172A;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-primary: #E2E8F0;
    --text-secondary: #94A3B8;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
    background-color: var(--deep-blue);
    color: var(--text-primary);
    height: 100vh;
    display: flex;
    justify-content: center;
    overflow: hidden;
}

.app-container {
    width: 100%;
    max-width: 600px;
    /* Mobile-first view on desktop */
    height: 100%;
    display: flex;
    flex-direction: column;
    background: radial-gradient(circle at top right, #1e293b, var(--deep-blue));
    position: relative;
}

/* --- ARC: The Core & Header --- */
.top-bar {
    text-align: center;
    padding: 15px 20px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 600px;
    /* Constrain width on large screens */
    margin: 0 auto;
    position: relative;
}

.logo-section {
    flex: 1;
    display: flex;
    justify-content: flex-start;
}

.app-logo {
    height: 32px;
    width: auto;
    opacity: 0.9;
}

.core-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.core {
    width: 50px;
    height: 50px;
    background: var(--sage-green);
    border-radius: 50%;
    box-shadow: 0 0 20px var(--sage-green);
    animation: breathe 4s infinite ease-in-out;
    transition: all 0.5s ease;
}

.profile-link {
    flex: 1;
    display: flex;
    justify-content: flex-end;
    text-decoration: none;
}

.profile-icon {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.profile-icon:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
    border-color: var(--serene-blue);
}

@keyframes breathe {
    0% {
        transform: scale(1);
        opacity: 0.8;
        box-shadow: 0 0 10px var(--sage-green);
    }

    50% {
        transform: scale(1.5);
        opacity: 1;
        box-shadow: 0 0 30px var(--sage-green);
    }

    100% {
        transform: scale(1);
        opacity: 0.8;
        box-shadow: 0 0 10px var(--sage-green);
    }
}

.status-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
    letter-spacing: 1px;
    text-transform: uppercase;
}

/* --- Chat Area --- */
.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    scroll-behavior: smooth;
}

.message {
    display: flex;
    width: 100%;
}

.message.assistant {
    justify-content: flex-start;
}

.message.user {
    justify-content: flex-end;
}

.bubble {
    max-width: 80%;
    padding: 12px 18px;
    border-radius: 18px;
    font-size: 1rem;
    line-height: 1.5;
    position: relative;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.message.assistant .bubble {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-top-left-radius: 4px;
    color: var(--text-primary);
}

.message.user .bubble {
    background: rgba(91, 124, 153, 0.2);
    /* Serene Blue transparent */
    border: 1px solid rgba(91, 124, 153, 0.3);
    border-top-right-radius: 4px;
    color: #fff;
}

/* --- Input Area --- */
.input-area {
    padding: 20px;
    z-index: 10;
}

.suggestion-chips {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    overflow-x: auto;
    padding-bottom: 5px;
}

.chip {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 20px;
    white-space: nowrap;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.chip:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.input-wrapper {
    display: flex;
    align-items: center;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--glass-border);
    border-radius: 30px;
    padding: 5px 5px 5px 15px;
    backdrop-filter: blur(10px);
}

.micro-buttons {
    display: flex;
    gap: 8px;
    margin-right: 10px;
}

.icon-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
    padding: 5px;
}

.icon-btn:hover {
    opacity: 1;
}

input[type="text"] {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    padding: 10px 0;
}

.send-btn {
    background: var(--serene-blue);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-left: 10px;
    transition: transform 0.2s;
}

.send-btn:hover {
    transform: scale(1.05);
}

/* --- Breathing Exercise Overlay --- */
.breathing-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.5s ease;
}

.breathing-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.breathing-circle {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: var(--sage-green);
    box-shadow: 0 0 40px var(--sage-green);
    margin-bottom: 40px;
    /* Animation will be applied via JS */
}

.breathing-text {
    font-size: 1.5rem;
    color: var(--text-primary);
    margin-bottom: 20px;
    height: 30px;
    /* Fixed height to prevent jump */
}

.close-breathing {
    margin-top: 30px;
    background: transparent;
    border: 1px solid var(--text-secondary);
    color: var(--text-secondary);
    padding: 8px 20px;
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s;
}

.close-breathing:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-color: var(--text-primary);
}

@keyframes breathe-in {
    0% {
        transform: scale(1);
    }

    100% {
        transform: scale(2);
    }
}

@keyframes breathe-hold {
    0% {
        transform: scale(2);
    }

    100% {
        transform: scale(2);
    }
}

@keyframes breathe-out {
    0% {
        transform: scale(2);
    }

    100% {
        transform: scale(1);
    }
}

/* --- Dashboard --- */
.dashboard-overlay {
    position: absolute;
    top: 80px;
    left: 20px;
    right: 20px;
    bottom: 100px;
    background: rgba(15, 23, 42, 0.98);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    z-index: 50;
    display: none;
    /* Hidden by default */
    flex-direction: column;
    padding: 20px;
    animation: fade-in 0.3s ease;
}

.dashboard-overlay.active {
    display: flex;
}

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

.dashboard-header h2 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--sage-green);
}

.close-dashboard {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
}

.stat-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 15px;
}

.stat-card h3 {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 0;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 5px;
}

.dot.stable {
    background-color: var(--sage-green);
    box-shadow: 0 0 5px var(--sage-green);
}

.dot.warning {
    background-color: #FACC15;
}

.connection-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.connection-list li {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--glass-border);
    font-size: 0.9rem;
}

.tag {
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
}

.tag.resolved {
    background: rgba(141, 163, 153, 0.2);
    color: var(--sage-green);
}

.tag.pending {
    background: rgba(91, 124, 153, 0.2);
    color: var(--serene-blue);
}

.energy-bar-container {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 5px;
}

.energy-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--serene-blue), var(--sage-green));
}

.energy-value {
    font-size: 0.8rem;
    float: right;
}

@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Authentication --- */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 40px 20px;
    /* Increased padding */
    box-sizing: border-box;
    overflow-y: auto;
    /* Allow scrolling on small screens */
}

.auth-card {
    width: 100%;
    max-width: 400px;
    padding: 2rem;
    text-align: center;
    border-radius: 20px;
    background: rgba(15, 23, 42, 0.6);
    margin: auto 0;
    /* Center vertically if space permits */
}

.profile-card-expanded {
    max-width: 600px;
    /* Wider card for profile */
}

.profile-section {
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 20px;
    text-align: left;
    background: rgba(255, 255, 255, 0.02);
}

.profile-section legend {
    color: var(--serene-blue);
    padding: 0 10px;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.form-row {
    display: flex;
    gap: 15px;
}

.form-group.half {
    flex: 1;
}

.profile-form {
    text-align: left;
}

/* Scrollbar for multi-select */
select[multiple] {
    height: auto;
    padding-right: 0;
    background-image: none;
    /* Remove arrow */
    overflow-y: auto;
}

select[multiple] option {
    padding: 8px;
    border-radius: 4px;
    margin-bottom: 2px;
}

select[multiple] option:checked {
    background: var(--serene-blue);
    color: white;
}

.privacy-vault {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(15, 23, 42, 0.4);
}

.privacy-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 0;
}

.danger-btn {
    width: 100%;
    padding: 12px;
    background: transparent;
    border: 1px solid #ef4444;
    /* Red-500 */
    border-radius: 8px;
    color: #ef4444;
    font-size: 0.9rem;
    cursor: pointer;
    margin-top: 10px;
    transition: all 0.2s ease;
}

.danger-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    transform: translateY(-2px);
}

.auth-card h2 {
    color: var(--sage-green);
    margin-bottom: 1.5rem;
    font-weight: 400;
    letter-spacing: 1px;
}

.form-group {
    margin-bottom: 1.2rem;
    text-align: left;
}

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

.glass-input {
    width: 100%;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s ease;
    font-family: inherit;
    box-sizing: border-box;
    /* Fix width calculation */
}

.glass-input:focus {
    outline: none;
    border-color: var(--serene-blue);
    background: rgba(255, 255, 255, 0.1);
}

/* Date Input Styling */
input[type="date"].glass-input {
    color-scheme: dark;
    position: relative;
}

input[type="date"].glass-input::-webkit-calendar-picker-indicator {
    background-color: rgba(255, 255, 255, 0.1);
    padding: 5px;
    cursor: pointer;
    border-radius: 3px;
    filter: invert(1);
    opacity: 0.6;
    transition: opacity 0.2s;
}

input[type="date"].glass-input::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}

select.glass-input {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23cbd5e1%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right .7em top 50%;
    background-size: .65em auto;
}

select.glass-input option {
    background-color: #1a202c;
    color: var(--text-primary);
}

.auth-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, var(--serene-blue), var(--sage-green));
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 1rem;
    transition: transform 0.2s ease;
    box-sizing: border-box;
    /* Fix width calculation */
}

.auth-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(91, 124, 153, 0.3);
}

.auth-footer {
    margin-top: 1.5rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.auth-footer a {
    color: var(--serene-blue);
    text-decoration: none;
    transition: color 0.2s;
}

.auth-footer a:hover {
    color: var(--sage-green);
}

.flash-messages {
    margin-bottom: 1rem;
}

.flash-message {
    background: rgba(244, 67, 54, 0.2);
    border: 1px solid rgba(244, 67, 54, 0.3);
    color: #ffdce0;
    padding: 10px;
    border-radius: 8px;
    font-size: 0.9rem;
}

.core-mini {
    width: 40px;
    height: 40px;
    background: var(--sage-green);
    border-radius: 50%;
    margin: 0 auto 1rem;
    box-shadow: 0 0 15px var(--sage-green);
    animation: breathe 4s infinite ease-in-out;
}