:root {
    --primary-color: #0d6efd;
    --border-color: #dee2e6;
    --text-color: #212529;
    --light-gray: #f8f9fa;
}

/* Global styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    line-height: 1.5;
    color: var(--text-color);
    background-color: #f5f5f5;
    height: 100vh;
    margin: 0;
    overflow: auto; /* Allow scrolling by default */
}

/* Only prevent scrolling on the viewlead page */
body.viewlead-page {
    overflow: hidden;
}

/* Layout */
.g-sidenav-show {
    display: flex;
}

.sidenav {
    z-index: 1036;
    width: 60px;
    background: white;
    height: 100%;
    position: fixed;
    top: 0;
    left: 0;
    transition: width 0.3s ease;
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidenav.expanded {
    width: 250px;
}

.sidenav.show {
    transform: translateX(0);
}

@media (min-width: 1200px) {
    .sidenav {
        width: 60px;
    }
    
    .sidenav.expanded {
        width: 250px;
    }
}

.sidenav-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1035;
    display: none;
}

.sidenav-backdrop.show {
    display: block;
}

.main-content {
    flex: 1;
    min-width: 0;
    position: relative;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    overflow: auto; /* Allow scrolling by default */
    margin-left: 80px;
    transition: margin-left 0.3s ease;
}

/* Only prevent scrolling on the viewlead page */
body.viewlead-page .main-content {
    overflow: hidden;
}

.sidenav.expanded ~ .main-content {
    margin-left: calc(250px + 20px);
}

/* Add padding to main content except for pages that need full width */
.main-content:not(:has(.lead-container, .kanban-board)) {
    padding: 20px;
}

@media (max-width: 768px) {
    .main-content {
        margin-left: 20px;
    }
    
    .sidenav.show ~ .main-content {
        margin-left: calc(250px + 20px);
    }
}

/* View App styles */
.title-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.title-buttons {
    display: flex;
    gap: 0.75rem;
}

.section-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
    margin: 0 0 1rem 0;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.view-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

.view-group {
    padding: 0.75rem;
    border-radius: 6px;
    background: var(--light-gray);
}

.view-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #6c757d;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
}

.view-value {
    font-size: 0.875rem;
    color: var(--text-color);
}

.button-success {
    background-color: #28a745;
    color: white;
    border: none;
}

.button-success:hover {
    background-color: #218838;
    color: white;
}

.button-danger {
    background-color: #dc3545;
    color: white;
    border: none;
}

.button-danger:hover {
    background-color: #c82333;
    color: white;
}

/* Tabs Navigation */
.tabs-nav {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.tab-link {
    color: var(--text-color);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tab-link:hover {
    background-color: var(--light-gray);
    color: var(--primary-color);
}

.tab-link.active {
    background-color: var(--primary-color);
    color: white;
}

.badge {
    background-color: var(--light-gray);
    color: var(--text-color);
    padding: 0.25rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

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

/* Navigation */
.sidenav-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
}

.sidenav-header .btn-link {
    color: var(--text-color);
    transition: color 0.2s ease;
}

.sidenav-header .btn-link:hover {
    color: var(--primary-color);
}

.navbar-brand-img {
    height: 32px;
    width: auto;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    color: var(--text-color);
    text-decoration: none;
    transition: all 0.2s ease;
}

.nav-link:hover {
    background-color: var(--light-gray);
    color: var(--primary-color);
}

.nav-link.active {
    background-color: var(--light-gray);
    color: var(--primary-color);
    font-weight: 500;
}

.icon-shape {
    width: 32px;
    height: 32px;
    background: white;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.nav-link-text {
    margin-left: 0.75rem;
}

/* Buttons */
.button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.button-primary:hover {
    background-color: #0b5ed7;
    color: white;
}

.button-secondary {
    background-color: #6c757d;
    color: white;
    border: none;
}

.button-secondary:hover {
    background-color: #5c636a;
    color: white;
}

/* Cards and sections */
.section-card {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* Table styles */
.table-container {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    margin-bottom: 2rem;
    overflow-x: auto;
}

.title-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.app-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

.search-section {
    flex: 1;
    max-width: 300px;
}

.search-input {
    width: 100%;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.875rem;
}

.add-new {
    margin-bottom: 1rem;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

/* Table styles */
.table-container table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
}

.table-container th {
    background-color: var(--light-gray);
    font-weight: 600;
    text-align: left;
    padding: 1rem;
    white-space: nowrap;
    border-top: none;
    border-bottom: 2px solid var(--border-color);
    color: var(--text-color);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table-container td {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    vertical-align: middle;
    font-size: 0.875rem;
    color: var(--text-color);
}

.table-container tr:hover {
    background-color: var(--light-gray);
}

.table-container tr:last-child td {
    border-bottom: none;
}

/* Table responsive */
@media (max-width: 768px) {
    .table-container {
        margin: 0 -1rem;
        width: calc(100% + 2rem);
        border-radius: 0;
    }
    
    .table-container table {
        min-width: 800px;
    }
}

/* Action buttons */
.button-group {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

.actions-cell {
    padding: 0.5rem 1rem !important;
    white-space: nowrap;
    text-align: right;
}

.actions-cell .button {
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
}

.actions-header {
    text-align: right !important;
}

@media (max-width: 768px) {
    .title-section {
        flex-direction: column;
        align-items: stretch;
    }

    .search-section {
        max-width: none;
    }

    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    td, th {
        padding: 0.75rem;
    }
}

/* Footer */
.footer {
    padding: 1rem 0;
    margin-top: auto;
}

.copyright {
    font-size: 0.875rem;
    color: #6c757d;
}

/* Notification Styles */
#notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1060;
    max-width: 350px;
    pointer-events: none;
}

.toast {
    background: white;
    border: none;
    box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.1);
    opacity: 1;
    margin-bottom: 0.75rem;
    pointer-events: auto;
}

.toast:last-child {
    margin-bottom: 0;
}

.toast .toast-header {
    background-color: rgba(255, 255, 255, 0.95);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding: 0.75rem 1rem;
}

.toast .toast-body {
    padding: 0.75rem 1rem;
    color: #333;
}

.toast .btn-close {
    font-size: 0.875rem;
    padding: 0.5rem;
    margin: -0.5rem -0.5rem -0.5rem auto;
}

.toast .btn-primary {
    padding: 0.25rem 0.75rem;
    font-size: 0.875rem;
    border-radius: 0.25rem;
}

/* Notification Bell Animation */
@keyframes tada {
    0% {transform: scale(1);}
    10%, 20% {transform: scale(0.9) rotate(-3deg);}
    30%, 50%, 70%, 90% {transform: scale(1.1) rotate(3deg);}
    40%, 60%, 80% {transform: scale(1.1) rotate(-3deg);}
    100% {transform: scale(1) rotate(0);}
}

.notification-bell {
    cursor: pointer;
    transition: transform 0.2s ease;
}

.notification-bell:hover {
    transform: scale(1.1);
}

.notification-bell.animate__animated.animate__tada {
    animation: tada 1s ease-in-out;
}

.notification-count {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    min-width: 1rem;
    height: 1rem;
    line-height: 1;
    text-align: center;
    border-radius: 999px;
    background-color: #dc3545;
    color: white;
    display: none;
}
