/* frontend/styles.css */
:root {
    /* Base colors */
    --primary: #3b82f6;
    --primary-dark: #2563eb;
    --secondary: #64748b;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --background: #0f172a;
    --surface: #1e293b;
    --surface-light: #334155;
    --text: #f1f5f9;
    --text-secondary: #94a3b8;

    /* Glassmorphism */
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(148, 163, 184, 0.1);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);

    /* Transitions */
    --transition: all 0.3s ease;

    /* Persona colors */
    --persona-study: #3b82f6;
    --persona-finance: #10b981;
    --persona-hackathon: #8b5cf6;
    --persona-portfolio: #f59e0b;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--background);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
}

/* Welcome Page */
.welcome-page {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #334155 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.welcome-container {
    max-width: 1200px;
    width: 100%;
    padding: 20px;
}

.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 48px;
    box-shadow: var(--glass-shadow);
    animation: fadeIn 0.6s ease-out;
}

.logo-header {
    text-align: center;
    margin-bottom: 48px;
}

.logo-icon {
    font-size: 64px;
    color: var(--primary);
    margin-bottom: 16px;
    animation: float 3s ease-in-out infinite;
}

.logo-title {
    font-size: 3.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary) 0%, #8b5cf6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
}

.logo-subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.hero-section {
    text-align: center;
}

.tagline {
    font-size: 1.5rem;
    color: var(--text);
    margin-bottom: 48px;
    font-weight: 300;
}

.robot-hero {
    margin: 40px 0;
    display: flex;
    justify-content: center;
}

.robot-circle {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--surface) 0%, var(--surface-light) 100%);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 40px rgba(59, 130, 246, 0.3);
    transition: var(--transition);
}

.robot-face {
    position: relative;
    z-index: 2;
}

.robot-eye {
    width: 20px;
    height: 20px;
    background: var(--primary);
    border-radius: 50%;
    position: absolute;
    top: -30px;
    animation: blink 3s infinite;
}

.robot-eye.left {
    left: -20px;
}

.robot-eye.right {
    right: -20px;
}

.robot-mouth {
    width: 40px;
    height: 8px;
    background: var(--primary);
    border-radius: 4px;
    position: absolute;
    top: 20px;
    left: -20px;
}

.robot-glow {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: radial-gradient(circle at center, rgba(59, 130, 246, 0.2) 0%, transparent 70%);
    animation: pulse 2s ease-in-out infinite;
}

.robot-speech {
    margin: 32px 0;
}

.speech-bubble {
    background: var(--surface);
    border-radius: 20px;
    padding: 20px 28px;
    max-width: 600px;
    margin: 0 auto;
    position: relative;
    border: 1px solid var(--glass-border);
}

.speech-bubble p {
    font-size: 1.1rem;
    color: var(--text);
    font-style: italic;
}

.speech-arrow {
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid var(--surface);
}

.principles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;
    margin: 48px 0;
}

.principle {
    background: rgba(30, 41, 59, 0.5);
    padding: 24px;
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.1);
    transition: var(--transition);
}

.principle:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
}

.principle i {
    font-size: 32px;
    color: var(--primary);
    margin-bottom: 16px;
}

.principle h4 {
    font-size: 1.2rem;
    margin-bottom: 8px;
    color: var(--text);
}

.principle p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    border: none;
    padding: 16px 32px;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.4);
}

.footer-note {
    margin-top: 48px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.footer-note i {
    color: var(--success);
    margin-right: 8px;
}

/* Dashboard */
.dashboard-page {
    min-height: 100vh;
    background: var(--background);
}

.top-nav {
    background: var(--surface);
    border-bottom: 1px solid var(--glass-border);
    padding: 16px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
}

.logo i {
    color: var(--primary);
    font-size: 1.8rem;
}

.persona-selector {
    display: flex;
    align-items: center;
    gap: 12px;
}

.persona-selector label {
    color: var(--text-secondary);
}

.persona-selector select {
    background: var(--surface-light);
    color: var(--text);
    border: 1px solid var(--glass-border);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: var(--transition);
}

.persona-selector select:hover {
    border-color: var(--primary);
}

.btn-secondary {
    background: var(--surface-light);
    color: var(--text);
    border: 1px solid var(--glass-border);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
}

.btn-secondary:hover {
    background: var(--surface);
    border-color: var(--primary);
}

.dashboard-container {
    display: grid;
    grid-template-columns: 300px 1fr 350px;
    min-height: calc(100vh - 73px);
}

.sidebar {
    background: var(--surface);
    border-right: 1px solid var(--glass-border);
    padding: 24px;
    overflow-y: auto;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.sidebar-header h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1rem;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    transition: var(--transition);
}

.icon-btn:hover {
    color: var(--primary);
    background: rgba(59, 130, 246, 0.1);
}

.file-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 24px;
}

.file-item {
    background: rgba(30, 41, 59, 0.5);
    padding: 12px 16px;
    border-radius: 8px;
    border: 1px solid transparent;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 12px;
}

.file-item:hover {
    background: rgba(30, 41, 59, 0.8);
    border-color: var(--glass-border);
}

.file-icon {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.file-icon.pdf {
    background: #ef4444;
}

.file-icon.csv {
    background: #10b981;
}

.file-icon.png,
.file-icon.jpg {
    background: #3b82f6;
}

.file-icon.txt {
    background: #8b5cf6;
}

.file-info {
    flex: 1;
}

.file-name {
    font-weight: 500;
    color: var(--text);
    font-size: 0.9rem;
}

.file-type {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.workspace-stats {
    background: rgba(30, 41, 59, 0.5);
    border-radius: 12px;
    padding: 16px;
    border: 1px solid var(--glass-border);
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.stat {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.stat-value {
    display: block;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text);
}

.main-content {
    padding: 32px;
    overflow-y: auto;
    background: var(--background);
}

.content-header {
    margin-bottom: 32px;
}

.content-header h2 {
    font-size: 2rem;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.content-header .subtitle {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.task-buttons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 32px;
}

.task-btn {
    background: var(--surface);
    border: 1px solid var(--glass-border);
    padding: 16px;
    border-radius: 12px;
    cursor: pointer;
    transition: var(--transition);
    text-align: left;
}

.task-btn:hover {
    transform: translateY(-2px);
    border-color: var(--primary);
    background: rgba(59, 130, 246, 0.1);
}

.task-btn i {
    font-size: 1.5rem;
    margin-bottom: 12px;
    color: var(--primary);
}

.task-btn h4 {
    font-size: 1rem;
    margin-bottom: 4px;
    color: var(--text);
}

.task-btn p {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.suggestions-feed {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 32px;
}

.suggestion-card {
    background: var(--surface);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 24px;
    transition: var(--transition);
    animation: slideIn 0.3s ease-out;
}

.suggestion-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--glass-shadow);
    border-color: var(--primary);
}

.suggestion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.suggestion-title {
    font-size: 1.2rem;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.suggestion-confidence {
    display: flex;
    align-items: center;
    gap: 12px;
}

.confidence-bar {
    width: 120px;
    height: 8px;
    background: var(--surface-light);
    border-radius: 4px;
    overflow: hidden;
}

.confidence-fill {
    height: 100%;
    background: linear-gradient(90deg, #10b981, #3b82f6);
    border-radius: 4px;
    transition: width 0.6s ease;
}

.confidence-value {
    font-weight: 600;
    color: var(--text);
    min-width: 40px;
}

.suggestion-body {
    margin-bottom: 20px;
}

.suggestion-reason {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.5;
}

.suggestion-files {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 16px 0;
}

.file-tag {
    background: rgba(59, 130, 246, 0.1);
    color: var(--primary);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.file-tag i {
    font-size: 0.8rem;
}

.suggestion-path {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 12px 0;
}

.suggestion-path i {
    color: var(--primary);
}

.suggestion-actions {
    display: flex;
    gap: 12px;
}

.btn-accept,
.btn-reject,
.btn-preview {
    flex: 1;
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
}

.btn-preview {
    background: var(--surface-light);
    color: var(--text);
    border: 1px solid var(--glass-border);
}

.btn-preview:hover {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--primary);
}

.btn-accept {
    background: linear-gradient(135deg, #10b981, #34d399);
    color: white;
}

.btn-accept:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-reject {
    background: linear-gradient(135deg, #ef4444, #f87171);
    color: white;
}

.btn-reject:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.learning-panel {
    background: var(--surface);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 24px;
}

.learning-panel h4 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
    color: var(--text);
}

.confidence-meters {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.confidence-meter {
    display: flex;
    align-items: center;
    gap: 12px;
}

.confidence-meter label {
    min-width: 120px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.confidence-meter .confidence-bar {
    flex: 1;
    height: 6px;
}

.confidence-meter .confidence-value {
    min-width: 30px;
    font-size: 0.9rem;
}

.learning-note {
    margin-top: 16px;
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* Robot Panel */
.robot-panel {
    background: var(--surface);
    border-left: 1px solid var(--glass-border);
    padding: 24px;
    display: flex;
    flex-direction: column;
}

.robot-container {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.robot-avatar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    margin-bottom: 32px;
}

.robot-status {
    background: var(--surface-light);
    color: var(--text-secondary);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.robot-speech {
    margin-bottom: 32px;
}

.robot-controls {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 32px;
}

.recent-actions {
    margin-top: auto;
}

.recent-actions h4 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    color: var(--text);
}

.actions-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.action-item {
    background: rgba(30, 41, 59, 0.5);
    padding: 12px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
}

.action-item i {
    color: var(--primary);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--surface);
    border-radius: 20px;
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    animation: modalIn 0.3s ease-out;
}

.modal-header {
    padding: 24px;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
}

.close-modal {
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: var(--transition);
}

.close-modal:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.modal-body {
    padding: 24px;
}

.preview-section {
    margin-bottom: 24px;
}

.preview-section h4 {
    margin-bottom: 12px;
    color: var(--text);
}

.file-move {
    background: rgba(30, 41, 59, 0.5);
    border-radius: 12px;
    padding: 16px;
    margin: 12px 0;
}

.move-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--glass-border);
}

.move-item:last-child {
    border-bottom: none;
}

.move-item i {
    color: var(--primary);
}

.robot-preview-message {
    display: flex;
    align-items: center;
    gap: 16px;
    background: rgba(59, 130, 246, 0.1);
    padding: 16px;
    border-radius: 12px;
    margin-top: 24px;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.robot-mini {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
}

.modal-footer {
    padding: 24px;
    border-top: 1px solid var(--glass-border);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--surface);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 16px 24px;
    box-shadow: var(--glass-shadow);
    transform: translateY(100px);
    opacity: 0;
    transition: var(--transition);
    z-index: 1001;
    max-width: 400px;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.success {
    border-left: 4px solid var(--success);
}

.toast.warning {
    border-left: 4px solid var(--warning);
}

.toast.error {
    border-left: 4px solid var(--danger);
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 64px 32px;
}

.empty-icon {
    font-size: 64px;
    color: var(--text-secondary);
    margin-bottom: 24px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 12px;
    color: var(--text);
}

.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

/* Loading States */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px;
    color: var(--text-secondary);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--glass-border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes blink {

    0%,
    90%,
    100% {
        transform: scaleY(1);
    }

    95% {
        transform: scaleY(0.1);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 0.5;
        transform: scale(1);
    }

    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

/* Robot States */
.glow-idle {
    box-shadow: 0 0 40px rgba(59, 130, 246, 0.3);
}

.glow-suggesting {
    box-shadow: 0 0 50px rgba(245, 158, 11, 0.4);
}

.glow-accepted {
    box-shadow: 0 0 50px rgba(16, 185, 129, 0.4);
}

.glow-rejected {
    box-shadow: 0 0 50px rgba(239, 68, 68, 0.4);
}

/* Responsive */
@media (max-width: 1200px) {
    .dashboard-container {
        grid-template-columns: 280px 1fr;
    }

    .robot-panel {
        grid-column: 1 / -1;
        border-left: none;
        border-top: 1px solid var(--glass-border);
    }
}

@media (max-width: 768px) {
    .dashboard-container {
        grid-template-columns: 1fr;
    }

    .sidebar {
        border-right: none;
        border-bottom: 1px solid var(--glass-border);
    }

    .top-nav {
        flex-direction: column;
        gap: 16px;
        padding: 16px;
    }

    .principles {
        grid-template-columns: 1fr;
    }

    .modal {
        max-height: 90vh;
    }
}

/* Typing animation */
.typing {
    display: inline-block;
    overflow: hidden;
    border-right: 2px solid var(--primary);
    white-space: nowrap;
    animation: typing 3.5s steps(40, end), blink-caret 0.75s step-end infinite;
}

@keyframes typing {
    from {
        width: 0
    }

    to {
        width: 100%
    }
}

@keyframes blink-caret {

    from,
    to {
        border-color: transparent
    }

    50% {
        border-color: var(--primary)
    }
}