/* ===== CSS Variables ===== */
:root {
    --bg-main: #1C181D;
    --bg-sidebar: #141115;
    --bg-card: #252026;
    --accent: #BA1D68;
    --accent-hover: #d12275;
    --text-header: #FFFFFF;
    --text-body: #9CA3AF;
    --text-muted: #6B7280;
    --border: #2D282E;
    --success: #10B981;
    --critical: #EF4444;
    --warning: #F59E0B;
    
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --sidebar-width: 320px;
    --header-height: 60px;
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
}

body {
    font-family: var(--font-family);
    background: var(--bg-main);
    color: var(--text-body);
    line-height: 1.5;
    overflow-x: hidden;
}

/* ===== Attribution Banner ===== */
.attribution-banner {
    background: linear-gradient(90deg, var(--accent), #8B1450);
    color: white;
    text-align: center;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
}

.attribution-banner strong {
    font-weight: 700;
}

/* ===== App Container ===== */
.app-container {
    display: flex;
    height: calc(100vh - 33px);
}

/* ===== Sidebar ===== */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-text {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-header);
}

.sidebar-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

.sidebar-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-header);
    margin-bottom: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.project-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.project-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 14px 16px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.project-item:hover {
    border-color: var(--accent);
}

.project-item.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
}

.project-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.project-icon {
    font-size: 18px;
}

.project-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-header);
}

.project-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 8px;
    border-radius: 4px;
    width: fit-content;
}

.project-status.completed {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.project-status.on-track {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.project-status.at-risk {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.project-status.critical {
    background: rgba(239, 68, 68, 0.15);
    color: var(--critical);
    animation: pulse-critical 1.5s ease-in-out infinite;
}

@keyframes pulse-critical {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.status-icon.check {
    width: 12px;
    height: 12px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}

.project-subtext {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-muted);
}

/* ===== Main Content ===== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.main-header {
    height: var(--header-height);
    min-height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-main);
}

.breadcrumb {
    font-size: 14px;
    color: var(--text-muted);
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--border);
}

.user-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.content-wrapper {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

/* ===== Content Header ===== */
.content-header {
    margin-bottom: 24px;
}

.content-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.content-icon {
    font-size: 24px;
}

.content-title-row h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-header);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 6px 12px;
    border-radius: 6px;
    margin-left: auto;
}

.status-badge.completed {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.status-badge.on-track {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.status-badge.at-risk {
    background: rgba(245, 158, 11, 0.15);
    color: var(--warning);
}

.status-badge.critical {
    background: rgba(239, 68, 68, 0.15);
    color: var(--critical);
    animation: shake 0.5s ease-in-out, pulse-critical 1.5s ease-in-out infinite 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
    20%, 40%, 60%, 80% { transform: translateX(4px); }
}

.content-description {
    font-size: 14px;
    color: var(--text-body);
}

/* ===== Tabs ===== */
.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0;
}

.tab {
    background: none;
    border: none;
    padding: 12px 16px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    position: relative;
    transition: color var(--transition-fast);
}

.tab:hover {
    color: var(--text-body);
}

.tab.active {
    color: var(--text-header);
}

.tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent);
}

/* ===== Sections ===== */
.section {
    margin-bottom: 32px;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-header);
    margin-bottom: 16px;
}

.section-icon {
    font-size: 16px;
}

/* ===== Task List ===== */
.task-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.task-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.task-number {
    font-size: 14px;
    color: var(--text-muted);
    min-width: 20px;
}

.task-text {
    flex: 1;
    font-size: 14px;
    color: var(--text-header);
}

/* ===== Buttons ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.btn-done {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border-color: rgba(16, 185, 129, 0.3);
}

.btn-outline {
    background: transparent;
    color: var(--text-body);
    border-color: var(--border);
}

.btn-outline:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.btn-accent {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

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

.btn-icon {
    padding: 10px;
}

.btn-draft {
    background: rgba(186, 29, 104, 0.1);
    color: var(--accent);
    border-color: rgba(186, 29, 104, 0.3);
}

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

#upload-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-body);
}

#upload-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* ===== Document List ===== */
.document-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.document-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    text-decoration: none;
    transition: all var(--transition-fast);
}

.document-item:hover {
    border-color: var(--accent);
}

.doc-icon {
    font-size: 20px;
}

.doc-name {
    flex: 1;
    font-size: 14px;
    color: var(--text-header);
}

.doc-action {
    font-size: 13px;
    color: var(--accent);
    font-weight: 500;
}

/* ===== Chat ===== */
.chat-log {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    min-height: 150px;
    max-height: 400px;
    overflow-y: auto;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px;
    color: var(--text-muted);
    text-align: center;
}

.empty-icon {
    font-size: 32px;
    opacity: 0.5;
}

.chat-message {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 12px;
    animation: fadeIn 0.3s ease;
}

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

.chat-message:last-child {
    margin-bottom: 0;
}

.chat-message.robin {
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.chat-message.system {
    background: rgba(107, 114, 128, 0.1);
    border: 1px solid rgba(107, 114, 128, 0.3);
}

.chat-message.loading {
    background: rgba(186, 29, 104, 0.05);
    border: 1px solid rgba(186, 29, 104, 0.2);
}

.chat-message.error {
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Loading Spinner */
.loading-spinner {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.loading-spinner::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.chat-message.system-alert {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    animation: slideIn 0.4s ease, flash 0.6s ease;
}

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

@keyframes flash {
    0%, 50%, 100% { opacity: 1; }
    25%, 75% { opacity: 0.5; }
}

.chat-message.draft-update {
    background: rgba(186, 29, 104, 0.1);
    border: 1px solid rgba(186, 29, 104, 0.3);
    animation: slideIn 0.4s ease 0.2s backwards;
}

.message-avatar {
    font-size: 24px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-main);
    border-radius: 50%;
}

.message-content {
    flex: 1;
}

.message-sender {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-header);
    margin-bottom: 4px;
    display: block;
}

.message-content p {
    font-size: 14px;
    color: var(--text-body);
    line-height: 1.6;
}

/* ===== Chat Input ===== */
.chat-input-area {
    margin-top: auto;
    padding-top: 24px;
    border-top: 1px solid var(--border);
}

.input-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.input-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
}

.input-row textarea {
    flex: 1;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 16px;
    font-family: inherit;
    font-size: 14px;
    color: var(--text-header);
    resize: none;
    transition: border-color var(--transition-fast);
}

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

.input-row textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.input-actions {
    display: flex;
    gap: 8px;
}

/* ===== Main Footer ===== */
.main-footer {
    display: flex;
    justify-content: flex-end;
    gap: 24px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    background: var(--bg-main);
}

.main-footer a {
    font-size: 13px;
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.main-footer a:hover {
    color: var(--text-header);
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-sidebar);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        min-width: 100%;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    
    .sidebar-content {
        max-height: 200px;
    }
}

