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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

/* Auth Page Styles */
.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-card {
    background: white;
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.auth-card h1 {
    text-align: center;
    color: #667eea;
    font-size: 2.5em;
    margin-bottom: 10px;
}

.subtitle {
    text-align: center;
    color: #666;
    margin-bottom: 30px;
}

#auth-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
}

.tab-btn {
    flex: 1;
    padding: 12px;
    border: none;
    background: #f0f0f0;
    cursor: pointer;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
}

.tab-btn.active {
    background: #667eea;
    color: white;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #333;
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-secondary {
    padding: 10px 20px;
    background: #f0f0f0;
    color: #333;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s;
}

.btn-secondary:hover {
    background: #e0e0e0;
}

.error-message {
    margin-top: 20px;
    padding: 12px;
    background: #fee;
    color: #c33;
    border-radius: 8px;
    display: none;
}

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

/* Dashboard Styles */
.dashboard-container {
    display: flex;
    height: 100vh;
    background: #f5f7fa;
}

.sidebar {
    width: 250px;
    background: white;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 30px 20px;
    border-bottom: 1px solid #eee;
}

.sidebar-header h2 {
    color: #667eea;
    margin-bottom: 5px;
}

.sidebar-header p {
    color: #666;
    font-size: 14px;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: #666;
    text-decoration: none;
    transition: all 0.3s;
}

.nav-item:hover,
.nav-item.active {
    background: #f0f0f0;
    color: #667eea;
}

.nav-item span {
    font-size: 20px;
}

.btn-logout {
    margin: 20px;
    padding: 12px;
    background: #f44336;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
}

.btn-logout:hover {
    background: #d32f2f;
}

.main-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

.content-section {
    background: white;
    border-radius: 12px;
    padding: 30px;
}

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

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

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    border-radius: 12px;
    text-align: center;
}

.stat-card h3 {
    font-size: 14px;
    font-weight: 500;
    opacity: 0.9;
    margin-bottom: 10px;
}

.stat-value {
    font-size: 36px;
    font-weight: bold;
}

.form-card {
    background: #f9f9f9;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

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

.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

.tasks-list, .files-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.task-item, .file-item {
    background: #f9f9f9;
    padding: 20px;
    border-radius: 12px;
    border-left: 4px solid #667eea;
}

.task-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 10px;
}

.task-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.task-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.badge-low { background: #e3f2fd; color: #1976d2; }
.badge-medium { background: #fff3e0; color: #f57c00; }
.badge-high { background: #ffebee; color: #c62828; }
.badge-urgent { background: #f3e5f5; color: #7b1fa2; }

.task-description {
    color: #666;
    margin-bottom: 10px;
}

.task-meta {
    display: flex;
    gap: 15px;
    font-size: 12px;
    color: #999;
}

.file-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.file-meta {
    font-size: 12px;
    color: #999;
}

.chat-container {
    display: flex;
    flex-direction: column;
    height: 500px;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 12px;
    margin-bottom: 20px;
}

.message {
    margin-bottom: 15px;
    padding: 12px 16px;
    border-radius: 12px;
    max-width: 70%;
}

.message.user {
    background: #667eea;
    color: white;
    margin-left: auto;
}

.message.assistant {
    background: white;
    color: #333;
}

.chat-input-form {
    display: flex;
    gap: 10px;
}

.chat-input-form input {
    flex: 1;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
}

.profile-card {
    background: #f9f9f9;
    border-radius: 12px;
    padding: 30px;
}

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

.profile-card label {
    display: block;
    font-size: 12px;
    color: #999;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.profile-card p {
    font-size: 16px;
    color: #333;
    font-weight: 500;
}


/* Chat layout enhancements */
.chat-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 16px;
}

.conversation-sidebar {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 12px;
    padding: 12px;
    height: 500px;
    display: flex;
    flex-direction: column;
}

.conversation-sidebar input {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
}

.conversations-list {
    margin-top: 10px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.conversation-item {
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid transparent;
}

.conversation-item:hover {
    background: #f6f6f6;
}

.conversation-item.active {
    background: #eef2ff;
    border-color: #c7d2fe;
}

.conversation-title {
    font-weight: 600;
    color: #333;
}

.conversation-meta {
    font-size: 12px;
    color: #777;
}

.chat-pane {
    display: flex;
    flex-direction: column;
}

.chat-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 8px;
}

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

.chat-subtitle {
    font-size: 12px;
    color: #999;
}


/* Japanese-inspired WA Theme */
:root {
    --wa-bg: #FAF7F2;
    --wa-card: #FFFFFF;
    --wa-cream: #FFFDF7;
    --wa-ink: #2F2A2A;
    --wa-muted: #7A746B;
    --wa-outline: #E8E2D9;
    --wa-sakura: #F4DCE4;
    --wa-indigo: #3E4A66;
    --wa-pine: #6B8F71;
    --wa-shadow: 0 10px 30px rgba(34,32,30,.06);
    --wa-radius: 14px;
}

body.theme-wa {
    background:
        radial-gradient(1200px 800px at 10% -10%, rgba(244,220,228,.35), transparent 40%),
        radial-gradient(1200px 800px at 110% 10%, rgba(107,143,113,.18), transparent 40%),
        var(--wa-bg);
    color: var(--wa-ink);
    font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.theme-wa .sidebar {
    background: var(--wa-card);
    box-shadow: var(--wa-shadow);
}
.theme-wa .sidebar-header h2 { font-family: 'Shippori Mincho', serif; color: var(--wa-indigo); }
.theme-wa .sidebar-header p { color: var(--wa-muted); }
.theme-wa .nav-item { border-radius: 10px; margin: 0 8px; }
.theme-wa .nav-item:hover { background: #F5F3EF; color: var(--wa-indigo); }
.theme-wa .nav-item.active { background: #EEF0F6; color: var(--wa-indigo); }
.theme-wa .btn-logout { background: #b23c3c; }

.theme-wa .main-content { padding: 28px; }
.theme-wa .content-section { background: var(--wa-card); border: 1px solid var(--wa-outline); box-shadow: var(--wa-shadow); }
.theme-wa .section-header h1 { font-family: 'Shippori Mincho', serif; color: var(--wa-indigo); letter-spacing: 0.3px; }

/* Chat layout (WA) */
.theme-wa .chat-layout { grid-template-columns: 300px 1fr; gap: 20px; }
.theme-wa .conversation-sidebar { background: var(--wa-card); border: 1px solid var(--wa-outline); border-radius: var(--wa-radius); padding: 12px; box-shadow: var(--wa-shadow); }
.theme-wa .conversation-sidebar .conv-actions { display: grid; grid-template-columns: 1fr; gap: 10px; margin-bottom: 10px; }
.theme-wa .conversation-sidebar input { border: 1px solid var(--wa-outline); background: var(--wa-cream); color: var(--wa-ink); }

.theme-wa .conversations-list { padding-right: 4px; }
.theme-wa .conversation-item { border: 1px solid transparent; background: transparent; transition: all .2s ease; }
.theme-wa .conversation-item:hover { background: #F6F4F0; }
.theme-wa .conversation-item.active { background: #EEF0F6; border-color: #cfd6ea; box-shadow: inset 0 0 0 1px #e3e8f4; }
.theme-wa .conversation-title { color: var(--wa-ink); }
.theme-wa .conversation-meta { color: var(--wa-muted); }

.theme-wa .chat-pane { background: var(--wa-card); border: 1px solid var(--wa-outline); border-radius: var(--wa-radius); padding: 12px; box-shadow: var(--wa-shadow); }
.theme-wa .chat-header { padding: 6px 8px 10px; border-bottom: 1px solid var(--wa-outline); }
.theme-wa .chat-title { font-family: 'Shippori Mincho', serif; color: var(--wa-indigo); }
.theme-wa .chat-subtitle { color: var(--wa-muted); }

.theme-wa .chat-messages { background: var(--wa-cream); border: 1px solid var(--wa-outline); border-radius: var(--wa-radius); }
.theme-wa .message { border-radius: 16px; box-shadow: 0 4px 14px rgba(62,74,102,.06); position: relative; }
.theme-wa .message.assistant { background: #fff; border: 1px solid var(--wa-outline); color: var(--wa-ink); }
.theme-wa .message.user { background: linear-gradient(180deg, #3E4A66, #2f3a54); color: #fff; }
.theme-wa .msg-meta { margin-top: 6px; font-size: 11px; color: var(--wa-muted); opacity: .9; }

/* Input bar */
.theme-wa .chat-input-container { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; }
.theme-wa .chat-input-container textarea { resize: none; min-height: 44px; max-height: 160px; padding: 12px 14px; background: var(--wa-cream); border: 1px solid var(--wa-outline); border-radius: 12px; outline: none; transition: box-shadow .2s; }
.theme-wa .chat-input-container textarea:focus { box-shadow: 0 0 0 3px rgba(62,74,102,.08); }

.btn-primary-wa { padding: 12px 16px; background: var(--wa-indigo); color: #fff; border: none; border-radius: 12px; font-weight: 600; cursor: pointer; box-shadow: 0 6px 18px rgba(62,74,102,.25); transition: transform .06s ease, box-shadow .2s ease, background .2s; }
.btn-primary-wa:hover { background: #34435e; box-shadow: 0 8px 22px rgba(62,74,102,.32); }
.btn-primary-wa:active { transform: translateY(1px); }
.btn-primary-wa:disabled { background: #9aa3b6; box-shadow: none; cursor: not-allowed; }

/* States */
.hidden { display: none !important; }
.theme-wa .wa-empty { text-align: center; color: var(--wa-muted); padding: 24px; }
.theme-wa .wa-error { background: #fdecec; color: #8a3a3a; border: 1px solid #f5c8c8; padding: 12px 14px; border-radius: 10px; margin: 10px 0; }

/* Skeletons */
.skeleton { position: relative; overflow: hidden; background: #ece9e3; border-radius: 10px; }
.skeleton::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255,255,255,.6), transparent); animation: shimmer 1.2s infinite; }
@keyframes shimmer { 100% { transform: translateX(100%); } }

/* Spinner */
.wa-spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(62,74,102,.2); border-top-color: var(--wa-indigo); animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Scrollbars */
.theme-wa .chat-messages::-webkit-scrollbar { width: 10px; }
.theme-wa .chat-messages::-webkit-scrollbar-thumb { background: #e5e1da; border-radius: 8px; }

/* Responsive */
@media (max-width: 900px) { .theme-wa .chat-layout { grid-template-columns: 1fr; } .theme-wa .conversation-sidebar { order: 2; height: 220px; } .theme-wa .chat-pane { order: 1; } }
