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

body {
    font-family: 'Roboto', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header Styles */
header {
    background-color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    padding: 15px 0;
    width: 100%;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

@media (max-width: 767px) {
    .header-container {
        flex-wrap: wrap;
        gap: 10px;
    }
}

.logo-container {
    display: flex;
    align-items: center;
}

.logo {
    height: 45px;
    max-width: 100%;
}

.nav-links {
    display: flex;
    align-items: center;
    margin-left: auto;
    margin-right: 20px;
}

@media (max-width: 767px) {
    .nav-links {
        margin-right: auto;
        margin-left: 0;
        order: 3;
        width: 100%;
        justify-content: center;
        margin-top: 10px;
    }
}

.nav-link {
    color: #333;
    text-decoration: none;
    padding: 8px 16px;
    font-weight: 500;
    transition: color 0.2s, background-color 0.2s;
    border-radius: 4px;
}

.nav-link:hover,
.nav-link.active {
    color: #1a56db;
    background-color: #f0f4ff;
}

.user-profile {
    position: relative;
}

.profile-pic-container {
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid #1a56db;
}

.profile-pic {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.dropdown-menu {
    position: absolute;
    top: 50px;
    right: 0;
    background-color: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    width: 150px;
    display: none;
    z-index: 10;
}

.dropdown-menu.active {
    display: block;
}

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

.dropdown-menu li {
    padding: 0;
}

.dropdown-menu a {
    display: block;
    padding: 12px 15px;
    color: #333;
    text-decoration: none;
    transition: background-color 0.2s;
}

.dropdown-menu a:hover {
    background-color: #f0f4ff;
}

/* Main Content Styles */
main {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 20px;
}

@media (max-width: 768px) {
    main {
        padding: 20px 15px;
    }
}

.hero {
    text-align: center;
    margin-bottom: 50px;
}

h1 {
    font-size: 32px;
    margin-bottom: 15px;
    color: #1a56db;
}

h2 {
    font-size: 24px;
    margin-bottom: 15px;
    color: #1a56db;
}

.search-container {
    display: flex;
    max-width: 600px;
    margin: 30px auto;
    flex-direction: column;
    gap: 10px;
}

@media (min-width: 768px) {
    .search-container {
        flex-direction: row;
    }
}

input[type="text"] {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 16px;
}

button {
    padding: 12px 25px;
    background-color: #1a56db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    transition: background-color 0.3s;
}

button:hover {
    background-color: #0e3fa9;
}

.notification {
    background-color: #d1e7dd;
    color: #0f5132;
    padding: 15px;
    border-radius: 4px;
    margin-top: 20px;
    transition: opacity 0.3s ease;
}

.notification.hidden {
    display: none;
}

/* Processing Section Styles */
.processing-section {
    background-color: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.processing-list {
    margin-top: 20px;
}

.processing-item {
    padding: 15px;
    border-left: 4px solid #1a56db;
    background-color: #f0f4ff;
    margin-bottom: 10px;
    border-radius: 0 4px 4px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.empty-message {
    color: #6c757d;
    font-style: italic;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(26, 86, 219, 0.3);
    border-radius: 50%;
    border-top-color: #1a56db;
    animation: spin 1s linear infinite;
}

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

/* Footer Styles */
footer {
    text-align: center;
    padding: 20px;
    background-color: white;
    color: #6c757d;
    box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.05);
    margin-top: 50px;
}

/* Navigation Links */
.logo-container a {
    text-decoration: none;
    display: flex;
    align-items: center;
}

/* My Leads Page Styles */
.page-header {
    text-align: center;
    margin-bottom: 30px;
}

.page-header h1 {
    font-size: clamp(24px, 5vw, 32px);
}

.page-header p {
    font-size: clamp(14px, 3vw, 16px);
    max-width: 600px;
    margin: 0 auto;
}

.leads-section {
    background-color: white;
    padding: clamp(15px, 3vw, 30px);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    width: 100%;
}

.leads-controls {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
    width: 100%;
}

@media (min-width: 768px) {
    .leads-controls {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    
    .search-box {
        flex: 1;
        max-width: 60%;
    }
    
    .filter-controls {
        width: auto;
    }
}

.search-box {
    width: 100%;
}

.search-box input {
    padding: 10px 15px;
    border: 1px solid #ccc;
    border-radius: 4px;
    width: 100%;
    font-size: clamp(14px, 2vw, 16px);
}

.filter-controls {
    width: 100%;
}

.filter-controls select {
    padding: 10px 15px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: white;
    width: 100%;
    font-size: clamp(14px, 2vw, 16px);
    cursor: pointer;
}

/* Style for same-company rows */
.leads-table tbody tr.same-company {
    border-top: 1px dashed #ccc;
}

.leads-table tbody tr.first-contact {
    border-top: 1px solid #ddd;
}

.leads-table tbody tr.first-contact td[data-label="Company"],
.leads-table tbody tr.first-contact td[data-label="Address"] {
    font-weight: 500;
    vertical-align: middle;
}

.leads-table tbody tr:not(.first-contact) td[data-label="Company"],
.leads-table tbody tr:not(.first-contact) td[data-label="Address"] {
    opacity: 0.7;
}

.empty-leads td {
    text-align: center;
    padding: 30px;
    color: #6c757d;
    font-style: italic;
}

.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

@media (max-width: 480px) {
    .pagination {
        justify-content: center;
    }
}

.pagination-btn {
    padding: 8px 15px;
    background-color: #1a56db;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: clamp(12px, 2vw, 14px);
}

.pagination-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.page-info {
    color: #6c757d;
    font-size: clamp(12px, 2vw, 14px);
}

.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge.new {
    background-color: #e6f7ff;
    color: #0070f3;
}

.status-badge.contacted {
    background-color: #fff7e6;
    color: #fa8c16;
}

.status-badge.qualified {
    background-color: #f6ffed;
    color: #52c41a;
}

.action-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    margin-right: 5px;
}

.view-btn {
    background-color: #e6f7ff;
    color: #0070f3;
}

.edit-btn {
    background-color: #fff7e6;
    color: #fa8c16;
}

.action-btn:hover {
    opacity: 0.8;
}

/* My Leads Page Layout */
.leads-layout {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 20px;
}

.page-title {
    text-align: center;
    margin-bottom: 30px;
    font-size: clamp(24px, 5vw, 32px);
    color: #1a56db;
}

.leads-container {
    display: flex;
    gap: 20px;
    width: 100%;
}

@media (max-width: 768px) {
    .leads-container {
        flex-direction: column;
    }
}

/* Keywords Sidebar */
.keywords-sidebar {
    width: 25%;
    min-width: 200px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

@media (max-width: 768px) {
    .keywords-sidebar {
        width: 100%;
    }
}

.keyword-item {
    padding: 15px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background-color 0.2s;
}

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

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

.keyword-item.active {
    background-color: #f0f4ff;
    border-left: 4px solid #1a56db;
    font-weight: 500;
}

/* Main Content Area */
.leads-content {
    flex: 1;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: clamp(15px, 3vw, 30px);
    overflow: visible;
    min-width: 0;
}

.leads-controls {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
    width: 100%;
}

@media (max-width: 768px) {
    .leads-controls {
        flex-direction: column;
    }
}

.search-box {
    width: 50%;
}

.filter-controls {
    width: 50%;
}

@media (max-width: 768px) {
    .search-box,
    .filter-controls {
        width: 100%;
    }
}

.search-box input {
    padding: 10px 15px;
    border: 1px solid #ccc;
    border-radius: 4px;
    width: 100%;
    font-size: clamp(14px, 2vw, 16px);
}

.filter-controls select {
    padding: 10px 15px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background-color: white;
    width: 100%;
    font-size: clamp(14px, 2vw, 16px);
    cursor: pointer;
    appearance: menulist;
}

/* Table Styles */
.leads-table-container {
    overflow-x: auto;
    width: 100%;
    margin-bottom: 20px;
    border-radius: 4px;
    max-height: calc(100vh - 280px); /* Set a maximum height */
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    scrollbar-width: thin; /* For Firefox */
}

.leads-table {
    width: auto; /* Allow table to size to content */
    border-collapse: collapse;
    min-width: 100%; /* Fill container width */
    table-layout: auto; /* Use auto layout for dynamic column widths */
}

.leads-table th,
.leads-table td {
    padding: clamp(8px, 1.5vw, 12px) clamp(10px, 2vw, 15px);
    text-align: left;
    border-bottom: 1px solid #eee;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap; /* Prevent line breaks */
}

/* Style for rowspan merged cells */
.leads-table td[rowspan] {
    vertical-align: top;
    background-color: #f8f9fa;
    border-right: 1px solid #eee;
}

/* Style for first-contact rows */
.leads-table tr.first-contact {
    border-top: 2px solid #ddd;
}

/* Style for same-company rows */
.leads-table tr.same-company {
    border-top: 1px solid #f0f0f0;
}

/* Hover effect for entire company group */
.leads-table tr:hover td,
.leads-table tr:hover td[rowspan] {
    background-color: #f0f4ff;
}

/* Remove fixed widths for columns to make them dynamic */
.leads-table th:nth-child(1),
.leads-table td:nth-child(1),
.leads-table th:nth-child(2),
.leads-table td:nth-child(2),
.leads-table th:nth-child(3),
.leads-table td:nth-child(3),
.leads-table th:nth-child(4),
.leads-table td:nth-child(4),
.leads-table th:nth-child(5),
.leads-table td:nth-child(5),
.leads-table th:nth-child(6),
.leads-table td:nth-child(6),
.leads-table th:nth-child(7),
.leads-table td:nth-child(7),
.leads-table th:nth-child(8),
.leads-table td:nth-child(8),
.leads-table th:nth-child(9),
.leads-table td:nth-child(9) {
    min-width: auto;
    max-width: none;
}

/* Only the Note column can wrap */
.leads-table td[data-label="Note"] {
    white-space: normal;
    min-width: 150px;
}

/* Keep buttons on one line */
.leads-table td[data-label="Actions"] {
    white-space: nowrap;
    min-width: 140px;
}

/* Make email column have space for the button */
.leads-table td[data-label="Email"] {
    min-width: 220px;
}

.leads-table th {
    background-color: #f8f9fa;
    font-weight: 500;
    color: #1a56db;
    position: sticky;
    top: 0;
    z-index: 1;
}

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

.leads-table tbody tr:hover {
    background-color: #f9f9f9;
}

/* Responsive table for smaller screens */
@media (max-width: 767px) {
    .leads-table {
        min-width: auto;
        border: none;
    }
    
    .leads-table thead {
        display: none;
    }
    
    /* Hide rowspan attributes on mobile - override */
    .leads-table td[rowspan] {
        display: block !important;
        background-color: #f0f4ff;
        border-bottom: 1px solid #ddd;
        padding-top: 15px;
        font-weight: bold;
    }
    
    /* Show company/address on all rows for mobile */
    .leads-table tr.same-company {
        position: relative;
        border-left: 3px solid #1a56db;
    }
    
    .leads-table tr.same-company:before {
        content: attr(data-company);
        display: none; /* Hide by default, will add via JS if needed */
        background: #f0f4ff;
        font-size: 11px;
        padding: 2px 8px;
        border-radius: 4px;
        position: absolute;
        top: -8px;
        left: 10px;
    }
    
    .leads-table tbody tr {
        display: block;
        margin-bottom: 15px;
        border: 1px solid #eee;
        border-radius: 4px;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }
    
    .leads-table td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 10px 15px;
        text-align: right;
        border-bottom: 1px solid #f0f0f0;
        white-space: normal;
        max-width: 100%;
    }
    
    .leads-table td:last-child {
        border-bottom: none;
    }
    
    .leads-table td::before {
        content: attr(data-label);
        font-weight: 500;
        text-align: left;
        color: #555;
        margin-right: 10px;
        flex-shrink: 0;
        width: 100px;
    }
    
    .leads-table td[data-label="Status"] {
        justify-content: flex-end;
    }
    
    .leads-table td[data-label="Actions"] {
        justify-content: center;
    }
    
    .leads-table td[data-label="Note"] {
        align-items: flex-start;
    }

    .empty-leads td {
        display: block;
        text-align: center;
    }

    .empty-leads td::before {
        content: none;
    }

    .leads-table td[data-label="Address"] {
        align-items: flex-start;
    }

    .leads-table td[data-label="Email"] {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .leads-table td[data-label="Email"]::before {
        margin-bottom: 8px;
        width: 100%;
    }
    
    .leads-table td[data-label="Email"] .email-action {
        width: 100%;
        margin-top: 10px;
    }
    
    .leads-table td[data-label="Email"] .email-btn {
        width: 100%;
        padding: 8px 12px;
        font-size: 14px;
    }
}

/* Email action button */
.email-action {
    margin-top: 8px;
}

.email-btn {
    display: inline-block;
    font-size: 12px;
    padding: 6px 10px;
    background-color: #1a56db;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    transition: background-color 0.2s;
    white-space: nowrap;
    text-align: center;
}

.email-btn:hover {
    background-color: #0e3fa9;
    text-decoration: none;
    color: white;
}

/* Company column styling */
.leads-table th:nth-child(1),
.leads-table td:nth-child(1) {
    font-weight: 500;
}

.leads-table tr.first-contact td[data-label="Company"] {
    font-weight: 600;
} 