/* Import custom fonts */
@import url('/fonts/fonts.css');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
    background: radial-gradient(circle, rgba(238, 174, 202, 0.5) 0%, rgba(148, 187, 233, 0.5) 100%);
    min-height: 100vh;
    color: #1a202c;
}

.container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.main-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.25);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.18);
    z-index: 1000;
}

.header-content {
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.main-header h1 {
    color: #1a202c;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 900;
    font-style: italic;
}

.header-icon {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}

.btn-icon {
    width: 20px;
    height: 20px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.3);
    padding: 8px 15px;
    border-radius: 20px;
    font-size: 0.9rem;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.8);
}

/* Main content */
#main-app {
    flex: 1;
    padding-top: 120px;
    display: flex;
    flex-direction: column;
}

.clients-section {
    flex: 1;
    padding: 20px;
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
}

.section-header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 12px 12px 0 0;
    padding: 20px;
    margin-bottom: 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.header-title h2 {
    color: #2d3748;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.section-header h2 {
    color: #2d3748;
    font-size: 1.5rem;
    font-weight: 700;
}

.header-stats {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    width: 100%;
}

.stat-item {
    background: rgba(102, 126, 234, 0.1);
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: 12px;
    padding: 12px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 120px;
    flex: 1;
}

.stat-label {
    font-size: 0.85rem;
    color: #64748b;
    font-weight: 500;
    margin-bottom: 5px;
}

.stat-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: #2d3748;
}

.stat-value.money {
    color: #667eea;
}

.filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.search-input {
    margin-left: auto;
    padding: 10px 15px;
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 8px;
    font-size: 0.95rem;
    color: #2d3748;
    background: white;
    width: 250px;
    transition: all 0.2s;
}

.search-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.filters-toggle {
    display: none;
    background: rgba(102, 126, 234, 0.1);
    border: 1px solid rgba(102, 126, 234, 0.3);
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    color: #667eea;
    cursor: pointer;
    align-items: center;
    gap: 8px;
    width: 100%;
    justify-content: space-between;
}

.filters-toggle svg {
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
}

.filters-toggle.active svg {
    transform: rotate(180deg);
}

.filter-btn {
    background: rgba(255, 255, 255, 0.6);
    border: 2px solid transparent;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Poppins', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.filter-btn:hover {
    background: rgba(255, 255, 255, 0.8);
}

.filter-btn.active {
    background: #4299e1;
    color: white;
    border-color: #3182ce;
}

/* Table with sticky header */
#clients-table-container {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border-radius: 0 0 12px 12px;
    overflow: visible;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.data-table thead {
    background: transparent;
}

/* Sticky table header positioned under main header */
.data-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: #1a202c;
    font-size: 0.9rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: sticky !important;
    top: 95px !important;
    z-index: 15 !important;
}

.data-table td {
    padding: 12px 15px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    font-size: 0.9rem;
}

.data-table tbody tr {
    background: white;
    transition: background-color 0.2s;
}

.data-table tbody tr:hover {
    background: #f7fafc;
}

.client-name {
    font-weight: 600;
    color: #2d3748;
}

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-client {
    background: #48bb78;
    color: white;
}

.badge-prospect {
    background: #ed8936;
    color: white;
}

.badge-info {
    background: #3182ce;
    color: white;
}

.badge-primary {
    background: #5a67d8;
    color: white;
}

.badge-success {
    background: #48bb78;
    color: white;
}

.badge-secondary {
    background: #718096;
    color: white;
}

/* Parent entity in mobile - hidden on desktop */
.parent-entity-mobile {
    display: none;
}

/* Sortable Table Headers */
thead th[data-column] {
    position: relative;
    user-select: none;
    cursor: pointer;
    transition: background-color 0.15s;
    white-space: nowrap;
}

thead th[data-column]:hover {
    background: rgba(66, 153, 225, 0.08) !important;
}

thead th[data-column] .sort-indicator {
    display: inline;
    margin-left: 4px;
    color: #1976d2;
    font-size: 12px;
    white-space: nowrap;
}

/* Filter Menu */
.filter-menu {
    position: fixed;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    z-index: 10000;
    min-width: 180px;
    max-height: 400px;
    overflow-y: auto;
    padding: 8px 0;
}

.filter-option {
    padding: 10px 16px;
    cursor: pointer;
    transition: background-color 0.15s;
    font-size: 0.9rem;
    color: #2d3748;
}

.filter-option:hover {
    background: rgba(66, 153, 225, 0.1);
}

.filter-option.active {
    background: rgba(66, 153, 225, 0.2);
    font-weight: 600;
    color: #2c5282;
}

.filter-option.filter-clear {
    color: #e53e3e;
    font-weight: 600;
    border-bottom: 1px solid #e2e8f0;
}

.filter-option.filter-clear:hover {
    background: rgba(229, 62, 62, 0.1);
}

.filter-separator {
    height: 1px;
    background: #e2e8f0;
    margin: 4px 0;
}

/* Loading */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    gap: 15px;
}

.spinner {
    border: 3px solid rgba(66, 153, 225, 0.3);
    border-top: 3px solid #4299e1;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    color: #718096;
    font-size: 1.1rem;
}

/* Buttons */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Poppins', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

.btn-primary {
    background: #4299e1;
    color: white;
}

.btn-primary:hover {
    background: #3182ce;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.6);
    color: #2d3748;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.8);
}

.btn-danger {
    background: #e53e3e;
    color: white;
}

.btn-danger:hover {
    background: #c53030;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

/* Notification */
.notification {
    position: fixed;
    top: 80px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    background: white;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    z-index: 2000;
    animation: slideIn 0.3s ease;
}

.notification.success {
    background: #48bb78;
    color: white;
}

.notification.error {
    background: #f56565;
    color: white;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Login page */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.1);
    max-width: 450px;
    width: 100%;
    text-align: center;
}

.login-card h1 {
    color: #2d3748;
    font-size: 2rem;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 900;
    font-style: italic;
}

.login-description {
    color: #4a5568;
    margin-bottom: 15px;
    font-size: 1rem;
}

.login-note {
    background: #fed7d7;
    color: #c53030;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 25px;
    font-size: 0.9rem;
    font-weight: 500;
}

.google-login-btn {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: white;
    border: 2px solid #e2e8f0;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 500;
    color: #2d3748;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.google-login-btn:hover {
    background: #f7fafc;
    border-color: #cbd5e0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.google-login-btn svg {
    width: 24px;
    height: 24px;
}

/* Sidebar Overlay (background) */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 2999;
    display: none;
    backdrop-filter: blur(2px);
}

.sidebar-overlay.active {
    display: block;
}

/* Sidebar */
.sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: 900px;
    height: 100vh;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    box-shadow: -4px 0 20px rgba(0,0,0,0.15);
    z-index: 3000;
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
    display: flex;
    flex-direction: column;
}

.sidebar.active {
    transform: translateX(0);
}

.sidebar-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.sidebar-header {
    padding: 20px 30px;
    border-bottom: 2px solid rgba(66, 153, 225, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(66, 153, 225, 0.1);
}

.sidebar-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: #2d3748;
}

.sidebar-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-close {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: #718096;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.sidebar-close:hover {
    background: rgba(0,0,0,0.1);
    color: #2d3748;
}

.sidebar-body {
    overflow-y: auto;
    flex: 1;
}

/* Client Info Grid in Sidebar */
.client-info-grid {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.client-info-row {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 15px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.client-info-row:last-child {
    border-bottom: none;
}

.client-info-label {
    font-weight: 600;
    color: #4a5568;
    font-size: 0.9rem;
}

.client-info-value {
    color: #1a202c;
    font-size: 0.95rem;
}

.btn-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #718096;
    transition: all 0.2s;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    padding: 0;
}

.btn-close:hover {
    background: rgba(0,0,0,0.1);
    color: #2d3748;
}

.btn-close svg {
    width: 20px;
    height: 20px;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 10px;
    border-bottom: 2px solid rgba(66, 153, 225, 0.2);
    flex-shrink: 0;
    padding: 0 30px;
}

.tab-btn {
    background: none;
    border: none;
    padding: 12px 24px;
    cursor: pointer;
    font-family: 'Poppins', sans-serif;
    font-size: 1rem;
    font-weight: 500;
    color: #718096;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    position: relative;
    bottom: -2px;
}

.tab-btn:hover {
    color: #4299e1;
}

.tab-btn.active {
    color: #4299e1;
    border-bottom-color: #4299e1;
}

.tab-content {
    display: none;
    padding: 30px;
    overflow-y: auto;
    flex: 1;
}

.tab-content.active {
    display: block;
}

.tab-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.tab-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: #2d3748;
}

/* Button sizes */
.btn-sm {
    padding: 6px 14px;
    font-size: 0.85rem;
}

/* Action buttons */
.action-buttons {
    display: flex;
    gap: 8px;
    justify-content: flex-start;
}

.btn-icon {
    background: none;
    border: none;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
    padding: 6px;
}

.btn-icon svg {
    width: 18px;
    height: 18px;
}

.btn-view {
    color: #4299e1;
    background: rgba(66, 153, 225, 0.1);
}

.btn-view:hover {
    background: rgba(66, 153, 225, 0.2);
    transform: scale(1.1);
}

.btn-edit {
    color: #718096;
    background: rgba(113, 128, 150, 0.1);
}

.btn-edit:hover {
    background: rgba(113, 128, 150, 0.2);
    transform: scale(1.1);
}

.btn-delete {
    color: #f56565;
    background: rgba(245, 101, 101, 0.1);
}

.btn-delete:hover {
    background: rgba(245, 101, 101, 0.2);
    transform: scale(1.1);
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 30px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.4rem;
    color: #2d3748;
    font-weight: 600;
}

.modal-body {
    padding: 30px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 30px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
    background: rgba(0, 0, 0, 0.02);
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: #4a5568;
    font-size: 0.9rem;
}

.form-group label .required {
    color: #f56565;
    margin-left: 2px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid rgba(66, 153, 225, 0.2);
    border-radius: 8px;
    font-size: 0.95rem;
    transition: all 0.2s;
    font-family: inherit;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: #4299e1;
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-container {
    background: rgba(66, 153, 225, 0.05);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.form-container h4 {
    margin: 0 0 15px 0;
    color: #2d3748;
    font-size: 1rem;
}

.form-container input,
.form-container textarea,
.form-container select {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid rgba(66, 153, 225, 0.2);
    border-radius: 8px;
    font-family: 'Poppins', sans-serif;
    font-size: 0.9rem;
    margin-bottom: 12px;
    background: white;
    transition: border-color 0.3s;
}

.form-container input:focus,
.form-container textarea:focus,
.form-container select:focus {
    outline: none;
    border-color: #4299e1;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

/* Lists */
.list-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.empty-message {
    text-align: center;
    color: #718096;
    padding: 40px 20px;
    font-style: italic;
}

/* Contacts table */
.contacts-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.contacts-table thead {
    background: rgba(66, 153, 225, 0.1);
}

.contacts-table th {
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: #2d3748;
    font-size: 0.85rem;
    border-bottom: 2px solid rgba(66, 153, 225, 0.3);
}

.contacts-table td {
    padding: 12px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    font-size: 0.85rem;
    color: #4a5568;
}

.contacts-table tbody tr:hover {
    background: rgba(66, 153, 225, 0.05);
}

.contacts-table .contact-name {
    font-weight: 600;
    color: #2d3748;
}

.contacts-table a {
    color: #4299e1;
    text-decoration: none;
}

.contacts-table a:hover {
    text-decoration: underline;
}

.contact-notes-cell {
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.8rem;
    color: #718096;
    font-style: italic;
}

/* Note cards */
.note-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border-left: 4px solid #ed8936;
}

.note-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 8px;
}

.note-header > div {
    display: flex;
    align-items: center;
    gap: 8px;
}

.note-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.note-type {
    font-size: 0.7rem;
}

.note-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.note-date {
    font-size: 0.85rem;
    color: #718096;
    white-space: nowrap;
}

.note-contact {
    font-size: 0.75rem;
    color: #4a5568;
}

.note-datetime {
    font-size: 0.85rem;
    color: #718096;
    white-space: nowrap;
}

.note-actions {
    display: flex;
    gap: 5px;
}

.note-author {
    font-size: 0.85rem;
    color: #4a5568;
}

.note-content {
    color: #2d3748;
    line-height: 1.6;
    white-space: pre-wrap;
    margin: 15px 0;
}

.note-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 10px;
    border-top: 1px solid #e2e8f0;
    margin-top: 15px;
}

/* Project cards */
.project-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border-left: 4px solid #4299e1;
    margin-bottom: 15px;
}

.project-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    gap: 10px;
}

.project-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #1a202c;
    margin: 0;
    flex: 1;
}

.project-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 10px;
    margin-bottom: 15px;
}

.project-detail-item {
    font-size: 0.9rem;
    color: #4a5568;
}

.project-detail-item strong {
    color: #2d3748;
    margin-right: 5px;
}

.project-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding-top: 10px;
    border-top: 1px solid #e2e8f0;
}

/* Badge variants for project states */
.badge.badge-warning {
    background: #ed8936;
}

.badge.badge-danger {
    background: #e53e3e;
}

/* Confirm delete modal */
.confirm-modal-overlay {
    display: none;
    position: fixed;
    z-index: 5000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0);
    align-items: flex-start;
    justify-content: center;
    padding-top: 100px;
    transition: background-color 0.3s ease;
}

.confirm-modal-overlay.active {
    background-color: rgba(0, 0, 0, 0.6);
}

.confirm-modal {
    background: white;
    border-radius: 16px;
    padding: 30px;
    max-width: 450px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    text-align: center;
    transform: translateY(-50px);
    opacity: 0;
    transition: all 0.3s ease;
}

.confirm-modal.active {
    transform: translateY(0);
    opacity: 1;
}

.confirm-modal-icon {
    width: 70px;
    height: 70px;
    margin: 0 auto 20px;
    background: rgba(245, 101, 101, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.confirm-modal-icon svg {
    width: 40px;
    height: 40px;
    color: #f56565;
}

.confirm-modal h3 {
    margin: 0 0 15px 0;
    font-size: 1.5rem;
    color: #2d3748;
}

.confirm-modal p {
    margin: 0 0 25px 0;
    color: #718096;
    line-height: 1.6;
}

.confirm-modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.confirm-loader {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    padding: 20px 0;
}

.confirm-loader p {
    margin: 0;
    color: #4a5568;
    font-size: 0.95rem;
}

.btn-danger {
    background: #f56565;
    color: white;
}

.btn-danger:hover {
    background: #e53e3e;
}

.btn:disabled,
.btn-danger:disabled,
.btn-primary:disabled,
.btn-secondary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn:disabled:hover,
.btn-danger:disabled:hover,
.btn-primary:disabled:hover,
.btn-secondary:disabled:hover {
    background: inherit;
}

/* Modal for edit client */
.modal {
    display: none;
    position: fixed;
    z-index: 4000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal .modal-content {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.modal .modal-header {
    padding: 20px 30px;
    border-bottom: 2px solid rgba(66, 153, 225, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(66, 153, 225, 0.1);
}

.modal .modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: #2d3748;
}

.modal .modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: #718096;
    line-height: 1;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
}

.modal .modal-close:hover {
    background: rgba(0,0,0,0.1);
    color: #2d3748;
}

.modal .modal-body {
    padding: 30px;
    overflow-y: auto;
    flex: 1;
}

.modal form label {
    display: block;
    margin-top: 15px;
    margin-bottom: 5px;
    font-weight: 500;
    color: #2d3748;
    font-size: 0.9rem;
}

.modal form label:first-of-type {
    margin-top: 0;
}

.modal form input,
.modal form select {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid rgba(66, 153, 225, 0.2);
    border-radius: 8px;
    font-family: 'Poppins', sans-serif;
    font-size: 0.9rem;
    background: white;
    transition: border-color 0.3s;
}

.modal form input:focus,
.modal form select:focus {
    outline: none;
    border-color: #4299e1;
}

/* ====================================
 * INTERACTIONS STYLES
 * ==================================== */

/* Interactions button */
.btn-interactions {
    color: #4299e1;
}

.btn-interactions:hover {
    background: rgba(66, 153, 225, 0.1);
}

/* Sidebar for interactions */
.btn-add-interaction {
    color: #4299e1;
    padding: 6px;
}

.btn-add-interaction:hover {
    background: rgba(66, 153, 225, 0.1);
}

/* Timeline styles */
.interactions-timeline {
    max-height: calc(100vh - 150px);
    overflow-y: auto;
    padding: 20px 24px;
    position: relative;
}

.interaction-item {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-left: 3px solid #4299e1;
    padding: 12px 14px;
    margin-bottom: 0;
    position: relative;
    transition: all 0.2s;
}

/* Dotted line between interactions (using ::after on each item except the last) */
.interaction-item:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: -20px;
    transform: translateX(-50%);
    width: 2px;
    height: 20px;
    background: linear-gradient(to bottom, #cbd5e0 50%, transparent 50%);
    background-size: 2px 6px;
}

.interaction-item:not(:last-child) {
    margin-bottom: 20px;
}

.interaction-item:hover {
    background: white;
    border-left-color: #3182ce;
    border-left-width: 4px;
    padding-left: 13px;
}

.interaction-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
    gap: 10px;
}

.interaction-meta {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    align-items: center;
}

.interaction-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.interaction-actions .btn-icon {
    padding: 4px;
    border-radius: 4px;
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    color: #718096;
}

.interaction-actions .btn-edit:hover {
    background: rgba(66, 153, 225, 0.1);
    color: #4299e1;
}

.interaction-actions .btn-delete:hover {
    background: rgba(245, 101, 101, 0.1);
    color: #f56565;
}

.interaction-type,
.interaction-status {
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.interaction-date {
    font-size: 0.8rem;
    color: #718096;
    white-space: nowrap;
}

.interaction-subject {
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 6px;
    font-size: 0.95rem;
}

.interaction-content {
    color: #4a5568;
    line-height: 1.5;
    font-size: 0.9rem;
    margin-bottom: 8px;
}

.interaction-user {
    font-size: 0.75rem;
    color: #a0aec0;
    font-style: italic;
}

.interaction-direction {
    font-size: 0.75rem;
    color: #718096;
    font-weight: 500;
}

/* Type badge colors */
.interaction-type.badge-email {
    background: rgba(66, 153, 225, 0.15);
    color: #2c5282;
}

.interaction-type.badge-sms {
    background: rgba(72, 187, 120, 0.15);
    color: #2f855a;
}

.interaction-type.badge-linkedin {
    background: rgba(139, 92, 246, 0.15);
    color: #5b21b6;
}

.interaction-type.badge-call {
    background: rgba(245, 101, 101, 0.15);
    color: #9b2c2c;
}

.interaction-type.badge-meeting {
    background: rgba(237, 137, 54, 0.15);
    color: #7c2d12;
}

/* Status badge colors */
.interaction-status.badge-sent {
    background: rgba(0, 0, 0, 0.05);
    color: #4a5568;
}

.interaction-status.badge-read {
    background: rgba(66, 153, 225, 0.15);
    color: #2c5282;
}

.interaction-status.badge-replied {
    background: rgba(72, 187, 120, 0.15);
    color: #2f855a;
}

.interaction-status.badge-no_response {
    background: rgba(245, 101, 101, 0.15);
    color: #9b2c2c;
}

/* Direction indicator */
.interaction-direction {
    font-size: 0.85rem;
    color: #718096;
    font-weight: 500;
}

.interaction-subject {
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 10px;
    font-size: 1rem;
}

.interaction-content {
    color: #4a5568;
    font-size: 0.9rem;
    line-height: 1.6;
    white-space: pre-wrap;
}

.interaction-date {
    font-size: 0.85rem;
    color: #a0aec0;
    text-align: right;
    white-space: nowrap;
}

.interaction-user {
    margin-top: 10px;
    font-size: 0.8rem;
    color: #a0aec0;
    font-style: italic;
}

.interactions-timeline .empty-state,
.interactions-timeline .loading {
    text-align: center;
    padding: 60px 20px;
    color: #a0aec0;
    font-style: italic;
}

/* Hamburger Menu */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.3);
    transition: background 0.3s;
}

.hamburger:hover {
    background: rgba(255, 255, 255, 0.5);
}

.hamburger span {
    width: 24px;
    height: 3px;
    background: #1a202c;
    border-radius: 2px;
    transition: all 0.3s;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(7px, 7px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

.mobile-menu {
    display: none;
    position: fixed;
    top: 65px;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 999;
    padding: 20px;
    flex-direction: column;
    gap: 10px;
}

.mobile-menu.active {
    display: flex;
}

.mobile-menu a {
    padding: 12px 16px;
    border-radius: 8px;
    text-decoration: none;
    color: #1a202c;
    font-weight: 500;
    transition: background 0.2s;
}

.mobile-menu a:hover,
.mobile-menu a.active {
    background: rgba(66, 153, 225, 0.15);
}

/* Responsive */
@media (max-width: 768px) {
    /* Header mobile */
    .header-actions {
        display: none;
    }

    .hamburger {
        display: flex;
    }

    #main-app {
        padding-top: 75px;
    }

    /* Dashboard overview cards */
    .dashboard-overview {
        grid-template-columns: 1fr !important;
        gap: 15px;
    }

    .overview-card {
        padding: 20px;
    }

    /* Verticals grid */
    .verticals-grid {
        grid-template-columns: 1fr !important;
    }

    /* Tables mobile - show only type and name (with parent entity in parentheses) */
    .data-table thead th {
        display: none;
    }

    /* Show only Type and Nom columns on mobile */
    .data-table thead th:nth-child(1),
    .data-table thead th:nth-child(3),
    .data-table thead th:last-child {
        display: table-cell;
    }

    /* Hide "Type" and "Actions" labels on mobile */
    .data-table thead th:nth-child(1),
    .data-table thead th:last-child {
        font-size: 0;
        width: 30px;
        padding: 15px 5px;
    }

    .data-table thead th:nth-child(1) {
        width: 30px;
    }

    /* Mobile sticky positioning */
    .data-table th {
        top: 65px !important;
    }

    .data-table tbody td {
        display: none;
    }

    /* Show only Type, Nom and Actions columns on mobile */
    .data-table tbody td:nth-child(1),
    .data-table tbody td:nth-child(3),
    .data-table tbody td:last-child {
        display: table-cell;
    }

    /* Show parent entity in parentheses on mobile */
    .parent-entity-mobile {
        display: inline;
        color: #718096;
        font-size: 0.85em;
        font-weight: 400;
    }

    /* Type column: minimal width for colored dot only */
    .data-table tbody td:nth-child(1) {
        padding: 10px 5px;
        width: 30px;
        text-align: center;
    }

    .data-table tbody td:nth-child(1) .badge {
        display: inline-block;
        width: 12px;
        height: 12px;
        border-radius: 50%;
        padding: 0;
        font-size: 0;
        min-width: 12px;
        margin: 0 auto;
    }

    /* Actions column: minimal width and right aligned */
    .data-table thead th:last-child,
    .data-table tbody td:last-child {
        width: 80px;
        padding: 10px 5px;
        text-align: right;
    }

    /* Name column: takes remaining space */
    .data-table thead th:nth-child(3),
    .data-table tbody td:nth-child(3) {
        width: auto;
    }

    .section-header {
        gap: 15px;
    }

    .filters-toggle {
        display: flex;
    }

    .filters {
        width: 100%;
        flex-direction: column;
        max-height: none !important;
        overflow: visible !important;
        transition: max-height 0.3s ease;
    }

    .filters.show {
        max-height: none !important;
    }

    /* Search input always visible on mobile */
    .search-input {
        width: 100%;
        margin-left: 0;
        display: block !important;
        visibility: visible !important;
        position: relative;
        order: -1; /* Place it before filter buttons */
        margin-bottom: 10px;
    }

    .filter-btn {
        width: 100%;
    }

    .header-stats {
        gap: 10px;
    }

    .stat-item {
        min-width: calc(50% - 5px);
        flex: 0 0 calc(50% - 5px);
    }

    .data-table {
        font-size: 0.85rem;
    }

    .data-table th,
    .data-table td {
        padding: 12px 8px;
    }

    .sidebar {
        width: 100%;
    }

    .sidebar-body {
        padding: 20px;
    }

    .tabs {
        overflow-x: auto;
    }

    .contacts-table {
        font-size: 0.8rem;
    }

    .contacts-table th,
    .contacts-table td {
        padding: 8px;
    }

    .clients-section {
        padding: 15px;
    }

    /* Hide table on mobile, show cards */
    #contacts-table-container.has-content {
        display: none !important;
    }

    #contacts-cards-container.has-content {
        display: block !important;
    }

    /* Align action buttons to the right on mobile */
    .action-buttons {
        justify-content: flex-end !important;
    }
}

/* Contact Cards for Mobile */
.contacts-cards-mobile {
    display: none;
    flex-direction: column;
    gap: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 0 0 12px 12px;
    padding: 15px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

/* Show containers when they have content */
#contacts-table-container.has-content {
    display: block;
}

#contacts-cards-container.has-content {
    display: none; /* Hidden by default on desktop */
}

.contact-card {
    background: white;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: all 0.2s;
}

.contact-card:last-child {
    margin-bottom: 0;
}

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

.contact-card-header {
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.contact-card-name {
    font-weight: 600;
    font-size: 1.05rem;
    color: #2d3748;
    margin-bottom: 4px;
}

.contact-card-fonction {
    font-size: 0.85rem;
    color: #718096;
    font-style: italic;
}

.contact-card-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.contact-card-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: #4a5568;
}

.contact-card-row svg {
    flex-shrink: 0;
    color: #667eea;
}

/* ====================================
 * LEFT SIDEBAR NAVIGATION
 * ==================================== */

/* Sidebar toggle button in header */
.sidebar-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: background 0.2s;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, 0.3);
}

.sidebar-toggle svg {
    width: 24px;
    height: 24px;
    color: #1a202c;
}

/* User info adjustments */
.user-info {
    margin-left: auto;
}

/* Logout icon button */
.logout-icon-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
}

.logout-icon-btn:hover {
    background: rgba(239, 68, 68, 0.1);
}

.logout-icon-btn svg {
    width: 20px;
    height: 20px;
    color: #e53e3e;
}

/* Left Sidebar Navigation */
.left-sidebar {
    position: fixed;
    top: 65px;
    left: 0;
    width: 250px;
    height: calc(100vh - 65px);
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-right: 1px solid rgba(255, 255, 255, 0.3);
    padding: 20px 0;
    transition: transform 0.3s ease;
    z-index: 900;
    overflow-y: auto;
}

.left-sidebar.open {
    transform: translateX(0);
}

.left-sidebar.closed {
    transform: translateX(-250px);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: #2d3748;
    text-decoration: none;
    transition: all 0.2s;
    font-size: 0.95rem;
    font-weight: 500;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, 0.4);
    color: #667eea;
}

.sidebar-link.active {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    border-right: 3px solid #667eea;
}

.sidebar-link svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.sidebar-link span {
    white-space: nowrap;
}

/* Main content adjustment for sidebar */
#main-app.sidebar-open {
    margin-left: 250px;
    transition: margin-left 0.3s ease;
}

#main-app.sidebar-closed {
    margin-left: 0;
    transition: margin-left 0.3s ease;
}

/* Close button for mobile sidebar - hidden on desktop */
.sidebar-close-btn {
    display: none;
}

/* Mobile: Full-page overlay menu */
@media (max-width: 768px) {
    /* Transform left sidebar into full-page overlay on mobile */
    .left-sidebar {
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        z-index: 10000;
        display: none;
        opacity: 0;
        transition: opacity 0.3s ease;
        padding: 0;
        position: relative;
    }

    .left-sidebar.open {
        display: flex;
        opacity: 1;
    }

    /* Close button for mobile menu */
    .sidebar-close-btn {
        display: flex;
        position: absolute;
        top: 20px;
        right: 20px;
        background: rgba(102, 126, 234, 0.1);
        border: none;
        width: 44px;
        height: 44px;
        border-radius: 50%;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        transition: all 0.2s;
        z-index: 10001;
    }

    .sidebar-close-btn:hover {
        background: rgba(102, 126, 234, 0.2);
        transform: scale(1.1);
    }

    .sidebar-close-btn svg {
        width: 24px;
        height: 24px;
        color: #667eea;
    }

    /* Center the navigation menu items */
    .sidebar-nav {
        width: 100%;
        height: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 20px;
        padding: 40px 20px;
    }

    /* Style menu links for mobile overlay */
    .left-sidebar .sidebar-link {
        width: 100%;
        max-width: 300px;
        padding: 18px 24px;
        text-align: center;
        justify-content: center;
        font-size: 1.1rem;
        border-radius: 12px;
        background: rgba(102, 126, 234, 0.05);
        border: 2px solid transparent;
    }

    .left-sidebar .sidebar-link:hover {
        background: rgba(102, 126, 234, 0.15);
        border-color: rgba(102, 126, 234, 0.3);
    }

    .left-sidebar .sidebar-link.active {
        background: rgba(102, 126, 234, 0.2);
        border-color: #667eea;
        border-right: 2px solid #667eea;
    }

    .left-sidebar .sidebar-link svg {
        width: 24px;
        height: 24px;
    }

    #main-app.sidebar-open,
    #main-app.sidebar-closed {
        margin-left: 0 !important;
    }

    /* Hide user name on mobile, show only avatar */
    .user-info .user-name {
        display: none;
    }

    .user-info {
        padding: 8px;
        min-width: auto;
    }
}
