@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

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

:root {
    /* Simplified Blue Tonality */
    --primary-blue: #2563eb;
    --primary-blue-light: #3b82f6;
    --primary-blue-lighter: #60a5fa;
    --primary-blue-dark: #1e40af;
    --primary-blue-darker: #1e3a8a;
    
    /* Category Colors (Purple) */
    --category-color: #9333ea;
    --category-light: #a855f7;
    --category-lighter: #c084fc;
    
    /* Task Colors (Green) */
    --task-color: #059669;
    --task-light: #10b981;
    --task-lighter: #34d399;
    
    /* Tool Colors (Orange) */
    --tool-color: #ea580c;
    --tool-light: #f97316;
    --tool-lighter: #fb923c;
    
    /* Neutral colors */
    --bg-primary: #f8fafc;
    --bg-secondary: #f1f5f9;
    --bg-tertiary: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-tertiary: #94a3b8;
    
    --card-bg: rgba(255, 255, 255, 0.95);
    --border-color: rgba(37, 99, 235, 0.1);
    --shadow-color: rgba(37, 99, 235, 0.08);
    
    /* Success and Error (minimal use) */
    --success: #10b981;
    --error: #ef4444;
}

[data-theme="dark"] {
    --primary-blue: #60a5fa;
    --primary-blue-light: #93c5fd;
    --primary-blue-lighter: #bfdbfe;
    --primary-blue-dark: #3b82f6;
    --primary-blue-darker: #2563eb;
    
    /* Category Colors (Purple) - Dark Mode */
    --category-color: #c084fc;
    --category-light: #d8b4fe;
    --category-lighter: #e9d5ff;
    
    /* Task Colors (Green) - Dark Mode */
    --task-color: #34d399;
    --task-light: #6ee7b7;
    --task-lighter: #a7f3d0;
    
    /* Tool Colors (Orange) - Dark Mode */
    --tool-color: #fb923c;
    --tool-light: #fdba74;
    --tool-lighter: #fed7aa;
    
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-tertiary: #94a3b8;
    
    --card-bg: rgba(30, 41, 59, 0.95);
    --border-color: rgba(96, 165, 250, 0.2);
    --shadow-color: rgba(0, 0, 0, 0.3);
}

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 50%, var(--bg-tertiary) 100%);
    color: var(--text-primary);
    transition: all 0.3s ease;
    min-height: 100vh;
}

/* ========================================
   LOGIN PAGE STYLES
======================================== */

.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 50%, rgba(37, 99, 235, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(59, 130, 246, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 40% 80%, rgba(37, 99, 235, 0.08) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.login-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 500px;
}

.login-card {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 40px;
    box-shadow: 0 20px 60px var(--shadow-color);
    border: 1px solid var(--border-color);
    animation: slideUp 0.5s ease;
}

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

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin-bottom: 16px;
    object-fit: cover;
    border: 3px solid var(--primary-blue);
    box-shadow: 0 4px 20px rgba(37, 99, 235, 0.2);
}

.login-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-blue);
    margin-bottom: 8px;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
}

.form-group input[type="email"],
.form-group input[type="password"] {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 15px;
    font-family: inherit;
    transition: all 0.3s ease;
}

.form-group input[type="email"]:focus,
.form-group input[type="password"]:focus {
    outline: none;
    border-color: var(--primary-blue);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group small {
    color: var(--text-tertiary);
    font-size: 12px;
}

.form-group small a {
    color: var(--primary-blue);
    text-decoration: none;
    font-weight: 500;
}

.form-group small a:hover {
    text-decoration: underline;
}

.provider-group {
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: 12px;
}

.provider-options {
    display: flex;
    gap: 16px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary);
}

.radio-label input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary-blue);
}

.checkbox-group {
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: 12px;
}

.checkbox-label {
    display: flex;
    gap: 12px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-top: 2px;
    accent-color: var(--primary-blue);
    flex-shrink: 0;
}

.checkbox-label a {
    color: var(--primary-blue);
    text-decoration: none;
    font-weight: 500;
}

.checkbox-label a:hover {
    text-decoration: underline;
}

.btn-login {
    width: 100%;
    padding: 16px 24px;
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-blue-dark) 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(37, 99, 235, 0.3);
    margin-top: 8px;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(37, 99, 235, 0.4);
}

.btn-login:active {
    transform: translateY(0);
}

.btn-login span {
    margin-right: 8px;
}

.login-footer {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.login-footer p {
    font-size: 12px;
    color: var(--text-tertiary);
    line-height: 1.6;
}

/* ========================================
   MODAL STYLES
======================================== */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 20px;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 60px var(--shadow-color);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    color: var(--primary-blue);
    font-size: 22px;
    font-weight: 700;
}

.btn-close {
    background: none;
    border: none;
    color: var(--text-tertiary);
    font-size: 28px;
    cursor: pointer;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.btn-close:hover {
    background: rgba(239, 68, 68, 0.1);
    color: var(--error);
}

.modal-body {
    padding: 24px;
}

.modal-body h3 {
    color: var(--text-primary);
    font-size: 16px;
    margin-bottom: 12px;
    margin-top: 20px;
}

.modal-body h3:first-child {
    margin-top: 0;
}

.modal-body p {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 12px;
}

.modal-body ul {
    margin-left: 20px;
    margin-bottom: 12px;
}

.modal-body li {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 8px;
}

.modal-body a {
    color: var(--primary-blue);
    text-decoration: none;
    font-weight: 500;
}

.modal-body a:hover {
    text-decoration: underline;
}

.modal-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
}

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

.btn-secondary {
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--text-tertiary) 100%);
    box-shadow: 0 4px 15px rgba(148, 163, 184, 0.3);
}

.btn-secondary:hover {
    box-shadow: 0 8px 25px rgba(148, 163, 184, 0.4);
}

.btn-primary {
    padding: 12px 24px;
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-blue-dark) 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
}

/* ========================================
   APP PAGE STYLES
======================================== */

body:not(.login-page) {
    overflow: hidden;
    height: 100vh;
    position: relative;
}

body:not(.login-page)::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(circle at 20% 50%, rgba(37, 99, 235, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(59, 130, 246, 0.12) 0%, transparent 50%);
    pointer-events: none;
}

#canvas {
    width: 100%;
    height: 100%;
    cursor: grab;
}

#canvas:active {
    cursor: grabbing;
}

/* Control Panels */
.controls {
    position: fixed;
    top: 90px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 1000;
    max-width: 220px;
}

.control-section {
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    border-radius: 16px;
    padding: 16px;
    border: 1px solid var(--border-color);
    box-shadow: 0 8px 32px var(--shadow-color);
}

.info-panel {
    position: fixed;
    top: 90px;
    left: 20px;
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    padding: 20px;
    border-radius: 16px;
    color: var(--text-primary);
    font-size: 0.85em;
    box-shadow: 0 8px 32px var(--shadow-color);
    border: 1px solid var(--border-color);
    max-width: 280px;
    z-index: 900;
    max-height: 300px;
    overflow-y: auto;
}

.brand-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.brand-logo {
    height: 40px;
    width: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.info-panel h2 {
    font-size: 1.3em;
    margin: 0;
    color: var(--primary-blue);
    font-weight: 700;
}

.info-panel p {
    font-size: 0.9em;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 8px;
}

.info-panel strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Stats and Legend */
.stats {
    position: fixed;
    bottom: 110px;
    right: 20px;
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    padding: 14px 18px;
    border-radius: 16px;
    color: var(--text-primary);
    font-size: 0.75em;
    box-shadow: 0 8px 32px var(--shadow-color);
    border: 1px solid var(--border-color);
    z-index: 850;
    min-width: 120px;
}

.legend {
    position: fixed;
    bottom: 110px;
    left: 20px;
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    padding: 14px 18px;
    border-radius: 16px;
    color: var(--text-primary);
    display: flex;
    gap: 16px;
    box-shadow: 0 8px 32px var(--shadow-color);
    border: 1px solid var(--border-color);
    z-index: 850;
    font-size: 0.75em;
    flex-wrap: wrap;
    max-width: 280px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
    font-weight: 500;
    padding: 6px 10px;
    border-radius: 8px;
    background: rgba(37, 99, 235, 0.05);
    transition: all 0.3s ease;
}

.legend-item:hover {
    background: rgba(37, 99, 235, 0.1);
    transform: translateY(-2px);
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    box-shadow: 0 0 8px currentColor;
}

/* Buttons */
.btn {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-blue-dark) 100%);
    backdrop-filter: blur(10px);
    color: white;
    border: none;
    padding: 12px 18px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.4);
}

.btn:active {
    transform: translateY(0);
}

.btn-danger {
    background: linear-gradient(135deg, var(--error) 0%, #dc2626 100%);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    box-shadow: 0 8px 25px rgba(239, 68, 68, 0.4);
}

/* AI Assistant Bar */
.ai-assistant-bar {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 800px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--card-bg);
    backdrop-filter: blur(25px);
    border: 2px solid var(--primary-blue);
    border-radius: 25px;
    padding: 8px 16px;
    box-shadow: 0 12px 40px var(--shadow-color);
    z-index: 1500;
    transition: all 0.3s ease;
}

.ai-assistant-bar:hover {
    box-shadow: 0 16px 50px var(--shadow-color);
    transform: translateX(-50%) translateY(-2px);
}

.ai-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-blue-light));
    border-radius: 50%;
    color: white;
    font-size: 18px;
    flex-shrink: 0;
}

.ai-textarea {
    flex: 1;
    height: 40px;
    border: none;
    background: transparent;
    color: var(--text-primary);
    padding: 0 15px;
    font-size: 16px;
    font-family: inherit;
    resize: none;
    outline: none;
    overflow: hidden;
}

.ai-textarea::placeholder {
    color: var(--text-tertiary);
}

.ai-send-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-blue-light));
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.ai-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.4);
}

.ai-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Theme Toggle */
.theme-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.theme-switch {
    position: relative;
    width: 50px;
    height: 24px;
    background: var(--bg-tertiary);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.theme-switch::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

[data-theme="dark"] .theme-switch {
    background: var(--primary-blue);
}

[data-theme="dark"] .theme-switch::before {
    transform: translateX(26px);
}

/* Notification System */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 16px 20px;
    border-radius: 12px;
    color: white;
    font-weight: 500;
    z-index: 9999;
    transform: translateX(400px);
    transition: all 0.3s ease;
    max-width: 300px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.notification.show {
    transform: translateX(0);
}

.notification.success {
    background: linear-gradient(135deg, var(--success), #059669);
}

.notification.error {
    background: linear-gradient(135deg, var(--error), #dc2626);
}

.notification.info {
    background: linear-gradient(135deg, var(--primary-blue), var(--primary-blue-dark));
}

/* Tooltip */
.tooltip {
    position: fixed;
    background: rgba(15, 23, 42, 0.98);
    color: white;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 13px;
    pointer-events: none;
    z-index: 10000;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(96, 165, 250, 0.2);
    max-width: 250px;
}

/* Top Bar */
.top-bar {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--card-bg);
    backdrop-filter: blur(20px);
    padding: 12px 24px;
    border-radius: 50px;
    border: 1px solid var(--border-color);
    z-index: 1001;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 8px 32px var(--shadow-color);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-secondary);
    font-size: 14px;
}

.user-email {
    color: var(--primary-blue);
    font-weight: 600;
}

/* Responsive Design */
@media (max-width: 768px) {
    .login-card {
        padding: 30px 20px;
    }

    .login-logo {
        width: 60px;
        height: 60px;
    }

    .controls,
    .info-panel,
    .stats,
    .legend {
        max-width: 200px;
        font-size: 0.7em;
    }

    .ai-assistant-bar {
        width: 95%;
        max-width: none;
    }

    .modal-content {
        width: 95%;
        max-width: none;
    }
}
