:root {
    /* Colors - No Purple/Indigo */
    --color-bg-base: #f3f4f6;
    --color-bg-surface: #ffffff;
    --color-text-primary: #111827;
    --color-text-secondary: #4b5563;
    --color-primary: #059669; /* Emerald Green */
    --color-primary-hover: #047857;
    --color-accent: #f59e0b; /* Amber */
    --color-danger: #ef4444;
    
    /* Layout */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 24px;
    
    /* Shadows */
    --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);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
    /* Animation - Custom Easing */
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-snappy: cubic-bezier(0.16, 1, 0.3, 1);
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--color-text-primary);
    margin: 0;
    min-height: 100vh;
    /* Noise texture simulation using gradient */
    background: 
        radial-gradient(circle at 15% 50%, rgba(5, 150, 105, 0.08), transparent 25%), 
        radial-gradient(circle at 85% 30%, rgba(245, 158, 11, 0.08), transparent 25%),
        linear-gradient(135deg, #f9fafb 0%, #f3f4f6 100%);
    background-attachment: fixed;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Container - Asymmetrical */
.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start; /* Avoid perfect center */
}

/* Cards */
.card {
    background: var(--color-bg-surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    padding: 2rem;
    margin-bottom: 2rem;
    width: 100%;
    box-sizing: border-box;
    transition: transform 0.3s var(--ease-spring), box-shadow 0.3s var(--ease-snappy);
    position: relative;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

/* Typography */
h1, h2, h3 {
    margin-top: 0;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--color-text-primary);
}

h1 { font-size: 2.5rem; line-height: 1.1; margin-bottom: 1.5rem; }
h2 { font-size: 1.8rem; margin-bottom: 1rem; }
p { margin-bottom: 1rem; color: var(--color-text-secondary); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: transform 0.2s var(--ease-spring), background-color 0.2s ease;
    background-color: var(--color-primary);
    color: white;
    font-size: 1rem;
}

.btn:hover {
    background-color: var(--color-primary-hover);
    transform: scale(1.05);
}

.btn:active {
    transform: scale(0.95);
}

.btn-secondary {
    background-color: white;
    color: var(--color-text-primary);
    border: 1px solid #e5e7eb;
}

.btn-secondary:hover {
    background-color: #f9fafb;
    border-color: #d1d5db;
}

.btn-danger {
    background-color: #fee2e2;
    color: #b91c1c;
}
.btn-danger:hover {
    background-color: #fecaca;
}

/* Inputs */
.form-group {
    margin-bottom: 1.5rem;
    width: 100%;
}

label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--color-text-secondary);
}

input[type="text"],
input[type="password"],
textarea,
select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #e5e7eb;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background: #fff;
    box-sizing: border-box;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.1);
}

/* Images & Icons */
.iconify {
    font-size: 1.25em;
    vertical-align: -0.125em;
}

.illustration-wrapper {
    width: 100%;
    display: flex;
    justify-content: center; /* Center illustrations is okay usually, but maybe align left? */
    margin: 2rem 0;
}

.undraw-img {
    max-width: 100%;
    height: auto;
    max-height: 300px;
}

/* Grid Layout for Story Plaza */
.story-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    width: 100%;
}

.story-card {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.story-card img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
}

/* Asymmetrical Header */
header {
    width: 100%;
    padding: 1.5rem 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    margin-bottom: 2rem;
}

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

/* Chat Layout */
.chat-container {
    display: flex;
    flex-direction: column;
    height: 60vh;
    border: 1px solid #e5e7eb;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: #fff;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    background: #f9fafb;
}

.message {
    margin-bottom: 1rem;
    max-width: 80%;
    padding: 1rem;
    border-radius: var(--radius-md);
    position: relative;
}

.message.user {
    background: var(--color-primary);
    color: white;
    align-self: flex-end; /* This requires flex on parent */
    margin-left: auto;
    border-bottom-right-radius: 2px;
}

.message.ai {
    background: white;
    border: 1px solid #e5e7eb;
    color: var(--color-text-primary);
    align-self: flex-start;
    margin-right: auto;
    border-bottom-left-radius: 2px;
}

.chat-input-area {
    padding: 1rem;
    background: white;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 0.5rem;
}

/* Responsive */
@media (max-width: 640px) {
    .container {
        padding: 1rem;
    }
    h1 { font-size: 2rem; }
}

/* SPA Sections */
.page-section {
    width: 100%;
    animation: fadeIn 0.3s ease;
}

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

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
}

th, td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e5e7eb;
}

th {
    font-weight: 600;
    color: var(--color-text-secondary);
    background: #f9fafb;
}

tr:hover {
    background-color: #f9fafb;
}

/* Sidebar Panels - FIX: Remove fixed height */
.user-list-panel {
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    padding: 1rem;
    /* height: 100%; REMOVED THIS */
    overflow-y: auto;
    max-height: 100%;
}
