/* Founder Growth Engine - Styles */

:root {
    --primary: #4f46e5;
    --primary-light: #6366f1;
    --primary-dark: #4338ca;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --white: #ffffff;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius: 8px;
    --radius-lg: 12px;
    --sidebar-width: 260px;
    --header-height: 64px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--gray-50);
    color: var(--gray-800);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.app-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--white);
    border-right: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: transform 0.3s ease;
}

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

.brand-icon {
    width: 36px;
    height: 36px;
    background: var(--primary);
    color: var(--white);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
}

.brand-text {
    font-weight: 600;
    font-size: 16px;
    color: var(--gray-900);
}

.sidebar-nav {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: var(--radius);
    color: var(--gray-600);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.nav-item:hover {
    background: var(--gray-50);
    color: var(--gray-900);
}

.nav-item.active {
    background: var(--primary);
    color: var(--white);
}

.nav-item svg {
    flex-shrink: 0;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
}

/* Header */
.top-header {
    height: var(--header-height);
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-600);
    padding: 8px;
    border-radius: var(--radius);
}

.menu-toggle:hover {
    background: var(--gray-100);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-left: auto;
}

.user-selector select {
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    background: var(--white);
    font-size: 14px;
    color: var(--gray-700);
    cursor: pointer;
    min-width: 180px;
}

.current-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
}

.user-name {
    font-weight: 500;
    font-size: 14px;
    color: var(--gray-700);
}

/* Page Content */
.page-content {
    padding: 32px;
    flex: 1;
}

.page {
    display: none;
    animation: fadeIn 0.3s ease;
}

.page.active {
    display: block;
}

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

.page-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 24px;
}

/* Cards */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.summary-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-100);
    transition: box-shadow 0.2s ease;
}

.summary-card:hover {
    box-shadow: var(--shadow-md);
}

.summary-card.success {
    border-left: 4px solid var(--success);
}

.summary-card.warning {
    border-left: 4px solid var(--warning);
}

.summary-card.info {
    border-left: 4px solid var(--info);
}

.card-label {
    font-size: 13px;
    color: var(--gray-500);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.card-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--gray-900);
}

/* Charts */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
    gap: 24px;
}

.chart-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-100);
}

.chart-card h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 16px;
}

.chart-card canvas {
    max-height: 280px;
}

/* Forms */
.form-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-100);
    margin-bottom: 24px;
}

.form-card h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 20px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

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

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-600);
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 10px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--gray-800);
    background: var(--white);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
    font-family: inherit;
}

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

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

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

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

.btn-success:hover {
    background: #059669;
}

/* Tables */
.table-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-100);
}

.table-card h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 20px;
}

.table-responsive {
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table th {
    text-align: left;
    padding: 12px;
    font-weight: 600;
    color: var(--gray-600);
    border-bottom: 1px solid var(--gray-200);
    white-space: nowrap;
}

.data-table td {
    padding: 12px;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
}

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

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 500;
}

.badge-pending {
    background: #fef3c7;
    color: #92400e;
}

.badge-done {
    background: #d1fae5;
    color: #065f46;
}

.badge-high {
    background: #fee2e2;
    color: #991b1b;
}

.badge-medium {
    background: #fef3c7;
    color: #92400e;
}

.badge-low {
    background: #dbeafe;
    color: #1e40af;
}

.badge-urgent {
    background: #fee2e2;
    color: #991b1b;
    animation: pulse 2s infinite;
}

.badge-draft {
    background: #f3f4f6;
    color: #4b5563;
}

.badge-scheduled {
    background: #dbeafe;
    color: #1e40af;
}

.badge-published {
    background: #d1fae5;
    color: #065f46;
}

.badge-tier-1 {
    background: #fef3c7;
    color: #92400e;
    font-weight: 600;
}

.badge-tier-2 {
    background: #dbeafe;
    color: #1e40af;
}

.badge-tier-3 {
    background: #fce7f3;
    color: #9d174d;
}

.badge-other {
    background: #f3f4f6;
    color: #4b5563;
}

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

/* OKR */
.okr-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.okr-item {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-100);
}

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

.okr-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-900);
}

.okr-meta {
    font-size: 13px;
    color: var(--gray-500);
    margin-top: 4px;
}

.kr-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.kr-item {
    display: grid;
    grid-template-columns: 1fr auto auto auto auto;
    gap: 16px;
    align-items: center;
    padding: 12px;
    background: var(--gray-50);
    border-radius: var(--radius);
}

.kr-desc {
    font-size: 14px;
    color: var(--gray-700);
}

.kr-values {
    font-size: 13px;
    color: var(--gray-500);
    white-space: nowrap;
}

.kr-progress {
    width: 120px;
}

.progress-bar {
    height: 8px;
    background: var(--gray-200);
    border-radius: 9999px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 9999px;
    transition: width 0.5s ease;
}

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

.progress-fill.off-track {
    background: var(--danger);
}

.kr-weight {
    font-size: 13px;
    color: var(--gray-500);
}

.kr-status {
    font-size: 12px;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 4px;
}

.kr-status.on-track {
    background: #d1fae5;
    color: #065f46;
}

.kr-status.at-risk {
    background: #fef3c7;
    color: #92400e;
}

.kr-status.off-track {
    background: #fee2e2;
    color: #991b1b;
}

/* Knowledge Base */
.knowledge-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-100);
    transition: box-shadow 0.2s ease;
}

.knowledge-card:hover {
    box-shadow: var(--shadow-md);
}

.knowledge-card h4 {
    font-size: 15px;
    font-weight: 600;
    color: var(--gray-900);
    margin-bottom: 8px;
}

.knowledge-card .category {
    display: inline-block;
    font-size: 12px;
    font-weight: 500;
    color: var(--primary);
    background: #eef2ff;
    padding: 4px 10px;
    border-radius: 9999px;
    margin-bottom: 10px;
}

.knowledge-card p {
    font-size: 13px;
    color: var(--gray-600);
    margin-bottom: 12px;
    line-height: 1.5;
}

.knowledge-card a {
    font-size: 13px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.knowledge-card a:hover {
    text-decoration: underline;
}

/* Notes */
.split-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 24px;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-100);
    overflow: hidden;
    min-height: 600px;
}

.notes-sidebar {
    padding: 20px;
    border-right: 1px solid var(--gray-200);
    background: var(--gray-50);
    overflow-y: auto;
}

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

.note-item {
    padding: 12px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.2s ease;
    border-left: 3px solid transparent;
}

.note-item:hover {
    background: var(--gray-100);
}

.note-item.active {
    background: var(--white);
    border-left-color: var(--primary);
    box-shadow: var(--shadow-sm);
}

.note-item-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-800);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.note-item-meta {
    font-size: 12px;
    color: var(--gray-500);
}

.notes-editor {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.editor-header {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.editor-header input {
    font-size: 20px;
    font-weight: 600;
    border: none;
    outline: none;
    color: var(--gray-900);
    background: transparent;
    padding: 0;
}

.editor-meta {
    font-size: 13px;
    color: var(--gray-500);
}

#noteContent {
    flex: 1;
    resize: none;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 16px;
    font-size: 15px;
    line-height: 1.6;
    color: var(--gray-700);
    background: var(--white);
    font-family: inherit;
    min-height: 400px;
}

#noteContent:focus {
    outline: none;
    border-color: var(--primary);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--white);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

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

.modal-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--gray-900);
}

.modal-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--gray-500);
    cursor: pointer;
    line-height: 1;
}

.modal-close:hover {
    color: var(--gray-800);
}

.modal form {
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

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

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

.section-header h2 {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-800);
}

.filters {
    margin-bottom: 16px;
}

.filters select {
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 14px;
    background: var(--white);
}

/* Utility */
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }

/* Responsive */
@media (max-width: 1024px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
    
    .split-layout {
        grid-template-columns: 1fr;
    }
    
    .notes-sidebar {
        border-right: none;
        border-bottom: 1px solid var(--gray-200);
        max-height: 300px;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .menu-toggle {
        display: block;
    }
    
    .page-content {
        padding: 20px;
    }
    
    .cards-grid {
        grid-template-columns: 1fr;
    }
    
    .charts-grid {
        grid-template-columns: 1fr;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .header-right {
        gap: 12px;
    }
    
    .user-label {
        display: none;
    }
    
    .kr-item {
        grid-template-columns: 1fr;
        gap: 8px;
    }
}

/* Loader */
.loader-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Empty state */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray-400);
    font-size: 14px;
}

/* Toast notification */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 12px 20px;
    border-radius: var(--radius);
    background: var(--gray-900);
    color: var(--white);
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    z-index: 300;
    animation: slideUp 0.3s ease;
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

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

/* Date Filter Bar */
.date-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-bottom: 24px;
    padding: 16px 20px;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-100);
}

.filter-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-group .btn {
    background: var(--gray-100);
    color: var(--gray-600);
}

.filter-group .btn.active {
    background: var(--primary);
    color: var(--white);
}

.custom-range {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.custom-range input {
    padding: 8px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--gray-700);
}

.custom-range span {
    font-size: 13px;
    color: var(--gray-500);
}

/* View Toggle */
.view-toggle {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.view-toggle .btn {
    background: var(--gray-100);
    color: var(--gray-600);
}

.view-toggle .btn.active {
    background: var(--primary);
    color: var(--white);
}

/* Calendar */
.calendar-container {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--gray-100);
}

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

.calendar-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--gray-800);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
}

.calendar-day-label {
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-500);
    text-transform: uppercase;
    padding: 8px 0;
}

.calendar-day {
    min-height: 100px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: var(--white);
}

.calendar-day:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
}

.calendar-day.empty {
    background: var(--gray-50);
    border-color: transparent;
    cursor: default;
}

.calendar-day.empty:hover {
    box-shadow: none;
    border-color: transparent;
}

.calendar-day.today {
    border-color: var(--primary);
    background: #eef2ff;
}

.calendar-day-number {
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.calendar-day.today .calendar-day-number {
    color: var(--primary);
}

.calendar-event {
    font-size: 11px;
    padding: 3px 6px;
    border-radius: 4px;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.calendar-event.draft {
    background: #f3f4f6;
    color: #4b5563;
}

.calendar-event.scheduled {
    background: #dbeafe;
    color: #1e40af;
}

.calendar-event.published {
    background: #d1fae5;
    color: #065f46;
}

/* Content Detail Modal */
.content-detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.content-detail-meta .meta-item {
    font-size: 13px;
    color: var(--gray-600);
    background: var(--gray-50);
    padding: 6px 12px;
    border-radius: var(--radius);
}

.content-detail-meta .meta-item strong {
    color: var(--gray-800);
}

.content-detail-links {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
}

.content-detail-links a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: var(--radius);
    background: #eef2ff;
    color: var(--primary);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s ease;
}

.content-detail-links a:hover {
    background: #e0e7ff;
}

.content-detail-links a.secondary {
    background: var(--gray-50);
    color: var(--gray-600);
}

.content-detail-links a.secondary:hover {
    background: var(--gray-100);
}
