/* DPZ Project Management System - Styles */

:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --info-color: #0dcaf0;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --teal-color: #20c997;
    --orange-color: #fd7e14;
    --purple-color: #6f42c1;
}

body {
    background-color: #f8fafc;
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: #333;
    margin: 0;
    min-height: 100vh;
}

/* Login Page - Modern Design */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 20px;
}

.login-wrapper {
    width: 100%;
    max-width: 420px;
    padding: 20px;
}

.login-card {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.12);
    overflow: hidden;
    border: 1px solid #e9ecef;
}

.login-logo {
    max-width: 180px;
    max-height: 100px;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    margin: 0 auto 28px;
}

@media (max-width: 576px) {
    .login-logo {
        max-width: 140px;
        max-height: 80px;
    }
}

/* App Layout */
.app-sidebar {
    width: 240px;
    min-height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    background: #ffffff;
    border-right: 1px solid #e5e7eb;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
}

.sidebar-collapsed,
.app-sidebar:not(.show) {
    transform: translateX(-100%);
}

@media (min-width: 768px) {
    .app-sidebar {
        transform: translateX(0) !important;
    }
}

.app-sidebar.show {
    transform: translateX(0);
}

/* Mobile sidebar close button */
.mobile-sidebar-close {
    display: none;
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    font-size: 20px;
    color: #6b7280;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    z-index: 10;
}

.mobile-sidebar-close:hover {
    background: #f3f4f6;
    color: #111827;
}

@media (max-width: 991px) {
    .app-sidebar .mobile-sidebar-close {
        display: block;
    }
}

.sidebar-brand {
    height: 64px;
    display: flex;
    align-items: center;
    padding: 0 16px;
    border-bottom: 1px solid #e5e7eb;
}

.sidebar-brand a {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}

.logo-sidebar {
    max-width: 40px;
    max-height: 40px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.brand-text {
    font-size: 14px;
    font-weight: 700;
    color: #1f2937;
    line-height: 1.2;
}

.sidebar-menu {
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
}

.sidebar-menu ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: #4b5563;
    text-decoration: none;
    transition: all 0.2s ease;
    position: relative;
}

.nav-link:hover,
.nav-link.active {
    background-color: var(--primary-color);
    color: #fff;
}

.nav-link.text-danger:hover {
    background-color: #dc3545;
    color: #fff;
}

.nav-section-title {
    display: block;
    padding: 8px 16px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #9ca3af;
    margin-top: 8px;
}

/* Main content area - backward compatible */
.main-content,
.app-main {
    margin-left: 240px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: #f8fafc;
    transition: margin-left 0.3s ease;
}

.main-content > main,
.app-main > section {
    flex: 1;
    padding: 24px;
}

/* Topbar - backward compatible */
.topbar,
.app-topbar {
    height: 64px;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 900;
}

.topbar-left {
    display: flex;
    align-items: center;
    min-width: 0;
}

.system-title {
    font-size: 15px;
    font-weight: 600;
    color: #111827;
    white-space: nowrap;
}

.topbar-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.notification-btn {
    width: 36px;
    height: 36px;
    border: 1px solid #d1d5db;
    background: #ffffff;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #374151;
    cursor: pointer;
    position: relative;
}

.notification-btn:hover {
    background: #f3f4f6;
    color: #111827;
}

.notification-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    min-width: 16px;
    height: 16px;
    line-height: 16px;
    text-align: center;
    border-radius: 8px;
    padding: 0 3px;
}

.user-menu {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.user-menu-toggle {
    height: 36px;
    border: 1px solid #d1d5db;
    background: #ffffff;
    border-radius: 6px;
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #374151;
    cursor: pointer;
    white-space: nowrap;
    line-height: 1;
}

.user-menu-toggle:hover {
    background: #f3f4f6;
    color: #111827;
}

.user-name {
    display: inline-block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

.user-menu-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 180px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
    padding: 8px 0;
    z-index: 1000;
}

.user-menu-dropdown.show {
    display: block;
}

.user-menu-dropdown a {
    display: flex;
    align-items: center;
    padding: 9px 14px;
    font-size: 14px;
    color: #374151;
    text-decoration: none;
    white-space: nowrap;
}

.user-menu-dropdown a:hover {
    background: #f3f4f6;
}

@media (max-width: 768px) {
    .system-title {
        display: none;
    }

    .user-name {
        max-width: 110px;
    }

    .app-topbar {
        padding: 0 12px;
    }
}

/* Footer - backward compatible */
.footer,
.app-footer {
    margin-left: 240px;
    padding: 14px 24px;
    border-top: 1px solid #e5e7eb;
    background: #ffffff;
    font-size: 13px;
    transition: margin-left 0.3s ease;
}

/* Buttons */
.btn-icon {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: #6b7280;
    border-radius: 8px;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: #f3f4f6;
    color: #1f2937;
}

/* Avatars */
.avatar-xs {
    width: 28px;
    height: 28px;
    font-size: 10px;
}

.avatar-sm {
    width: 36px;
    height: 36px;
}

.avatar-md {
    width: 48px;
    height: 48px;
}

.avatar-lg {
    width: 64px;
    height: 64px;
}

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

.user-avatar,
.user-avatar-img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
}

.user-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.user-avatar-img {
    object-fit: cover;
    border: 1px solid #e5e7eb;
}

.user-name {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    line-height: 1.2;
}

.user-subtext {
    font-size: 12px;
    color: #6b7280;
    margin-top: 2px;
}

.role-badge,
.department-badge,
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
}

/* Dashboard Cards */
.dashboard-card {
    transition: all 0.3s ease;
    cursor: pointer;
    border-radius: 12px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    padding: 16px;
    min-height: auto;
}

.dashboard-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12) !important;
}

.dashboard-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dashboard-card-number {
    font-size: 24px;
    font-weight: 700;
}

.dashboard-card-label {
    font-size: 13px;
}

/* Overdue styling */
.overdue-card {
    border-left: 4px solid #dc3545 !important;
}

.overdue-row {
    background-color: #fff5f5 !important;
}

.overdue-row:hover {
    background-color: #ffe5e5 !important;
}

/* Badges */
.priority-low { background-color: #6c757d; }
.priority-medium { background-color: #0dcaf0; }
.priority-high { background-color: #fd7e14; }
.priority-urgent { background-color: #dc3545; }

.status-not-started { background-color: #6c757d; }
.status-ongoing { background-color: #0d6efd; }
.status-completed { background-color: #198754; }
.status-delayed { background-color: #dc3545; }

/* Status badges */
.status-active { background: #16a34a; color: #ffffff; }
.status-inactive { background: #6b7280; color: #ffffff; }
.status-suspended { background: #dc2626; color: #ffffff; }
.status-pending { background: #f59e0b; color: #111827; }
.status-in-progress { background: #0d6efd; color: #ffffff; }

/* Color Picker Styles */
.form-control-color {
    width: 56px;
    height: 38px;
    padding: 4px;
    cursor: pointer;
}

.color-field-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.color-hex-text {
    font-size: 13px;
    color: #6b7280;
    font-family: monospace;
}

/* Notification item */
.notification-item:last-child {
    border-bottom: 0 !important;
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

/* Table improvements */
.table th {
    background-color: #f8f9fa;
    font-weight: 600;
    border-top: 0;
}

.table-hover tbody tr:hover {
    background-color: rgba(13, 110, 253, 0.04);
}

/* Breadcrumb */
.breadcrumb {
    background-color: transparent;
    padding: 0;
    margin-bottom: 20px;
}

/* Progress bar */
.progress {
    border-radius: 4px;
    background-color: #e9ecef;
}

/* Card styles */
.card {
    border-radius: 12px;
    border: 1px solid #e9ecef;
}

.card-header {
    border-bottom: 1px solid #e9ecef;
    padding: 1rem 1.25rem;
}

/* Background color utilities */
.bg-primary-subtle { background-color: rgba(13, 110, 253, 0.1) !important; }
.bg-success-subtle { background-color: rgba(25, 135, 84, 0.1) !important; }
.bg-info-subtle { background-color: rgba(13, 202, 240, 0.1) !important; }
.bg-warning-subtle { background-color: rgba(255, 193, 7, 0.15) !important; }
.bg-danger-subtle { background-color: rgba(220, 53, 69, 0.1) !important; }
.bg-secondary-subtle { background-color: rgba(108, 117, 125, 0.1) !important; }
.bg-teal-subtle { background-color: rgba(32, 201, 151, 0.15) !important; }
.bg-orange-subtle { background-color: rgba(253, 126, 20, 0.15) !important; }
.bg-purple-subtle { background-color: rgba(111, 66, 193, 0.15) !important; }

.text-teal { color: var(--teal-color) !important; }
.text-orange { color: var(--orange-color) !important; }
.text-purple { color: var(--purple-color) !important; }

/* Page header */
.page-header {
    margin-bottom: 1.5rem;
}

.page-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.logo-report {
    max-height: 70px;
    width: auto;
}

.logo-email {
    max-width: 180px;
    height: auto;
}

/* Kanban Board */
.kanban-wrapper {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

.kanban-board {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    width: 100%;
    max-width: 100%;
    padding-bottom: 12px;
    -webkit-overflow-scrolling: touch;
}

.kanban-column {
    flex: 1 1 0;
    min-width: 300px;
    max-width: 100%;
    background: #f8fafc;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.kanban-column-header {
    padding: 14px 18px;
    font-weight: 600;
    font-size: 16px;
    color: #ffffff;
    margin: 0;
}

.kanban-column-header.not-started {
    background: #6c757d;
}

.kanban-column-header.ongoing {
    background: #0d6efd;
}

.kanban-column-header.done {
    background: #198754;
}

.kanban-column .card-header {
    padding: 0;
    border: none;
    background: transparent;
}

.kanban-column .card-header h5 {
    padding: 14px 18px;
    margin: 0;
    font-weight: 600;
    font-size: 16px;
}

.kanban-task-list {
    min-height: 420px;
    padding: 12px;
    background: #f8fafc;
    flex: 1;
}

.kanban-card {
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    cursor: grab;
    user-select: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.kanban-card-title {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 4px;
}

.kanban-card-project {
    font-size: 13px;
    color: #374151;
    margin-bottom: 6px;
}

.kanban-card-meta {
    font-size: 12px;
    color: #4b5563;
    line-height: 1.5;
}

.kanban-card-actions {
    margin-top: 10px;
}

.kanban-card-actions .btn {
    width: 100%;
}

.overdue-task {
    border-left: 3px solid #dc3545 !important;
}

.kanban-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
}

.kanban-card .badge {
    font-size: 11px;
    padding: 4px 8px;
    border-radius: 6px;
}

.kanban-card-dates {
    margin-top: 8px;
    font-size: 12px;
    color: #4b5563;
    line-height: 1.5;
}

.kanban-card-dates strong {
    color: #111827;
}

.due-overdue {
    color: #dc2626;
    font-weight: 600;
}

.due-today {
    color: #d97706;
    font-weight: 600;
}

.kanban-ghost {
    opacity: 0.45;
    background: #e5e7eb;
}

.kanban-drag {
    transform: rotate(1deg);
}

.kanban-chosen {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

/* Kanban Filter Card */
.kanban-filter-card {
    border-radius: 12px;
    border: 1px solid #e9ecef;
}

.kanban-filter-card .form-label {
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 4px;
    color: #4b5563;
}

.kanban-filter-card .form-control,
.kanban-filter-card .form-select {
    font-size: 14px;
}

.quick-filter {
    transition: all 0.2s ease;
}

.quick-filter:hover {
    transform: translateY(-1px);
}

.empty-state {
    opacity: 0.7;
}

@media (max-width: 991px) {
    .app-sidebar,
    .sidebar {
        transform: translateX(-100%);
        transition: transform 0.3s ease;
    }

    .app-sidebar.show,
    .sidebar.show {
        transform: translateX(0);
    }

    .main-content,
    .app-main,
    .footer,
    .app-footer {
        margin-left: 0;
    }

    .topbar,
    .app-topbar {
        padding: 0 12px;
    }

    .main-content > main,
    .app-main > section,
    .app-content {
        padding: 16px;
    }
    
    .page-header .d-flex {
        flex-direction: column;
    }
    
    .page-header .btn {
        margin: 2px;
    }
    
    .card-header h5 {
        font-size: 16px;
    }
    
    h2.page-title, h3.page-title {
        font-size: 20px;
    }
}

/* Milestone Tasks Accordion */
.milestone-toggle {
    width: 28px;
    height: 28px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.milestone-toggle.expanded {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: #fff;
}

.milestone-tasks-detail {
    background-color: #f8fafc;
    transition: all 0.3s ease;
}

.milestone-tasks-detail td {
    padding: 0 !important;
    transition: padding 0.3s ease;
}

.milestone-task-item td:first-child {
    position: relative;
}

.milestone-task-item td:first-child::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background-color: var(--primary-color);
}

.milestone-tasks-header td {
    border-top: 1px solid #e9ecef !important;
}

.milestone-tasks-empty td {
    border-top: 1px solid #e9ecef !important;
}

.milestone-tasks-detail .table {
    margin-bottom: 0;
    font-size: 14px;
}

.milestone-tasks-detail .table thead th {
    background-color: #e9ecef;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 8px 12px;
}

.milestone-tasks-detail .table tbody td {
    padding: 10px 12px;
    vertical-align: middle;
}

.milestone-tasks-detail .table tbody tr:hover {
    background-color: rgba(13, 110, 253, 0.03);
}

/* Mobile task cards in expanded view */
@media (max-width: 767px) {
    .milestone-tasks-detail .table {
        font-size: 13px;
    }
    
    .milestone-tasks-detail .table thead {
        display: none;
    }
    
    .milestone-tasks-detail .table tbody tr {
        display: block;
        margin-bottom: 12px;
        border: 1px solid #e5e7eb;
        border-radius: 8px;
        padding: 12px;
        background: #ffffff;
    }
    
    .milestone-tasks-detail .table tbody td {
        display: block;
        text-align: right;
        padding: 6px 0 !important;
        border: none;
        position: relative;
        border-bottom: 1px solid #f3f4f6;
    }
    
    .milestone-tasks-detail .table tbody td:last-child {
        border-bottom: 0;
    }
    
    .milestone-tasks-detail .table tbody td::before {
        content: attr(data-label);
        position: absolute;
        left: 0;
        font-weight: 600;
        color: #374151;
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    
    .milestone-tasks-detail .table tbody td:first-child {
        padding-left: 4px !important;
    }
    
.milestone-tasks-detail .table tbody td:last-child {
         text-align: center;
         padding-top: 10px;
         margin-top: 8px;
         border-top: 1px solid #f3f4f6;
     }
 }

/* Timeline Styles */
.timeline {
    position: relative;
    padding-left: 30px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 12px;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: #e5e7eb;
}

.timeline-item {
    position: relative;
    margin-bottom: 20px;
    padding-left: 20px;
}

.timeline-item:last-child {
    margin-bottom: 0;
}

.timeline-marker {
    position: absolute;
    left: -30px;
    top: 0;
    width: 24px;
    height: 24px;
}

.timeline-content {
    background-color: #f9fafb;
    border-radius: 8px;
    padding: 12px 16px;
    border: 1px solid #e5e7eb;
}

.timeline-content p {
    margin-bottom: 8px;
    line-height: 1.5;
}

/* Scroll margin for anchor links */
#progress-updates {
    scroll-margin-top: 90px;
}