/* Datalens Bygg - Shared Styles (v2 - Simplified) */

:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-500: #6b7280;
    --gray-700: #374151;
    --gray-900: #111827;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--gray-50);
    color: var(--gray-900);
    line-height: 1.5;
}

/* Global Navigation (simple) */
.nav-global {
    background: white;
    border-bottom: 1px solid var(--gray-200);
    padding: 0 2rem;
    height: 56px;
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-logo {
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--primary);
    text-decoration: none;
}

.nav-global-links {
    display: flex;
    gap: 0.5rem;
    margin-left: 2rem;
    list-style: none;
}

.nav-global-links a {
    padding: 0.5rem 1rem;
    color: var(--gray-600);
    text-decoration: none;
    border-radius: 0.375rem;
    font-size: 0.9rem;
}

.nav-global-links a:hover { background: var(--gray-100); }
.nav-global-links a.active { background: var(--gray-100); color: var(--gray-900); font-weight: 500; }

.nav-spacer { flex: 1; }

.nav-user {
    font-size: 0.85rem;
    color: var(--gray-500);
}

.nav-powered-by {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--gray-400);
}

.nav-powered-by img {
    height: 1.5rem;
    max-width: 100px;
}

/* Project Navigation (when inside a project) */
.nav-project {
    background: var(--primary);
    color: white;
    padding: 0 2rem;
    height: 48px;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-back {
    color: white;
    opacity: 0.7;
    text-decoration: none;
    font-size: 0.9rem;
}

.nav-back:hover { opacity: 1; }

.nav-project-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.nav-project-phase {
    background: rgba(255,255,255,0.2);
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.8rem;
}

/* Project Tabs */
.project-tabs {
    background: white;
    border-bottom: 1px solid var(--gray-200);
    padding: 0 2rem;
    display: flex;
    gap: 0;
}

.project-tab {
    padding: 1rem 1.5rem;
    color: var(--gray-500);
    text-decoration: none;
    font-size: 0.9rem;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.project-tab:hover { color: var(--gray-700); }
.project-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 500;
}

/* Main Content */
.main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.main.with-drawer {
    margin-right: 400px;
    transition: margin-right 0.3s;
}

.main.drawer-closed {
    margin-right: 0;
}

/* Phase Banner */
.phase-banner {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 0.5rem;
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.phase-stepper {
    display: flex;
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
}

.phase-step {
    flex: 1;
    display: flex;
    align-items: center;
    padding: 0.875rem 1.25rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--gray-400);
    position: relative;
    background: var(--gray-100);
}

.phase-step::after {
    content: '';
    position: absolute;
    right: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 24px solid transparent;
    border-bottom: 24px solid transparent;
    border-left: 12px solid var(--gray-100);
    z-index: 2;
}

.phase-step::before {
    content: '';
    position: absolute;
    right: -14px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-top: 26px solid transparent;
    border-bottom: 26px solid transparent;
    border-left: 14px solid var(--gray-200);
    z-index: 1;
}

.phase-step:last-child::after,
.phase-step:last-child::before {
    display: none;
}

.phase-step.completed {
    background: #dbeafe;
    color: var(--primary);
}

.phase-step.completed::after {
    border-left-color: #dbeafe;
}

.phase-step.active {
    background: var(--primary);
    color: white;
}

.phase-step.active::after {
    border-left-color: var(--primary);
}

.phase-step .step-icon {
    margin-right: 0.5rem;
    font-size: 0.9rem;
}

.phase-content {
    padding: 1.5rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.phase-info h1 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.phase-info p {
    color: var(--gray-500);
    font-size: 0.9rem;
}

.phase-progress {
    text-align: right;
}

.phase-progress-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary);
}

.phase-progress-label {
    font-size: 0.85rem;
    color: var(--gray-500);
}

/* Cards */
.card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 0.5rem;
}

.card-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-body { padding: 1.5rem; }

/* Simple list */
.simple-list {
    list-style: none;
}

.simple-list-item {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
}

.simple-list-item:last-child { border-bottom: none; }
.simple-list-item:hover { background: var(--gray-50); }

.simple-list-item .status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.simple-list-item .status.green { background: var(--success); }
.simple-list-item .status.yellow { background: var(--warning); }
.simple-list-item .status.red { background: var(--danger); }
.simple-list-item .status.gray { background: var(--gray-300); }

.simple-list-item .badge { min-width: 100px; text-align: center; }
.simple-list-item .content { flex: 1; }
.simple-list-item .title { font-weight: 500; font-size: 0.95rem; }
.simple-list-item .meta { font-size: 0.85rem; color: var(--gray-500); }
.simple-list-item .arrow { color: var(--gray-400); }

/* Project cards */
.project-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
}

.project-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: 0.5rem;
    padding: 1.25rem;
    text-decoration: none;
    color: inherit;
    transition: all 0.15s;
}

.project-card:hover {
    border-color: var(--primary);
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.project-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.project-card-name {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.project-card-location {
    font-size: 0.85rem;
    color: var(--gray-500);
}

.project-card-stats {
    display: flex;
    gap: 1.5rem;
    font-size: 0.85rem;
}

.project-card-stat span {
    color: var(--gray-500);
}

/* Badges */
.badge {
    display: inline-block;
    padding: 0.25rem 0.625rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge.blue { background: #dbeafe; color: #1e40af; }
.badge.yellow { background: #fef3c7; color: #92400e; }
.badge.green { background: #d1fae5; color: #065f46; }
.badge.gray { background: var(--gray-100); color: var(--gray-600); }

/* Progress bar */
.progress {
    height: 6px;
    background: var(--gray-200);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 3px;
}

.progress-fill.success { background: var(--success); }
.progress-fill.warning { background: var(--warning); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    text-decoration: none;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: white; border: 1px solid var(--gray-300); color: var(--gray-700); }
.btn-secondary:hover { background: var(--gray-50); }

/* AI Drawer */
.ai-toggle-wrapper {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 200;
    transition: right 0.3s;
}

.ai-toggle-wrapper.drawer-open {
    right: 416px;
}

.ai-toggle {
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    background: white url('../images/datalens_new-1024x358_cropped.png') no-repeat center center;
    background-size: 70%;
    border: 2px solid var(--gray-200);
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: transform 0.15s;
    flex-shrink: 0;
}

.ai-toggle:hover { transform: scale(1.05); border-color: var(--primary); }

.ai-icon {
    display: inline-block;
    width: 1.25rem;
    height: 1.25rem;
    background: url('../images/datalens_new-1024x358_cropped.png') no-repeat center center;
    background-size: contain;
    flex-shrink: 0;
}

.ai-drawer {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: white;
    border-left: 1px solid var(--gray-200);
    z-index: 150;
    display: flex;
    flex-direction: column;
    transition: right 0.3s;
}

.ai-drawer.open { right: 0; }

.ai-drawer-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ai-drawer-title {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.ai-drawer-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    cursor: pointer;
    color: var(--gray-500);
}

.ai-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.ai-message {
    margin-bottom: 1rem;
}

.ai-message.assistant {
    background: var(--gray-100);
    padding: 1rem;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    line-height: 1.6;
}

.ai-message.user {
    background: var(--primary);
    color: white;
    padding: 1rem;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    margin-left: 2rem;
}

.ai-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.ai-suggestion {
    background: white;
    border: 1px solid var(--gray-200);
    padding: 0.375rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.8rem;
    cursor: pointer;
}

.ai-suggestion:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.ai-drawer-input {
    padding: 1rem;
    border-top: 1px solid var(--gray-200);
    display: flex;
    gap: 0.5rem;
}

.ai-drawer-input input {
    flex: 1;
    border: 1px solid var(--gray-200);
    border-radius: 1.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    outline: none;
}

.ai-drawer-input input:focus { border-color: var(--primary); }

.ai-drawer-input button {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    border: none;
    cursor: pointer;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    text-align: left;
    padding: 0.75rem 1rem;
    font-weight: 500;
    font-size: 0.8rem;
    color: var(--gray-500);
    border-bottom: 1px solid var(--gray-200);
}

.table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--gray-100);
    font-size: 0.9rem;
}

.table tr:hover td { background: var(--gray-50); }

/* Utilities */
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.text-muted { color: var(--gray-500); }
.text-sm { font-size: 0.875rem; }
.text-right { text-align: right; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.font-medium { font-weight: 500; }
