/**
 * Custom Styles for Task Management System
 * Thiết kế theo phong cách cơ quan nhà nước
 */

:root {
    --primary-color: #dc3545;
    --primary-light: #e74c3c;
    --primary-dark: #c82333;
    --secondary-color: #F5F5F5;
    --success-color: #28A745;
    --danger-color: #DC3545;
    --warning-color: #FFC107;
    --info-color: #17A2B8;
    --dark-color: #343A40;
    --light-color: #F8F9FA;
    --font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Global Styles */
body {
    font-family: var(--font-family);
    font-size: 14px;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
    padding-top: 80px; /* Space for fixed header */
}

/* Header Styles */
.navbar {
    height: 60px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    z-index: 1000;
    background-color: var(--primary-color) !important;
}

/* Giới hạn chiều ngang navbar */
.navbar .container-fluid {
    max-width: 80rem;
    margin: 0 auto;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

.navbar.bg-primary {
    background-color: var(--primary-color) !important;
}

/* Sidebar Menu for Mobile */
.sidebar {
    position: fixed;
    top: 0;
    left: -100%;
    width: 280px;
    max-width: 85vw;
    height: 100vh;
    background-color: var(--primary-color);
    color: white;
    transition: left 0.3s ease-in-out;
    z-index: 1050;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0,0,0,0.2);
    -webkit-overflow-scrolling: touch;
}

.sidebar.active {
    left: 0;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-header h5 {
    color: white;
    margin: 0;
}

.sidebar-body {
    padding: 1.5rem;
}

.sidebar-menu-divider {
    height: 1px;
    background-color: rgba(255,255,255,0.1);
    margin: 1rem 0;
    list-style: none;
}

.sidebar-user-name {
    background-color: rgba(255,255,255,0.15);
    cursor: default;
    pointer-events: none;
    padding: 0.75rem 1rem !important;
    font-size: 0.938rem;
}

.sidebar-menu-sub {
    padding-left: 2.5rem !important;
    font-size: 0.875rem;
}

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

.sidebar-menu-item {
    margin-bottom: 0.5rem;
}

.sidebar-menu-link {
    display: flex;
    align-items: center;
    padding: 0.875rem 1rem;
    color: rgba(255,255,255,0.9);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.sidebar-menu-link span {
    font-size: 0.938rem;
}

.sidebar-menu-link:hover {
    background-color: rgba(255,255,255,0.1);
    color: white;
}

.sidebar-menu-link.active {
    background-color: rgba(255,255,255,0.2);
    color: white;
}

/* Sidebar Overlay */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 1045;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Desktop: Hide sidebar toggle, show normal menu */
@media (min-width: 992px) {
    #sidebarToggle {
        display: none;
    }
    
    .sidebar {
        display: none;
    }
    
    .sidebar-overlay {
        display: none;
    }
}

/* Mobile: Hide normal menu, show sidebar toggle */
@media (max-width: 991.98px) {
    .navbar-collapse {
        display: none !important;
    }
    
    #sidebarToggle {
        display: block;
    }
}

.navbar-brand {
    font-size: 1.25rem;
    font-weight: 600;
    color: white !important;
    display: flex;
    align-items: center;
}

.navbar-brand:hover {
    color: rgba(255, 255, 255, 0.8) !important;
}

.navbar-brand-img {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 2px solid white;
    object-fit: contain;
}

.nav-link {
    font-weight: 500;
    padding: 0.75rem 1rem !important;
    transition: all 0.3s ease;
    color: white !important;
}

.nav-link:hover {
    background-color: rgba(255,255,255,0.1);
    border-radius: 4px;
    color: white !important;
}

.nav-link.active {
    background-color: rgba(255,255,255,0.2);
    border-radius: 4px;
    color: white !important;
}

/* Dropdown menu styling */
.navbar-nav .dropdown-menu {
    background-color: white;
    border: 1px solid rgba(0,0,0,0.1);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.navbar-nav .dropdown-item {
    color: #333;
}

.navbar-nav .dropdown-item:hover {
    background-color: var(--primary-color);
    color: white;
}

/* Navbar toggler */
.navbar-toggler {
    border-color: rgba(255,255,255,0.3);
}

.navbar-toggler-icon {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.8%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* Main Content */
.main-content {
    min-height: calc(100vh - 200px);
}

/* Giới hạn chiều ngang tất cả các trang */
.main-content .container-fluid,
.footer .container-fluid {
    max-width: 80rem; /* 1280px */
    margin: 0 auto;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

/* Cards */
.card {
    border: none;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.card-header {
    background-color: #e9ecef;
    color: #495057;
    border-radius: 8px 8px 0 0 !important;
    font-weight: 600;
}

/* Statistics Cards */
.stat-card {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-light));
    color: white;
    border-radius: 16px;
    padding: 1rem 1rem;
    margin-bottom: 0;
    transition: all 0.3s ease;
    cursor: pointer;
    height: 150px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    position: relative;
}

/* Stat card color variants for profile page */
.stat-card.total {
    background: linear-gradient(135deg, #6c757d, #495057);
}

.stat-card.doing {
    background: linear-gradient(135deg, #3498db, #2c80b9);
}

.stat-card.pending {
    background: linear-gradient(135deg, #f39c12, #d68910);
}

.stat-card.completed {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
}

.stat-card.completed-late {
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
}

.stat-card.overdue {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,74,153,0.3);
}

/* Linked stat cards - enhanced hover effect */
a .stat-card {
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

a .stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

a:hover .stat-card::before {
    left: 100%;
}

a:hover .stat-card {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 8px 25px rgba(0,74,153,0.4);
}

.stat-icon-wrapper {
    width: 48px;
    min-height: 48px;
    border-radius: 6px;
    background-color: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.5rem;
}

.stat-card .stat-icon-wrapper i {
    font-size: 1.25rem;
    color: white;
}

.stat-card .stat-number {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
}

.stat-card .stat-label {
    font-size: 0.813rem;
    opacity: 0.95;
    font-weight: 500;
    line-height: 1.4;
    text-align: center;
    margin-top: 0.25rem;
}

/* Status Badges */
/* Compact Table Rows for Upcoming Tasks */
.table-sm tbody tr {
    padding: 0.25rem 0 !important;
}

.table-sm tbody td {
    padding: 0.375rem 0.5rem !important;
    vertical-align: middle;
}

.status-badge {
    font-size: 0.65rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.status-doing {
    background-color: #3498db;
    color: white;
}

.status-pending_approval {
    background-color: #f39c12;
    color: white;
}

.status-completed {
    background-color: #2ecc71;
    color: white;
}

.status-completed_late {
    background-color: #9b59b6;
    color: white;
}

.status-rejected {
    background-color: var(--danger-color);
    color: white;
}

.status-overdue {
    background-color: #e74c3c;
    color: white;
}

/* Task Status Dots */
.task-status-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    min-width: 12px;
    min-height: 12px;
    border-radius: 50%;
    margin-right: 8px;
    vertical-align: middle;
    flex-shrink: 0;
}

.task-status-dot.doing {
    background-color: #3498db;
}

.task-status-dot.pending_approval {
    background-color: #f39c12;
}

.task-status-dot.completed {
    background-color: #2ecc71;
}

.task-status-dot.completed_late {
    background-color: #9b59b6;
}

.task-status-dot.rejected {
    background-color: var(--danger-color);
}

.task-status-dot.overdue {
    background-color: #e74c3c;
}

/* Buttons */
.btn {
    font-weight: 500;
    border-radius: 6px;
    transition: all 0.3s ease;
}

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

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

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

.btn-primary:focus {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
    box-shadow: 0 0 0 0.2rem rgba(220, 53, 69, 0.25);
}

.btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
}

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

/* Tables */
.table {
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.table thead th {
    background-color: var(--primary-color);
    color: white;
    border: none;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
    padding: 1rem 0.75rem;
}

.table tbody tr {
    transition: all 0.3s ease;
}

.table tbody tr:hover {
    background-color: rgba(0,74,153,0.05);
}

.table tbody td {
    padding: 1rem 0.75rem;
    vertical-align: middle;
    border-top: 1px solid #e9ecef;
}

/* Forms */
.form-control, .form-select {
    border-radius: 6px;
    border: 1px solid #ced4da;
    transition: all 0.3s ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0,74,153,0.25);
}

.form-label {
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
}

/* Modals */
.modal-content {
    border: none;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.modal-header {
    background-color: var(--primary-color);
    color: white;
    border-radius: 12px 12px 0 0;
}

.modal-header .btn-close {
    filter: invert(1);
}

/* Charts */
.chart-container {
    position: relative;
    height: 300px;
    margin: 1rem 0;
}

/* Pagination */
.pagination .page-link {
    color: var(--primary-color);
    border-color: #dee2e6;
}

.pagination .page-link:hover {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.pagination .page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Alerts */
.alert {
    border: none;
    border-radius: 8px;
    font-weight: 500;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
}

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
}

/* Breadcrumb - Tag Style with Arrows */
.breadcrumb-custom {
    background-color: transparent;
    padding: 0;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

.breadcrumb-custom .breadcrumb-item {
    display: flex;
    align-items: center;
    margin-right: 0.5rem;
}

.breadcrumb-custom .breadcrumb-item:not(:last-child)::after {
    content: '';
    width: 0;
    height: 0;
    border-left: 6px solid #6c757d;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    margin-left: 0.5rem;
    margin-right: 0.5rem;
}

.breadcrumb-link {
    display: inline-flex;
    align-items: center;
    padding: 0.4rem 0.8rem;
    background-color: #e9ecef;
    color: var(--primary-color);
    text-decoration: none;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 1px solid #dee2e6;
}

.breadcrumb-link:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,74,153,0.3);
}

.breadcrumb-current {
    display: inline-flex;
    align-items: center;
    padding: 0.4rem 0.8rem;
    background-color: var(--primary-color);
    color: white;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 600;
    border: 1px solid var(--primary-color);
    box-shadow: 0 2px 8px rgba(0,74,153,0.2);
}

/* Responsive breadcrumb */
@media (max-width: 768px) {
    .breadcrumb-custom {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .breadcrumb-custom .breadcrumb-item {
        margin-bottom: 0.25rem;
    }
    
    .breadcrumb-custom .breadcrumb-item:not(:last-child)::after {
        display: none;
    }
}

/* Footer */
.footer {
    background-color: var(--primary-color);
    color: white;
    border-top: 1px solid var(--primary-dark);
    margin-top: auto;
}

.footer .text-muted {
    color: rgba(255, 255, 255, 0.8) !important;
}

/* Responsive Design */
@media (max-width: 1280px) {
    /* Padding cho mobile khi container bị giới hạn */
    .main-content .container-fluid,
    .footer .container-fluid {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

@media (max-width: 768px) {
    body {
        padding-top: 70px;
    }
    
    .navbar-brand {
        font-size: 1.1rem;
    }
    
    .stat-card {
        padding: 1rem;
        margin-bottom: 0.75rem;
    }
    
    .stat-card .stat-number {
        font-size: 1.5rem;
    }
    
    .stat-card .stat-icon {
        font-size: 2rem;
    }
    
    .table-responsive {
        border-radius: 8px;
    }
    
    .btn-group-vertical .btn {
        margin-bottom: 0.25rem;
    }
}

@media (max-width: 576px) {
    .main-content {
        padding: 15px 0;
    }
    
    .container-fluid {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    .stat-card {
        text-align: center;
    }
    
    .page-actions {
        margin-top: 1rem;
    }
    
    .page-actions .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
}

/* Loading Spinner */
.spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 1050;
}

.toast {
    border: none;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Custom Utilities */
.text-primary-custom {
    color: var(--primary-color) !important;
}

.bg-primary-custom {
    background-color: var(--primary-color) !important;
}

.border-primary-custom {
    border-color: var(--primary-color) !important;
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

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

.slide-in-right {
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

/* Table Styling - Prevent text wrapping in specific columns */
.table-hover tbody td:nth-child(2),
.table-hover tbody td:nth-child(3),
.table-hover tbody td:nth-child(4),
.table-hover tbody td:nth-child(5),
.table-hover tbody td:nth-child(6) {
    white-space: nowrap;
}

.table-hover thead th:nth-child(2),
.table-hover thead th:nth-child(3),
.table-hover thead th:nth-child(4),
.table-hover thead th:nth-child(5),
.table-hover thead th:nth-child(6) {
    white-space: nowrap;
}

/* Comments Section */
.comment-form {
    border-bottom: 1px solid #dee2e6;
    padding-bottom: 1.5rem;
}

.comments-list {
    max-height: 600px;
    overflow-y: auto;
}

.comment-item {
    padding: 0 0;
    border-bottom: 0px solid #e9ecef;
}

.comment-item:last-child {
    border-bottom: none;
}

.comment-author {
    color: var(--primary-color);
    font-size: 0.938rem;
}

.comment-time {
    font-size: 0.813rem;
}

.comment-content {
    font-size: 0.938rem;
    line-height: 1.6;
    color: #495057;
    word-wrap: break-word;
}

.comment-actions {
    display: flex;
    gap: 0.5rem;
}

.comment-actions .btn {
    padding: 0.25rem 0.5rem;
    font-size: 0.813rem;
}

/* Responsive for comments */
@media (max-width: 768px) {
    .comment-item {
        padding: 0.75rem 0;
    }
    
    .comment-actions {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .comment-content {
        font-size: 0.875rem;
    }
}

/* Print Styles */
@media print {
    .navbar, .footer, .btn, .page-actions {
        display: none !important;
    }
    
    body {
        padding-top: 0;
    }
    
    .main-content {
        padding: 0;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #dee2e6;
    }
}
