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

:root {
    --bg-dark: #08090d;
    --bg-gradient: radial-gradient(circle at top right, #1a162b, #08090d 60%);
    --panel-bg: rgba(18, 20, 32, 0.65);
    --panel-border: rgba(255, 255, 255, 0.08);
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    --primary: #8a2be2;
    --primary-glow: rgba(138, 43, 226, 0.4);
    --primary-gradient: linear-gradient(135deg, #a855f7, #7c3aed);
    
    --success: #10b981;
    --success-glow: rgba(16, 185, 129, 0.2);
    --warning: #f59e0b;
    --warning-glow: rgba(245, 158, 11, 0.2);
    --danger: #ef4444;
    --danger-glow: rgba(239, 68, 68, 0.2);
    --info: #3b82f6;
    --info-glow: rgba(59, 130, 246, 0.2);
    
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Outfit', 'Sarabun', sans-serif;
    background: var(--bg-dark);
    background-image: var(--bg-gradient);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Glassmorphism Card Utilities */
.glass-card {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    transition: var(--transition);
}

.glass-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 12px 40px 0 rgba(138, 43, 226, 0.1);
}

/* Sidebar Styling */
.sidebar {
    width: 260px;
    height: 100vh;
    background: rgba(10, 11, 18, 0.8);
    border-right: 1px solid var(--panel-border);
    backdrop-filter: blur(20px);
    position: fixed;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
    padding: 30px 20px;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 40px;
    padding-left: 10px;
}

.logo-image {
    width: 60px;
    height: 60px;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.logo-icon {
    width: 38px;
    height: 38px;
    background: var(--primary-gradient);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: 0 0 15px var(--primary-glow);
}

.logo-text {
    font-weight: 700;
    font-size: 20px;
    background: linear-gradient(to right, #ffffff, #a855f7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-grow: 1;
}

.nav-item a {
    display: flex;
    align-items: center;
    gap: 15px;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 15px;
    transition: var(--transition);
    cursor: pointer;
}

.nav-item a i {
    font-size: 18px;
    width: 20px;
    text-align: center;
}

.nav-item.active a, .nav-item a:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.05);
}

.nav-item.active a {
    background: var(--primary-gradient);
    box-shadow: 0 4px 15px var(--primary-glow);
}

/* User Profile & Role Switcher in Sidebar */
.user-panel {
    border-top: 1px solid var(--panel-border);
    padding-top: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-avatar {
    width: 42px;
    height: 42px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--panel-border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.user-details {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    font-size: 14px;
    color: #ffffff;
}

.user-role {
    font-size: 12px;
    color: var(--text-secondary);
}

.role-select {
    width: 100%;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 13px;
    outline: none;
    cursor: pointer;
    transition: var(--transition);
}

.role-select:focus {
    border-color: var(--primary);
}

/* Main Content Area */
.main-wrapper {
    margin-left: 260px;
    width: calc(100% - 260px);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    height: 80px;
    border-bottom: 1px solid var(--panel-border);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 40px;
    position: sticky;
    top: 0;
    z-index: 90;
}

.page-title-container h1 {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.project-selector {
    padding: 10px 16px;
    background: rgba(25, 28, 41, 0.85);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    outline: none;
    cursor: pointer;
    font-weight: 500;
    transition: var(--transition);
}

.project-selector:focus, .project-selector:hover {
    border-color: var(--primary);
    background: rgba(25, 28, 41, 0.95);
    box-shadow: 0 0 10px rgba(138, 43, 226, 0.25);
}

.project-selector option {
    background: #0f111a;
    color: #ffffff;
}

.notification-bell {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--panel-border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.notification-bell:hover {
    background: rgba(255, 255, 255, 0.1);
}

.notification-dot {
    position: absolute;
    top: 10px;
    right: 11px;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--danger);
}

/* Views Wrapper */
.content-body {
    padding: 40px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 30px;
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
}

/* KPI Cards Layout */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
}

.kpi-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.kpi-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.kpi-label {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.kpi-value {
    font-size: 26px;
    font-weight: 700;
    color: #ffffff;
}

.kpi-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.kpi-icon.primary { background: rgba(138, 43, 226, 0.15); color: #a855f7; border: 1px solid rgba(138, 43, 226, 0.3); }
.kpi-icon.success { background: rgba(16, 185, 129, 0.15); color: #10b981; border: 1px solid rgba(16, 185, 129, 0.3); }
.kpi-icon.warning { background: rgba(245, 158, 11, 0.15); color: #f59e0b; border: 1px solid rgba(245, 158, 11, 0.3); }
.kpi-icon.info { background: rgba(59, 130, 246, 0.15); color: #3b82f6; border: 1px solid rgba(59, 130, 246, 0.3); }

/* Dashboard Sections Layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 25px;
}

@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

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

.section-title {
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn {
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    border: none;
    outline: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: var(--transition);
}

.btn-primary {
    background: var(--primary-gradient);
    color: #ffffff;
    box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px var(--primary-glow);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    border: 1px solid var(--panel-border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
}

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

/* Kanban Board Styling */
.kanban-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    align-items: start;
}

@media (max-width: 1150px) {
    .kanban-board {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 650px) {
    .kanban-board {
        grid-template-columns: 1fr;
    }
}

.kanban-column {
    background: rgba(10, 11, 18, 0.4);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-md);
    padding: 16px;
    min-height: 500px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.kanban-column-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 10px;
    border-bottom: 2px solid rgba(255, 255, 255, 0.05);
}

.column-title {
    font-weight: 600;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.column-count {
    background: rgba(255, 255, 255, 0.08);
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.kanban-tasks-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex-grow: 1;
    min-height: 400px;
}

.task-card {
    background: rgba(25, 28, 41, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-sm);
    padding: 16px;
    cursor: grab;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    overflow: hidden;
}

.task-card:active {
    cursor: grabbing;
}

.task-card:hover {
    transform: translateY(-3px);
    border-color: rgba(138, 43, 226, 0.3);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.task-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
}

.task-title {
    font-weight: 600;
    font-size: 14px;
    line-height: 1.4;
    color: #ffffff;
}

.badge {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-todo { background: rgba(59, 130, 246, 0.15); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.2); }
.badge-progress { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.2); }
.badge-qa { background: rgba(168, 85, 247, 0.15); color: #c084fc; border: 1px solid rgba(168, 85, 247, 0.2); }
.badge-completed { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.2); }

.task-desc {
    font-size: 12px;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.5;
}

.task-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 10px;
    font-size: 12px;
}

.task-date {
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 5px;
}

.task-date.overdue {
    color: var(--danger);
    font-weight: 600;
}

.task-assignee {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.task-progress-mini {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    height: 4px;
    border-radius: 2px;
    overflow: hidden;
}

.task-progress-bar {
    height: 100%;
    background: var(--success);
    transition: width 0.3s ease;
}

/* Gantt Chart Custom Rendering */
.gantt-container {
    overflow-x: auto;
}

.gantt-chart {
    min-width: 800px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.gantt-header {
    display: grid;
    grid-template-columns: 240px 1fr;
    border-bottom: 2px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 10px;
    font-weight: 600;
    font-size: 14px;
    color: var(--text-secondary);
}

.gantt-grid-days {
    display: grid;
    grid-template-columns: repeat(14, 1fr);
    text-align: center;
}

.gantt-row {
    display: grid;
    grid-template-columns: 240px 1fr;
    align-items: center;
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-sm);
    padding: 12px 0;
    transition: var(--transition);
}

.gantt-row:hover {
    background: rgba(255, 255, 255, 0.04);
}

.gantt-task-info {
    padding-left: 15px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.gantt-task-name {
    font-weight: 600;
    font-size: 14px;
    color: #ffffff;
}

.gantt-task-meta {
    font-size: 12px;
    color: var(--text-muted);
}

.gantt-timeline-track {
    position: relative;
    height: 24px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    margin: 0 10px;
}

.gantt-bar {
    position: absolute;
    height: 100%;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: var(--transition);
}

.gantt-bar:hover {
    filter: brightness(1.2);
    transform: scaleY(1.1);
}

/* Modals glassmorphic styling */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 5, 8, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-backdrop.active {
    opacity: 1;
    pointer-events: all;
}

.modal-container {
    width: 600px;
    max-width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    background: #0f111a;
    color: #f3f4f6;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    border-radius: var(--radius-lg);
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.modal-backdrop.active .modal-container {
    transform: translateY(0);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
    color: #ffffff;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    transition: var(--transition);
}

.modal-close:hover {
    color: #ffffff;
}

.modal-body {
    padding: 30px;
}

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

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

.form-control {
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-sm);
    color: #f3f4f6;
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.07);
}

/* Fix dropdown options visibility on dark background */
select.form-control option {
    background: #0f111a;
    color: #ffffff;
}

/* Fix browser default styling on disabled inputs making text unreadable */
.form-control:disabled {
    background: rgba(255, 255, 255, 0.02);
    border-color: rgba(255, 255, 255, 0.05);
    color: #e5e7eb !important;
    -webkit-text-fill-color: #e5e7eb !important; /* Forces visible text color in Chrome/Safari/Edge */
    opacity: 0.85;
    cursor: not-allowed;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 15px;
    padding: 20px 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.01);
}

/* QC Checklist and Photo Upload designs */
.qc-list-container {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-sm);
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.qc-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    cursor: pointer;
}

.qc-checkbox {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 1px solid var(--panel-border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.qc-item.checked .qc-checkbox {
    background: var(--success);
    border-color: var(--success);
}

.qc-item.checked .qc-checkbox::after {
    content: '✓';
    color: #ffffff;
    font-weight: bold;
    font-size: 12px;
}

.qc-item.checked span {
    text-decoration: line-through;
    color: var(--text-muted);
}

.upload-dropzone {
    border: 2px dashed rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-sm);
    padding: 30px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.upload-dropzone:hover {
    border-color: var(--primary);
    background: rgba(138, 43, 226, 0.05);
}

.upload-dropzone i {
    font-size: 32px;
    color: var(--text-secondary);
}

.image-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 12px;
    margin-top: 15px;
}

.image-preview-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--panel-border);
}

.image-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-delete-btn {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.8);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 10px;
}

/* Lessons Learned */
.lesson-card {
    background: rgba(255, 255, 255, 0.02);
    border-left: 4px solid var(--primary);
    padding: 15px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin-bottom: 12px;
}

.lesson-meta {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 8px;
}

/* Alert notifications banner */
.meeting-alert-card {
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-left: 4px solid var(--info);
    padding: 15px 20px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
}

.alert-title {
    font-weight: 600;
    color: #ffffff;
    font-size: 14px;
    margin-bottom: 3px;
}

.alert-time {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Responsive sidebars for tablets */
@media (max-width: 768px) {
    .sidebar {
        width: 70px;
        padding: 20px 10px;
    }
    .logo-text, .user-details, .role-select label, .nav-item span {
        display: none;
    }
    .sidebar select {
        padding: 5px;
    }
    .main-wrapper {
        margin-left: 70px;
        width: calc(100% - 70px);
    }
    .header {
        padding: 0 20px;
    }
    .content-body {
        padding: 20px;
    }
}
