/* CRM Dashboard Styles */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

/* Header and Navigation Styles */
.navigation-bar {
    background: #e3d6c3;
    border-bottom: 1px solid #e3d6c3;
    padding: 1rem 0;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.app-title {
    flex-shrink: 0;
}

.app-title h1 {
    color: #ffffff;
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.025em;
    font-family: 'Inter', sans-serif;
}

.user-nav ul {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 1.5rem;
    align-items: center;
}

.user-nav a {
    color: #d1d5db;
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.user-nav a:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

.logout-form button {
    background: #dc2626;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease;
}

.logout-form button:hover {
    background: #b91c1c;
}

@media (max-width: 768px) {
    .app-title h1 {
        font-size: 1.5rem;
    }

    .user-nav ul {
        gap: 1rem;
        flex-wrap: wrap;
    }

    .user-nav a {
        padding: 0.375rem 0.75rem;
        font-size: 0.9rem;
    }
}

/* Metrics Grid Styles */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.metric-card {
    text-align: center;
    padding: 1rem;
    background: #f8fafc;
    border-radius: 6px;
    border: 1px solid #e2e8f0;
    display: flex;
    flex-direction: column;
    min-height: 120px;
    gap: 0.5rem;
}

.metric-card h3 {
    font-size: 2rem;
    font-weight: bold;
    color: #2d3748;
    margin: 0;
}

.metric-card p {
    color: #718096;
    margin: 0;
    font-size: 0.9rem;
}

.metric-actions {
    margin-top: auto;
    display: flex;
    justify-content: flex-end;
}

.metric-link {
    color: #3182ce;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
}

.metric-link:hover {
    text-decoration: underline;
}

/* Metric card subcounts */
.inactive-count, .lost-count, .converted-count {
    display: block;
    font-size: 0.75rem;
    color: #718096;
    margin-top: 0.25rem;
    opacity: 0.8;
}

.lost-count {
    color: #d69e2e;
}

.converted-count {
    color: #38a169;
}

.lead-subcounts {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

/* Action Grid Styles */
.action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.link-card {
    display: block;
    padding: 1rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
}

.link-card:hover {
    background: #edf2f7;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.link-card h3 {
    margin: 0 0 0.5rem 0;
    color: #2d3748;
    font-size: 1rem;
}

.link-card p {
    margin: 0;
    color: #718096;
    font-size: 0.9rem;
}

/* Status Lists */
.status-list > * + * {
    margin-top: 0.5rem;
}

.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #e2e8f0;
}

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

.status-label {
    font-weight: 500;
    color: #2d3748;
}

.status-count {
    background: #e2e8f0;
    color: #4a5568;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
}

/* Activity Lists */
.activity-list > * + * {
    margin-top: 1rem;
}

.activity-item {
    padding: 1rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
}

.activity-content strong {
    color: #2d3748;
}

.activity-type {
    background: #bee3f8;
    color: #2b6cb0;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 0.5rem;
}

.activity-description {
    margin: 0.5rem 0;
    color: #4a5568;
    font-size: 0.9rem;
}

.activity-date {
    color: #718096;
    font-size: 0.8rem;
}

/* Customer/Lead Grid Styles */
.customers-grid, .leads-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.customer-card, .lead-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.customer-header, .lead-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.customer-name, .lead-name {
    margin: 0;
    font-size: 1.1rem;
}

.customer-name a, .lead-name a {
    color: #2d3748;
    text-decoration: none;
}

.customer-name a:hover, .lead-name a:hover {
    color: #3182ce;
    text-decoration: underline;
}

.customer-details, .lead-details {
    margin-bottom: 1rem;
}

.customer-details p, .lead-details p {
    margin: 0.25rem 0;
    font-size: 0.9rem;
    color: #4a5568;
}

.customer-actions, .lead-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-active { background: #c6f6d5; color: #22543d; }
.status-inactive { background: #fed7d7; color: #742a2a; }
.status-vip { background: #fde68a; color: #92400e; }
.status-onboarding { background: #bfdbfe; color: #1e40af; }
.status-new { background: #e0e7ff; color: #3730a3; }
.status-contacted { background: #dbeafe; color: #1e40af; }
.status-qualified { background: #d1fae5; color: #065f46; }
.status-converted { background: #dcfce7; color: #166534; }

/* Form Styles */
.form-section {
    padding: 2rem 0;
}

.form-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 2rem;
    max-width: 600px;
    margin: 0 auto;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.customer-form, .lead-form {
    /* Spacing handled by .form-group margin-bottom */
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #374151;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

/* Search Section */
.search-section {
    margin-bottom: 2rem;
}

.search-form {
    display: flex;
    gap: 1rem;
    align-items: center;
    max-width: 600px;
}

.search-input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 1rem;
}

/* Page Header */
.page-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

/* Detail Pages */
.details-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

@media (max-width: 768px) {
    .details-grid {
        grid-template-columns: 1fr;
    }
}

.info-card, .interaction-form-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.info-grid {
    display: grid;
    gap: 1rem;
}

.info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f1f5f9;
}

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

.info-item label {
    font-weight: 600;
    color: #374151;
    margin: 0;
}

.info-item span {
    color: #4b5563;
}

.notes-section {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid #e5e7eb;
}

.notes-section label {
    font-weight: 600;
    color: #374151;
    margin-bottom: 0.5rem;
}

.interactions-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.interactions-list > * + * {
    margin-top: 1rem;
}

.interaction-item {
    padding: 1rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
}

.interaction-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.interaction-type {
    background: #dbeafe;
    color: #1e40af;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.interaction-date {
    color: #6b7280;
    font-size: 0.8rem;
    margin-left: auto;
}

.interaction-description {
    color: #4b5563;
    font-size: 0.9rem;
    line-height: 1.5;
}

.interaction-form > * + * {
    margin-top: 1rem;
}

/* Empty States */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    background: #f8fafc;
    border: 1px dashed #cbd5e0;
    border-radius: 8px;
}

.empty-state h3 {
    color: #4a5568;
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: #718096;
    margin-bottom: 1.5rem;
}

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1.5rem;
    border: 1px solid;
}

.alert-error {
    background-color: #fef2f2;
    border-color: #fca5a5;
    color: #991b1b;
}

/* Responsive Design */
@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .metrics-grid {
        grid-template-columns: 1fr 1fr;
    }

    .action-grid {
        grid-template-columns: 1fr;
    }

    .customers-grid, .leads-grid {
        grid-template-columns: 1fr;
    }

    .search-form {
        flex-direction: column;
        align-items: stretch;
    }

    .page-header-content {
        flex-direction: column;
        align-items: flex-start;
    }

    .customer-actions, .lead-actions {
        justify-content: flex-start;
    }
}

/* CRM Entity Links */
.entity-link {
    display: inline-block;
    padding: 2px 6px;
    margin: 0 2px;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9em;
    transition: all 0.2s ease;
    border: 1px solid;
}

.entity-link:hover {
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.lead-link {
    background-color: #e0f2fe;
    color: #0277bd;
    border-color: #0277bd;
}

.lead-link:hover {
    background-color: #b3e5fc;
    color: #01579b;
    border-color: #01579b;
}

.customer-link {
    background-color: #e8f5e8;
    color: #2e7d32;
    border-color: #2e7d32;
}

.customer-link:hover {
    background-color: #c8e6c9;
    color: #1b5e20;
    border-color: #1b5e20;
}
