/* Modern CSS Reset and Base Styles */
* {
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-weight: 500; /* Medium weight for body text */
    line-height: 1.6;
    color: #2d3748;
    background-color: #ffffff;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ========================================
   COMPREHENSIVE Z-INDEX FIX
   ======================================== */

/* Z-Index Hierarchy:
   - Header/Navigation: 1000-1010
   - Dropdowns: 1050-1080  
   - Modals: 1040-1060
   - Tooltips/Popovers: 1070-1080
   - Above everything: 9999
*/

/* Header and Navigation */
.modern-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000 !important;
    transition: all 0.3s ease;
}

.navbar {
    z-index: 1001 !important;
}

/* ========================================
   DROPDOWN Z-INDEX FIXES
   ======================================== */

/* Base dropdown styles */
.dropdown {
    position: relative;
    z-index: 1050;
}

.dropdown.show {
    z-index: 1055 !important;
}

.dropdown-menu {
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    padding: 0.5rem 0;
    margin-top: 0.5rem;
    min-width: 200px;
    z-index: 1060 !important;
    position: absolute !important;
}

/* Navigation dropdowns */
.navbar .dropdown {
    z-index: 1005;
}

.navbar .dropdown.show {
    z-index: 1010 !important;
}

.navbar .dropdown-menu {
    z-index: 1015 !important;
}

/* Card dropdowns */
.card .dropdown,
.card-body .dropdown,
.contact-card .dropdown,
.company-card .dropdown,
.job-card .dropdown {
    position: relative;
    z-index: 1050;
}

.card .dropdown.show,
.card-body .dropdown.show,
.contact-card .dropdown.show,
.company-card .dropdown.show,
.job-card .dropdown.show {
    z-index: 1065 !important;
}

.card .dropdown-menu,
.card-body .dropdown-menu,
.contact-card .dropdown-menu,
.company-card .dropdown-menu,
.job-card .dropdown-menu {
    z-index: 1070 !important;
}

/* Table row dropdowns */
.contact-row .dropdown,
.company-row .dropdown,
.job-row .dropdown,
.table .dropdown {
    position: relative;
    z-index: 1050;
}

.contact-row .dropdown.show,
.company-row .dropdown.show,
.job-row .dropdown.show,
.table .dropdown.show {
    z-index: 1065 !important;
}

.contact-row .dropdown-menu,
.company-row .dropdown-menu,
.job-row .dropdown-menu,
.table .dropdown-menu {
    z-index: 1070 !important;
}

/* Clickable row styles */
.company-row,
.contact-row,
.task-row,
.job-row {
    cursor: pointer;
    transition: all 0.2s ease;
}

.company-row:hover,
.contact-row:hover,
.task-row:hover,
.job-row:hover {
    background-color: #f8f9fa !important;
    transform: translateX(2px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.company-row:active,
.contact-row:active,
.task-row:active,
.job-row:active {
    transform: translateX(0);
}

/* Keep links and buttons from interfering with row click */
.company-row a,
.contact-row a,
.task-row a,
.job-row a {
    position: relative;
    z-index: 10;
}

.company-row .btn-group,
.contact-row .btn-group,
.task-row .btn-group,
.job-row .btn-group {
    position: relative;
    z-index: 10;
}

/* Button group dropdowns */
.btn-group .dropdown,
.btn-group-sm .dropdown {
    position: relative;
    z-index: 1050;
}

.btn-group .dropdown.show,
.btn-group-sm .dropdown.show {
    z-index: 1065 !important;
}

.btn-group .dropdown-menu,
.btn-group-sm .dropdown-menu {
    z-index: 1070 !important;
}

/* ========================================
   MODAL Z-INDEX FIXS
   ======================================== */

/* Modal backdrop */
.modal-backdrop {
    z-index: 1040 !important;
}

/* Modals */
.modal {
    z-index: 1050 !important;
}

.modal.show {
    z-index: 1055 !important;
}

/* Modal content */
.modal-dialog {
    z-index: 1056 !important;
}

.modal-content {
    z-index: 1057 !important;
}

/* Specific modal z-index fixes */
#companyModal,
#contactModal,
#jobModal,
#taskModal,
#notesModal {
    z-index: 1050 !important;
}

#companyDetailsModal,
#contactDetailsModal,
#jobDetailsModal,
#taskDetailsModal {
    z-index: 1055 !important;
}

#deleteModal,
#removeContactModal,
#deleteNotesModal {
    z-index: 1060 !important;
}

/* Dropdowns inside modals */
.modal .dropdown {
    position: relative;
    z-index: 1060;
}

.modal .dropdown.show {
    z-index: 1075 !important;
}

.modal .dropdown-menu {
    z-index: 1080 !important;
}

/* Company details modal specific fixes */
.company-details .dropdown {
    position: relative;
    z-index: 1060;
}

.company-details .dropdown.show {
    z-index: 1075 !important;
}

.company-details .dropdown-menu {
    z-index: 1080 !important;
}

/* Contact details modal specific fixes */
.contact-details .dropdown {
    position: relative;
    z-index: 1060;
}

.contact-details .dropdown.show {
    z-index: 1075 !important;
}

.contact-details .dropdown-menu {
    z-index: 1080 !important;
}

/* Job details modal specific fixes */
.job-details .dropdown {
    position: relative;
    z-index: 1060;
}

.job-details .dropdown.show {
    z-index: 1075 !important;
}

.job-details .dropdown-menu {
    z-index: 1080 !important;
}

/* ========================================
   CARD AND HOVER STATE FIXES
   ======================================== */

/* Prevent cards from creating stacking contexts that interfere with dropdowns */
.card {
    position: relative;
    z-index: 1;
}

.card:hover {
    z-index: 2; /* Keep below dropdowns */
}

.modern-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
    padding: 2rem;
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
}

.modern-card:hover {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
    z-index: 2; /* Keep below dropdowns */
}

.contact-card {
    transition: all 0.3s ease;
    border: 1px solid #e2e8f0;
    position: relative;
    z-index: 1;
}

.contact-card:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
    border-color: #cbd5e0;
    z-index: 2; /* Keep below dropdowns */
}

/* Contact card dropdown fixes - ensure dropdowns appear above adjacent cards */
.contact-card .dropdown {
    position: relative;
    z-index: 10;
}

.contact-card .dropdown.show {
    z-index: 1050 !important;
}

.contact-card .dropdown-menu {
    z-index: 1060 !important;
}

/* Ensure the column containing an open dropdown is elevated above other columns */
#cardView .dropdown-active-column {
    z-index: 1050 !important;
    position: relative;
}

/* Alternative: Use :has() selector for browsers that support it */
#cardView .col-lg-6:has(.dropdown.show),
#cardView .col-xl-4:has(.dropdown.show) {
    z-index: 1050;
    position: relative;
}

.company-card {
    transition: all 0.3s ease;
    border: 1px solid #e2e8f0;
    position: relative;
    z-index: 1;
}

.company-card:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
    border-color: #cbd5e0;
    z-index: 2; /* Keep below dropdowns */
}

/* ========================================
   JOB CARD STYLES
   ======================================== */

.job-card {
    transition: all 0.3s ease;
    border: 1px solid #e2e8f0;
    position: relative;
    z-index: 1;
}

.job-card:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
    border-color: #cbd5e0;
    z-index: 2; /* Keep below dropdowns */
}

.job-card .job-dates {
    font-size: 0.875rem;
}

.job-card .job-contacts {
    font-size: 0.875rem;
}

/* ========================================
   TASK CARD STYLES
   ======================================== */

.task-card {
    transition: transform 0.2s ease-in-out;
    border-left: 4px solid #007bff;
}

.task-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.task-meta {
    margin-top: 10px;
}

.task-meta small {
    margin-bottom: 2px;
}

/* ========================================
   NOTE CARD STYLES
   ======================================== */

.note-card {
    transition: all 0.2s ease-in-out;
    border-left: 4px solid #0072BC;
}

.note-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.note-associations {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.note-content {
    padding: 1rem 0;
    line-height: 1.6;
}

/* ========================================
   TASK DETAILS MODAL STYLES
   ======================================== */

.task-details .section-title {
    color: #495057;
    font-weight: 600;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e9ecef;
}

.task-details .meta-item {
    padding: 8px 0;
}

.task-details .meta-item label {
    font-size: 0.875rem;
    color: #6c757d;
    margin-bottom: 2px;
}

.task-details .meta-item p {
    margin-bottom: 0;
    font-weight: 500;
}

.task-details .update-item {
    background-color: #f8f9fa;
    transition: box-shadow 0.2s ease;
}

.task-details .update-item:hover {
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.task-details .timeline-item {
    background-color: #fff;
    border-left: 4px solid #007bff;
}

.task-details .status-change-section {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.task-details .task-actions {
    background-color: #fff;
    padding: 15px;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.task-details .related-items p {
    margin-bottom: 5px;
}

/* ========================================
   JOB DETAILS MODAL STYLES
   ======================================== */

.job-details-section, 
.contacts-section, 
.status-history-section, 
.job-meta {
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 0.375rem;
    margin-bottom: 1rem;
}

.job-details .section-title {
    color: #495057;
    font-weight: 600;
    margin-bottom: 1rem;
    border-bottom: 2px solid #dee2e6;
    padding-bottom: 0.5rem;
}

.job-details .status-timeline {
    position: relative;
}

.job-details .status-change-item {
    padding: 0.75rem;
    background-color: white;
    border-radius: 0.375rem;
    margin-bottom: 0.5rem;
    border-left: 3px solid #007bff;
}

.job-details .status-change-item:last-child {
    margin-bottom: 0;
}

.job-details .meta-item {
    margin-bottom: 1rem;
}

.job-details .meta-item label {
    font-weight: 600;
    color: #6c757d;
    margin-bottom: 0.25rem;
}

.job-details .meta-item p {
    margin-bottom: 0;
}

.job-details .status-selector {
    min-width: 200px;
}

/* Job status badge styles */
.job-status-badge {
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
    font-weight: 500;
    border-radius: 1rem;
}

/* Quick status update styling */
.quick-status-update {
    background-color: #f8f9fa;
    border-radius: 0.5rem;
    padding: 1rem;
    border: 1px solid #e9ecef;
}

.quick-status-update .form-label {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #495057;
}

/* ========================================
   TABLE ROW HOVER FIXES
   ======================================== */

.contact-row,
.company-row,
.job-row {
    position: relative;
    z-index: 1;
}

.contact-row:hover,
.company-row:hover,
.job-row:hover {
    background-color: #f8fafc !important;
    transition: background-color 0.2s ease;
    z-index: 2; /* Keep below dropdowns */
}

/* ========================================
   TOOLTIP AND POPOVER Z-INDEX
   ======================================== */

.tooltip {
    z-index: 1070 !important;
}

.popover {
    z-index: 1070 !important;
}

/* ========================================
   SPECIAL CASES AND OVERRIDES
   ======================================== */

/* For any elements that absolutely need to be on top */
.z-index-highest {
    z-index: 9999 !important;
}

/* Bootstrap dropdown positioning fix */
.dropdown-toggle::after {
    margin-left: 0.5rem;
}

/* Ensure dropdown menus don't get cut off */
.dropdown-menu {
    max-height: 300px;
    overflow-y: auto;
}

/* Fix for dropdowns in scrollable containers */
.contacts-list .dropdown-menu,
.companies-list .dropdown-menu,
.jobs-list .dropdown-menu {
    position: fixed !important;
    z-index: 1070 !important;
}

/* ========================================
   PAGE HEADER LAYOUT - STANDARDIZED
   ======================================== */

/* Stack page header elements vertically */
.page-header-wrapper {
    margin-bottom: 2rem;
}

.page-header-content {
    margin-bottom: 1rem;
}

/* Standardize hero-title size across all pages */
.page-header-content h1.hero-title {
    color: #2d3748;
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

/* Ensure hero-subtitle is left-aligned and consistent */
.page-header-content p.hero-subtitle {
    color: #718096;
    font-size: 1.125rem;
    margin-bottom: 0;
    text-align: left;
    margin:0;
}

.page-header-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Make action buttons more compact on larger screens */
@media (min-width: 768px) {
    .page-header-actions .btn {
        font-size: 0.875rem;
        padding: 0.5rem 1rem;
        height: auto;
        white-space: nowrap;
    }
    
    .page-header-actions .btn-primary[data-bs-toggle="modal"],
    .page-header-actions .btn-success[data-bs-toggle="modal"] {
        font-size: 0.875rem;
        padding: 0.5rem 1rem;
    }
}

@media (min-width: 992px) {
    .page-header-actions .btn {
        font-size: 0.875rem;
        padding: 0.45rem 0.9rem;
    }
    
    .page-header-actions .btn-primary[data-bs-toggle="modal"],
    .page-header-actions .btn-success[data-bs-toggle="modal"] {
        font-size: 0.875rem;
        padding: 0.45rem 0.9rem;
    }
}

/* ========================================
   PAGE SPECIFIC STYLES
   ======================================== */

/* Home Page Learn More Button */
.home-learn-more-btn {
    display: inline-block;
    width: auto;
    margin-top: 1rem;
}

/* Inline Form Styles for Companies */
.inline-form-display {
    display: inline;
}

/* ========================================
   RESPONSIVE Z-INDEX ADJUSTMENTS
   ======================================== */

@media (max-width: 768px) {
    /* Mobile dropdown adjustments */
    .dropdown-menu {
        min-width: 180px;
        margin-top: 0.25rem;
        z-index: 1070 !important;
    }
    
    .modal .dropdown-menu {
        z-index: 1085 !important;
    }
    
    /* Ensure mobile navigation works */
    .navbar-collapse {
        z-index: 1005;
    }
    
    .navbar-collapse.show {
        z-index: 1010 !important;
    }
    
    /* Responsive page headers */
    .page-header-content h1.hero-title {
        font-size: 2rem;
    }
    
    .page-header-content p.hero-subtitle {
        font-size: 1rem;
    }
}

/* Header Styles */
.modern-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: all 0.3s ease;
}

.navbar-brand {
    text-decoration: none !important;
}

.logo-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 60px;
}

.logo-image {
    height: 48px;
    width: auto;
    max-width: 240px;
    object-fit: contain;
    transition: all 0.3s ease;
}

.logo-image:hover {
    transform: scale(1.05);
}

/* Legacy styles for backward compatibility - can be removed if not needed */
.logo-placeholder i {
    display: none;
}

.logo-placeholder span {
    display: none;
}

/* Navigation Styles - Ensure perfect alignment */
.navbar-nav {
    align-items: center;
}

.navbar-nav .nav-item {
    display: flex;
    align-items: center;
}

.navbar-nav .nav-link {
    color: #4a5568 !important;
    font-weight: 500;
    padding: 0.75rem 1.25rem !important;
    border-radius: 8px;
    transition: all 0.3s ease;
    position: relative;
    border: 1px solid transparent !important;
    display: flex;
    align-items: center;
    height: 44px;
    line-height: 1;
}

.navbar-nav .nav-link:hover {
    color: #2563eb !important;
    background-color: rgba(37, 99, 235, 0.1);
}

.login-link {
    /* Remove separate border styling since it's now handled by .nav-link */
}

.login-link:hover {
    border-color: #2563eb !important;
    background-color: transparent !important;
}

.nav-cta {
    background: linear-gradient(135deg, #3b82f6, #2563eb) !important;
    border: 1px solid transparent !important;
    padding: 0.75rem 1.25rem !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    color: white !important;
    transition: all 0.3s ease !important;
    text-decoration: none !important;
    display: flex !important;
    align-items: center !important;
    height: 44px !important;
    line-height: 1 !important;
}

.nav-cta:hover {
    background: linear-gradient(135deg, #2563eb, #1d4ed8) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3) !important;
}

/* User Dropdown Styles */
.dropdown-menu {
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    padding: 0.5rem 0;
    margin-top: 0.5rem;
    min-width: 200px;
    z-index: 1055 !important; /* Use !important to override Bootstrap */
}

.dropdown-item {
    color: #4a5568 !important;
    padding: 0.75rem 1.25rem;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
    display: flex;
    align-items: center;
}

.dropdown-item:hover,
.dropdown-item:focus {
    background-color: rgba(37, 99, 235, 0.1) !important;
    color: #2563eb !important;
}

.dropdown-item i {
    width: 16px;
    margin-right: 0.5rem;
}

.dropdown-divider {
    margin: 0.5rem 0;
    border-color: rgba(0, 0, 0, 0.1);
}

/* User dropdown toggle styling */
.nav-item.dropdown .nav-link.dropdown-toggle {
    background-color: rgba(37, 99, 235, 0.1);
    border-color: #2563eb !important;
}

.nav-item.dropdown .nav-link.dropdown-toggle:hover {
    background-color: rgba(37, 99, 235, 0.15);
}

/* Main Content */
.main-content {
    flex: 1;
    padding-top: 0;
}

/* Page Container */
.page-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 4rem 2rem;
}

/* ========================================
   HOMEPAGE STAT CARDS
   ======================================== */

.stat-card {
    border-radius: 15px;
    color: white;
    transition: transform 0.3s ease;
    box-shadow: 0 10px 30px rgba(0,102,204,0.2);
}

.stat-card:hover {
    transform: translateY(-10px);
}

.stat-card-blue {
    background: linear-gradient(135deg, #0066cc 0%, #0052a3 100%);
}

.stat-card-purple {
    background: linear-gradient(135deg, #333366 0%, #292952 100%);
    box-shadow: 0 10px 30px rgba(51,51,102,0.2);
}

.stat-card-cyan {
    background: linear-gradient(135deg, #0099cc 0%, #0077a3 100%);
    box-shadow: 0 10px 30px rgba(0,153,204,0.2);
}

.stat-number {
    line-height: 1;
    color: white;
}

/* ========================================
   HOMEPAGE CTA SECTION & BUTTONS
   ======================================== */

.cta-section {
    background: #2F3772;
    border-radius: 20px;
    color: white;
    box-shadow: 0 15px 40px rgba(0,102,204,0.3);
}

.cta-subtitle {
    font-size: 1.25rem;
}

.btn-rounded {
    border-radius: 8px;
    font-weight: 600;
}

.btn-rounded-outline {
    border-radius: 8px;
    border-width: 2px;
    font-weight: 600;
    background-color: #0072BC;
    border-color: #0072BC;
    color: white;
}

.btn-rounded-outline:hover {
    background-color: #005a96;
    border-color: #005a96;
    color: white;
}

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, #2E3192 0%, #00A99D 100%);
    color: white;
    padding: 6rem 0;
    text-align: center;
}

/* ===== Homepage Hero Section ===== */
.homepage-hero {
    position: relative;
    background: linear-gradient(135deg, rgba(0, 102, 204, 0.95), rgba(51, 51, 102, 0.95)), url('/images/handshake.png');
    background-size: cover;
    background-position: center;
    background-blend-mode: overlay;
    padding: 100px 0;
    color: white;
    margin-top: -20px;
}

    .homepage-hero::before {
        content: "";
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: linear-gradient(180deg, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0.2) 100%);
        pointer-events: none;
    }
.homepage-hero .hero-heading {
    font-size: 3rem;
    font-weight: 700;
    line-height: 1.2;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.homepage-hero .hero-subtitle {
    font-size: 1.25rem;
    opacity: 0.95;
    max-width: 700px;
    margin: 0 auto 2rem;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}


@media (max-width: 768px) {
    .homepage-hero {
        padding: 4rem 0;
    }

    .homepage-hero .hero-heading {
        font-size: 2rem;
    }

    .homepage-hero .hero-subtitle {
        font-size: 1rem;
    }
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 400;
    margin-bottom: 1.5rem;
    line-height: 1.1;
}

.hero-subtitle {
    font-size: 1.25rem;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto 2rem;
    
}

/* Welcome Section */
.welcome-section {
    background: #f8fafc;
    padding: 6rem 0;
    min-height: 70vh;
    display: flex;
    align-items: center;
}

.welcome-section .display-4 {
    font-weight: 300;
    color: #2d3748;
}

.welcome-section .lead {
    font-size: 1.5rem;
    color: #4a5568;
    font-weight: 400;
}

/* Cards */
.modern-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
    padding: 2rem;
    transition: all 0.3s ease;
}

.modern-card:hover {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

/* Forms */
.form-section {
    background: #f8fafc;
    padding: 4rem 0;
}

.form-container {
    max-width: 500px;
    margin: 0 auto;
    background: white;
    padding: 3rem;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.form-title {
    font-size: 2rem;
    font-weight: 600;
    text-align: center;
    margin-bottom: 2rem;
    color: #2d3748;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #374151;
}

.form-control {
    width: 100%;
    height:40px;
    padding: 0.875rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background-color: #ffffff;
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.form-control:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.btn-primary {
    background: linear-gradient(135deg, #0072BC, #0072BC);
    border: none;
    padding: 0.875rem 2rem;
    border-radius: 8px;
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    font-size: 1rem;
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.btn-primary:hover {
    background: linear-gradient(135deg, #00A99D, #00A99D );
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

/* Footer */
.modern-footer {
    background: #1a202c;
    color: #e2e8f0;
    padding: 2rem 0;
    margin-top: auto;
}

.footer-links {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: flex-end;
    gap: 2rem;
    flex-wrap: wrap;
}

.footer-links a {
    color: #e2e8f0;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-links a:hover {
    color: #60a5fa;
}

/* User greeting and logout button styles */
.user-greeting {
    color: #2563eb !important;
    font-weight: 600 !important;
    border: 1px solid rgba(37, 99, 235, 0.2) !important;
    background-color: rgba(37, 99, 235, 0.05) !important;
    cursor: default;
}

.nav-logout {
    background: transparent !important;
    border: 2px solid #dc2626 !important;
    color: #dc2626 !important;
    padding: 0.75rem 1.25rem !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    transition: all 0.3s ease !important;
    text-decoration: none !important;
    display: flex !important;
    align-items: center !important;
    height: 44px !important;
    line-height: 1 !important;
    margin-left: 0.5rem;
}

.nav-logout:hover {
    background: #dc2626 !important;
    color: white !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3) !important;
}

/* ========================================
   CONTACT DETAILS MODAL STYLES
   ======================================== */

.contact-details .section-title {
    color: #2d3748;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
    font-weight: 600;
    font-size: 1.1rem;
}

.contact-details .contact-header {
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.contact-details .contact-header h4 {
    color: #2d3748;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.contact-details .contact-info-section,
.contact-details .relationship-section,
.contact-details .notes-section,
.contact-details .tasks-section {
    margin-bottom: 1.5rem;
}

.contact-details .notes-content {
    border-left: 4px solid #4299e1;
    word-wrap: break-word;
    white-space: pre-wrap;
    padding: 1rem;
    background-color: #f7fafc;
    border-radius: 0.375rem;
    color: #2d3748;
    line-height: 1.6;
}

.contact-details .contact-meta .meta-item {
    padding: 0.75rem;
    background-color: #f7fafc;
    border-radius: 0.375rem;
    border-left: 3px solid #cbd5e0;
    margin-bottom: 0.75rem;
    transition: background-color 0.2s ease;
}

.contact-details .contact-meta .meta-item:hover {
    background-color: #edf2f7;
}

.contact-details .contact-meta .meta-item .form-label {
    font-size: 0.875rem;
    color: #718096;
    font-weight: 600;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.contact-details .contact-meta .meta-item p {
    margin-bottom: 0;
    color: #2d3748;
    font-weight: 500;
}

.contact-details .contact-actions .btn {
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.contact-details .contact-actions .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.contact-details .contact-actions .btn-primary {
    background: linear-gradient(135deg, #0072BC, #0072BC);
    border: none;
    width: 100%;
}

.contact-details .contact-actions .btn-primary:hover {
    background: linear-gradient(135deg, #00A99D, #00A99D);
}

.contact-details .contact-actions .btn-outline-secondary {
    border-color: #cbd5e0;
    color: #4a5568;
}

.contact-details .contact-actions .btn-outline-secondary:hover {
    background-color: #f7fafc;
    border-color: #a0aec0;
    color: #2d3748;
}

.contact-details .contact-actions .btn-outline-info {
    border-color: #0ea5e9;
    color: #0ea5e9;
}

.contact-details .contact-actions .btn-outline-info:hover {
    background-color: #0ea5e9;
    color: white;
}

/* Contact info display improvements */
.contact-details .contact-info-section .form-label {
    font-size: 0.875rem;
    color: #718096;
    font-weight: 600;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.contact-details .contact-info-section p {
    color: #2d3748;
    font-weight: 500;
    margin-bottom: 0;
}

.contact-details .contact-info-section a {
    color: #0072BC;
    text-decoration: none;
    transition: color 0.2s ease;
}

.contact-details .contact-info-section a:hover {
    color: #00A99D;
    text-decoration: underline;
}

.contact-details .relationship-section .badge {
    font-size: 0.875rem;
    padding: 0.5rem 1rem;
    font-weight: 500;
}

/* Task item card styles for contact details */
.contact-details .task-item-card {
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
}

.contact-details .task-item-card:hover {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Responsive adjustments for contact details */
@media (max-width: 768px) {
    .contact-details .contact-actions .d-grid {
        gap: 0.75rem !important;
    }
    
    .contact-details .contact-meta .meta-item {
        padding: 0.5rem;
    }
    
    .contact-details .notes-content {
        padding: 0.75rem;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2.5rem;
    }
    
    .hero-subtitle {
        font-size: 1rem;
    }
    
    .page-container {
        padding: 2rem 1rem;
    }
    
    .form-container {
        margin: 0 1rem;
        padding: 2rem;
    }
    
    .footer-links {
        justify-content: center;
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    
    .navbar-nav .nav-link {
        padding: 0.5rem 1rem !important;
        height: 36px !important;
    }
    
    .nav-cta {
        height: 36px !important;
        padding: 0.5rem 1rem !important;
    }
    
    .logo-image {
        height: 42px;
        max-width: 180px;
    }

    /* Mobile dropdown adjustments */
    .dropdown-menu {
        min-width: 180px;
        margin-top: 0.25rem;
    }
    
    .dropdown-item {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }

    .user-greeting {
        padding: 0.5rem 1rem !important;
        height: 36px !important;
        font-size: 0.9rem;
    }
    
    .nav-logout {
        height: 36px !important;
        padding: 0.5rem 1rem !important;
        font-size: 0.9rem;
        margin-left: 0.25rem;
    }
}

@media (max-width: 576px) {
    .hero-section {
        padding: 4rem 0;
    }
    
    .logo-image {
        height: 36px;
        max-width: 144px;
    }

    .welcome-section {
        padding: 4rem 0;
    }
    
    .welcome-section .display-4 {
        font-size: 2rem;
    }

    .user-greeting {
        display: none !important; /* Hide greeting on very small screens to save space */
    }
    
    .nav-logout {
        margin-left: 0;
    }
}

/* Contact Table Styles */
.contacts-table {
    font-size: 0.95rem;
}

.contacts-table th {
    font-weight: 600;
    color: #2d3748;
    border-bottom: 2px solid #e2e8f0;
    padding: 1rem 0.75rem;
}

.contacts-table td {
    padding: 1rem 0.75rem;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
}

.contact-row:hover {
    background-color: #f8fafc;
    transition: background-color 0.2s ease;
}

.contact-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #0072BC, #00A99D);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.avatar-text {
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
}

.view-toggle .btn {
    line-height: 1.2;
    padding-top: 0.25rem;
    padding-bottom: 0.25rem;
    padding-left: 1rem;
    padding-right: 1rem;
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

.view-toggle .btn i {
    font-size: 0.875rem;
    vertical-align: middle;
}

/* Contact Cards Enhancement */
.contact-card {
    transition: all 0.3s ease;
    border: 1px solid #e2e8f0;
}

.contact-card:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
    border-color: #cbd5e0;
    z-index: auto; /* Prevent creating new stacking context */
}

.company-card {
    transition: all 0.3s ease;
    border: 1px solid #e2e8f0;
}

.company-card:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
    border-color: #cbd5e0;
}

.company-card .card-body {
    position: relative;
}

.company-card .contact-count {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: linear-gradient(135deg, #0072BC, #00A99D);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 1rem;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Company Icon Styles */
.company-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #0072BC, #00A99D);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: white;
    font-size: 1rem;
}

/* Company Card Enhancements */
.company-card .company-links a {
    color: #0072BC;
    font-size: 0.9rem;
}

.company-card .company-links a:hover {
    color: #00A99D;
    text-decoration: underline !important;
}

/* Companies Table Styles */
.companies-table {
    font-size: 0.95rem;
}

.companies-table th {
    font-weight: 600;
    color: #2d3748;
    border-bottom: 2px solid #e2e8f0;
    padding: 1rem 0.75rem;
}

.companies-table td {
    padding: 1rem 0.75rem;
    vertical-align: middle;
    border-bottom: 1px solid #f1f5f9;
}

.company-row:hover {
    background-color: #f8fafc;
    transition: background-color 0.2s ease;
}

/* Company Details Modal Styles */
.company-details .section-title {
    color: #2d3748;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
    font-weight: 600;
    font-size: 1.1rem;
}

.company-details .company-header {
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.company-details .company-header h4 {
    color: #2d3748;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.company-details .company-info-section,
.company-details .contacts-section {
    margin-bottom: 1.5rem;
}

.company-details .contacts-list {
    max-height: 400px;
    overflow-y: auto;
}

.company-details .contact-item {
    padding: 1rem;
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    margin-bottom: 0.75rem;
    transition: all 0.2s ease;
}

.company-details .contact-item:hover {
    background-color: #f8fafc;
    border-color: #cbd5e0;
}

.company-details .no-contacts {
    background-color: #f8fafc;
    border: 2px dashed #cbd5e0;
    border-radius: 0.5rem;
    color: #718096;
}

.company-details .company-meta .meta-item {
    padding: 0.75rem;
    background-color: #f7fafc;
    border-radius: 0.375rem;
    border-left: 3px solid #cbd5e0;
    margin-bottom: 0.75rem;
    transition: background-color 0.2s ease;
}

.company-details .company-meta .meta-item:hover {
    background-color: #edf2f7;
}

.company-details .company-meta .meta-item .form-label {
    font-size: 0.875rem;
    color: #718096;
    font-weight: 600;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.company-details .company-meta .meta-item p {
    margin-bottom: 0;
    color: #2d3748;
    font-weight: 500;
}

.company-details .company-actions .btn {
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.company-details .company-actions .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.company-details .company-actions .btn-primary {
    background: linear-gradient(135deg, #0072BC, #0072BC);
    border: none;
    width: 100%;
}

.company-details .company-actions .btn-primary:hover {
    background: linear-gradient(135deg, #00A99D, #00A99D);
}

.company-details .company-actions .btn-outline-secondary {
    border-color: #cbd5e0;
    color: #4a5568;
}

.company-details .company-actions .btn-outline-secondary:hover {
    background-color: #f7fafc;
    border-color: #a0aec0;
    color: #2d3748;
}

.company-details .company-actions .btn-outline-info {
    border-color: #0ea5e9;
    color: #0ea5e9;
}

.company-details .company-actions .btn-outline-info:hover {
    background-color: #0ea5e9;
    color: white;
}

.company-details .company-info-section .form-label {
    font-size: 0.875rem;
    color: #718096;
    font-weight: 600;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.company-details .company-info-section p {
    color: #2d3748;
    font-weight: 500;
    margin-bottom: 0;
}

.company-details .company-info-section a {
    color: #0072BC;
    text-decoration: none;
    transition: color 0.2s ease;
}

.company-details .company-info-section a:hover {
    color: #00A99D;
    text-decoration: underline;
}

/* Add Contact Form Styles */
.add-contact-form .card {
    border: 2px dashed #cbd5e0;
    background-color: #f8fafc;
}

.add-contact-form .card-header {
    background-color: #e2e8f0;
    border-bottom: 1px solid #cbd5e0;
}

.add-contact-form .form-control-sm,
.add-contact-form .form-select-sm {
    font-size: 0.875rem;
    padding: 0.375rem 0.75rem;
}

.add-contact-form .form-label {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

/* Loading states */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Remove contact modal */
#removeContactModal .modal-content {
    border-radius: 0.5rem;
}

#removeContactModal .modal-header {
    padding: 1rem 1.25rem 0.5rem;
}

#removeContactModal .modal-body {
    padding: 0.5rem 1.25rem;
}

#removeContactModal .modal-footer {
    padding: 0.5rem 1.25rem 1rem;
}

/* Enhanced dropdown z-index fix */
.dropdown-menu {
    z-index: 1060 !important;
    position: absolute !important;
}

/* ========================================
   COOKIE CONSENT BANNER
   ======================================== */

#cookie-consent-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    padding: 1.5rem 0;
    z-index: 9999;
    transform: translateY(100%);
    transition: transform 0.3s ease-in-out;
    display: none;
}

#cookie-consent-banner.show {
    transform: translateY(0);
}

.cookie-consent-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.cookie-consent-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    flex-wrap: wrap;
}

.cookie-consent-text {
    flex: 1;
    min-width: 300px;
}

.cookie-consent-text h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: #2d3748;
}

.cookie-consent-text p {
    margin: 0;
    font-size: 0.95rem;
    color: #4a5568;
    line-height: 1.5;
}

.cookie-consent-text a {
    color: #4f46e5;
    text-decoration: none;
    font-weight: 500;
}

.cookie-consent-text a:hover {
    text-decoration: underline;
}

.cookie-consent-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.cookie-consent-btn {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.cookie-consent-btn-accept {
    background: #4f46e5;
    color: white;
}

.cookie-consent-btn-accept:hover {
    background: #4338ca;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.cookie-consent-btn-reject {
    background: #f3f4f6;
    color: #4a5568;
    border: 1px solid #e5e7eb;
}

.cookie-consent-btn-reject:hover {
    background: #e5e7eb;
    border-color: #d1d5db;
}

/* Cookie Settings Link in Footer */
.cookie-settings-link {
    display: inline-block;
    margin-top: 0.5rem;
    color: #4f46e5;
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
}

.cookie-settings-link:hover {
    text-decoration: underline;
}

.cookie-settings-link i {
    margin-right: 0.25rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .cookie-consent-content {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }

    .cookie-consent-text {
        min-width: 100%;
    }

    .cookie-consent-actions {
        width: 100%;
        justify-content: stretch;
    }

    .cookie-consent-btn {
        flex: 1;
        text-align: center;
    }

    #cookie-consent-banner {
        padding: 1rem 0;
    }
}

@media (max-width: 480px) {
    .cookie-consent-actions {
        flex-direction: column;
    }

    .cookie-consent-btn {
        width: 100%;
    }
}

/* ========================================
   STANDARDIZED FORM CONTROL HEIGHTS
   ======================================== */

/* Universal form control height standardization */
.task-form .form-control,
.task-form .form-select,
.note-form .form-control,
.note-form .form-select,
.task-form-container .form-control,
.task-form-container .form-select,
.note-form-container .form-control,
.note-form-container .form-select {
    font-size: 0.9rem;
    padding: 0.5rem 0.75rem;
    height: 38px;
    border: 1px solid #e2e8f0;
}

/* ========================================
   PASSWORD TOGGLE FUNCTIONALITY
   ======================================== */

.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-wrapper input {
    padding-right: 2.5rem !important;
    flex: 1;
}

.password-toggle-btn {
    position: absolute;
    right: 0.5rem;
    background: none;
    border: none;
    color: #6c757d;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    z-index: 10;
    transition: color 0.2s ease;
}

.password-toggle-btn:hover {
    color: #495057;
}

.password-toggle-btn:focus {
    outline: none;
    color: #495057;
}

.password-toggle-btn i {
    font-size: 1rem;
}

/* Ensure wrapper inherits width properly */
.password-input-wrapper {
    width: 100%;
}

/* Handle input-group contexts (for ResetPassword.cshtml) */
.input-group .password-input-wrapper {
    flex: 1;
    display: flex;
}

.input-group .password-input-wrapper input {
    border-radius: 0 0.375rem 0.375rem 0 !important;
}