/**
 * Custom Styles - Project Management Application
 * Mobile-first, touch-friendly, responsive design
 */

/* ===== GENERAL STYLES ===== */
:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --touch-target-min: 44px;
}

* {
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f8f9fa;
    padding-bottom: 80px; /* Space for mobile bottom nav */
}

@media (min-width: 768px) {
    body {
        padding-bottom: 0;
    }
}

/* ===== AUTH PAGES ===== */
.auth-page {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.auth-page .card {
    border-radius: 1rem;
}

.auth-page .form-control,
.auth-page .input-group-text {
    border-radius: 0.5rem;
}

/* ===== CARDS ===== */
.stat-card {
    border-radius: 1rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    min-height: 100px;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

.stat-card .card-body {
    padding: 1.25rem;
}

@media (max-width: 576px) {
    .stat-card .card-body {
        padding: 1rem;
    }

    .stat-card h2 {
        font-size: 1.5rem;
    }

    .stat-card p {
        font-size: 0.75rem;
    }
}

.project-card,
.task-card {
    border-radius: 0.75rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.project-card:hover,
.task-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

/* ===== BUTTONS ===== */
.btn {
    border-radius: 0.5rem;
    min-height: var(--touch-target-min);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-lg {
    min-height: 50px;
    padding: 0.75rem 1.5rem;
    font-size: 1.1rem;
}

.btn:active {
    transform: scale(0.98);
}

@media (max-width: 576px) {
    .btn {
        padding: 0.5rem 1rem;
    }
}

/* ===== FORMS ===== */
.form-control,
.form-select {
    border-radius: 0.5rem;
    min-height: var(--touch-target-min);
    border: 2px solid #dee2e6;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

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

.form-control-lg,
.form-select-lg {
    min-height: 50px;
    font-size: 1.1rem;
}

textarea.form-control {
    min-height: 100px;
}

/* ===== MOBILE BOTTOM NAVIGATION ===== */
.mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0.5rem 0;
    z-index: 1000;
}

.mobile-bottom-nav .nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #6c757d;
    padding: 0.5rem 1rem;
    transition: color 0.2s ease;
    flex: 1;
    text-align: center;
}

.mobile-bottom-nav .nav-item i {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

.mobile-bottom-nav .nav-item span {
    font-size: 0.7rem;
}

.mobile-bottom-nav .nav-item.active,
.mobile-bottom-nav .nav-item:hover {
    color: var(--primary-color);
}

@media (min-width: 768px) {
    .mobile-bottom-nav {
        display: none;
    }
}

/* ===== TABS ===== */
.nav-tabs {
    border-bottom: 2px solid #dee2e6;
}

.nav-tabs .nav-link {
    border: none;
    border-bottom: 3px solid transparent;
    color: #6c757d;
    font-weight: 500;
    padding: 1rem 1.5rem;
    transition: all 0.2s ease;
}

.nav-tabs .nav-link:hover {
    border-color: transparent transparent #dee2e6 transparent;
}

.nav-tabs .nav-link.active {
    color: var(--primary-color);
    border-color: transparent transparent var(--primary-color) transparent;
    background: transparent;
}

@media (max-width: 576px) {
    .nav-tabs .nav-link {
        padding: 0.75rem 0.5rem;
        font-size: 0.9rem;
    }
}

/* ===== PROGRESS BARS ===== */
.progress {
    border-radius: 0.5rem;
    background-color: #e9ecef;
}

.progress-bar {
    border-radius: 0.5rem;
    transition: width 0.6s ease;
}

/* ===== BADGES ===== */
.badge {
    padding: 0.375rem 0.75rem;
    font-weight: 500;
    border-radius: 0.375rem;
    font-size: 0.85rem;
}

/* ===== MODALS ===== */
.modal-content {
    border-radius: 1rem;
    border: none;
}

.modal-header {
    border-bottom: 1px solid #dee2e6;
    border-radius: 1rem 1rem 0 0;
    padding: 1.5rem;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid #dee2e6;
    border-radius: 0 0 1rem 1rem;
    padding: 1.5rem;
}

@media (max-width: 576px) {
    .modal-dialog {
        margin: 0.5rem;
    }

    .modal-fullscreen-sm-down {
        width: 100vw;
        max-width: none;
        height: 100%;
        margin: 0;
    }

    .modal-fullscreen-sm-down .modal-content {
        height: 100%;
        border-radius: 0;
    }
}

/* ===== DROPDOWNS ===== */
.dropdown-menu {
    border-radius: 0.75rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    border: none;
    padding: 0.5rem;
}

.dropdown-item {
    border-radius: 0.5rem;
    padding: 0.625rem 1rem;
    min-height: var(--touch-target-min);
    display: flex;
    align-items: center;
}

.dropdown-item i {
    margin-right: 0.5rem;
    width: 1.25rem;
}

.dropdown-item:hover {
    background-color: #f8f9fa;
}

/* ===== LIST GROUPS ===== */
.list-group-item {
    border-radius: 0.75rem;
    border: 1px solid #dee2e6;
    margin-bottom: 0.75rem;
    padding: 1rem;
}

@media (max-width: 576px) {
    .list-group-item {
        padding: 0.75rem;
    }

    .list-group-item .btn-group .btn {
        padding: 0.375rem 0.75rem;
    }
}

/* ===== ALERTS ===== */
.alert {
    border-radius: 0.75rem;
    border: none;
}

/* ===== TIMELINE (Activity Log) ===== */
.timeline {
    position: relative;
    padding-left: 2.5rem;
}

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

.timeline-item {
    position: relative;
    margin-bottom: 1.5rem;
}

.timeline-marker {
    position: absolute;
    left: -2.5rem;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.timeline-content {
    background: white;
    padding: 1rem;
    border-radius: 0.75rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* ===== NAVBAR ===== */
.navbar {
    padding: 0.75rem 1rem;
}

.navbar-brand {
    font-size: 1.25rem;
    display: flex;
    align-items: center;
}

/* ===== UTILITIES ===== */
.rounded-4 {
    border-radius: 1rem !important;
}

.shadow-sm {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important;
}

.shadow {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
}

.shadow-lg {
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.175) !important;
}

/* ===== TOUCH-FRIENDLY ENHANCEMENTS ===== */
@media (max-width: 767px) {
    /* Increase spacing for better touch targets */
    .mb-3 {
        margin-bottom: 1.5rem !important;
    }

    .mt-3 {
        margin-top: 1.5rem !important;
    }

    /* Make cards more prominent */
    .card {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }

    /* Larger text for better readability */
    body {
        font-size: 1rem;
    }

    h5, .h5 {
        font-size: 1.15rem;
    }

    /* More prominent buttons */
    .btn-primary,
    .btn-success,
    .btn-danger {
        font-weight: 600;
    }
}

/* ===== LOADING SPINNER ===== */
.spinner-border {
    vertical-align: middle;
}

/* ===== SCROLLBAR STYLING (Webkit browsers) ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

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

.fade-in {
    animation: fadeIn 0.3s ease;
}

/* ===== PRINT STYLES ===== */
@media print {
    .navbar,
    .mobile-bottom-nav,
    .btn,
    .dropdown {
        display: none !important;
    }

    body {
        padding-bottom: 0;
    }
}

/* ===== ACCESSIBILITY ===== */
.btn:focus,
.form-control:focus,
.form-select:focus {
    outline: 3px solid rgba(13, 110, 253, 0.25);
    outline-offset: 2px;
}

/* Skip to main content link */
.skip-to-main {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--primary-color);
    color: white;
    padding: 8px;
    text-decoration: none;
    z-index: 100;
}

.skip-to-main:focus {
    top: 0;
}

/* Task card dropdown fix - ensure dropdowns appear above other cards */
.task-card {
    position: relative;
}

.task-card .dropdown {
    position: static;
}

.task-card .dropdown-menu {
    z-index: 1050;
}

/* Ensure dropdown menu appears above other task cards */
.task-card:has(.dropdown-menu.show) {
    z-index: 1040;
}

/* Alternative: Set z-index on show state */
.dropdown-menu.show {
    z-index: 1050 !important;
}

/* ===== OVERDUE TASKS MODAL ===== */
.stat-card[onclick] {
    cursor: pointer;
    user-select: none;
}

.stat-card[onclick]:active {
    transform: translateY(0) scale(0.98);
}

#overdueTasksModal .list-group-item {
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    transition: background-color 0.2s ease;
}

#overdueTasksModal .list-group-item:first-child {
    border-top: 0;
}

#overdueTasksModal .list-group-item:last-child {
    border-bottom: 0;
    border-radius: 0 0 0.75rem 0.75rem;
}

#overdueTasksModal .list-group-item:hover {
    background-color: #fff3cd;
}

#overdueTasksModal .card-header {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    padding: 1rem 1.25rem;
}

/* Mobile responsiveness for overdue modal */
@media (max-width: 576px) {
    #overdueTasksModal .modal-dialog {
        margin: 0.5rem;
    }

    #overdueTasksModal .list-group-item h6 {
        font-size: 0.95rem;
    }

    #overdueTasksModal .badge {
        font-size: 0.7rem;
    }
}
