/* Arkportal - Lead Management System Styles */

:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navigation */
.navbar {
    background-color: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand a {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    text-decoration: none;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-menu a {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.nav-menu a:hover {
    color: var(--primary-color);
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding-left: 1rem;
    border-left: 1px solid var(--border-color);
}

.role-badge {
    background-color: var(--primary-color);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

/* Main Content */
.main-content {
    flex: 1;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    padding: 2rem;
}

/* Flash Messages */
.flash-messages {
    margin-bottom: 1.5rem;
}

.flash {
    padding: 1rem;
    border-radius: 0.5rem;
    margin-bottom: 0.5rem;
    border-left: 4px solid;
}

.flash-success {
    background-color: #d1fae5;
    border-color: var(--success-color);
    color: #065f46;
}

.flash-error {
    background-color: #fee2e2;
    border-color: var(--error-color);
    color: #991b1b;
}

.flash-info {
    background-color: #dbeafe;
    border-color: var(--primary-color);
    color: #1e40af;
}

/* Cards */
.card {
    background-color: var(--card-bg);
    border-radius: 0.5rem;
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    font-weight: 500;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.875rem;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-danger {
    background-color: var(--error-color);
    color: white;
}

.btn-sm {
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    font-size: 0.875rem;
    transition: border-color 0.2s;
}

.form-control-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.8125rem;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.filter-multiselect {
    min-height: 100px;
}

.filter-multiselect option {
    padding: 0.25rem 0.5rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.lead-detail-address-block {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    align-items: flex-start;
}
.lead-detail-address-item {
    min-width: 0;
}
.lead-detail-address-item > div:first-child { margin-bottom: 0.25rem; }

.poach-row-clickable {
    cursor: pointer;
}
.poach-row-clickable:hover td {
    background-color: rgba(37, 99, 235, 0.04);
}

/* Global search (Poaches list header) */
.poaches-list-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.poaches-list-header .card-title {
    margin-right: 0.5rem;
}
.global-search-wrap {
    flex: 1;
    min-width: 200px;
    max-width: 420px;
    position: relative;
}
.global-search-input {
    width: 100%;
}
.global-search-results {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 0.25rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: var(--shadow-lg);
    max-height: 70vh;
    overflow: auto;
    z-index: 1000;
}
.global-search-results.open {
    display: block;
}
.global-search-empty {
    padding: 1rem;
    color: var(--text-secondary);
    text-align: center;
}
.global-search-table {
    font-size: 0.875rem;
    margin: 0;
}
.global-search-table th,
.global-search-table td {
    padding: 0.5rem 0.6rem;
    white-space: nowrap;
}
.global-search-table .global-search-matched {
    white-space: normal;
    max-width: 180px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}
.global-search-table .matched-field {
    font-weight: 600;
    color: var(--text-primary);
}
.text-muted {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Poach detail: two-column layout on desktop */
.poach-detail-columns {
    display: block;
}
.poach-detail-top-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.5rem 1rem;
    margin-bottom: 0.5rem;
}
@media (max-width: 767px) {
    .poach-detail-top-grid {
        grid-template-columns: 1fr;
    }
}
.poach-detail-notes .notes-section .poach-note-form {
    margin-bottom: 1rem;
}
.poach-detail-notes .notes-list {
    margin-top: 0.5rem;
}
@media (min-width: 992px) {
    .poach-detail-columns {
        display: grid;
        grid-template-columns: 2fr 1fr;
        gap: 1.5rem;
        align-items: start;
    }
    .poach-detail-main {
        min-width: 0;
    }
    .poach-detail-notes {
        min-width: 0;
        position: sticky;
        top: 1rem;
        margin-top: 0;
        padding-top: 0;
    }
    .poach-detail-notes .card {
        margin-top: 0;
    }
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

select.form-control {
    cursor: pointer;
}

/* Tables */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--card-bg);
}

thead {
    background-color: var(--bg-color);
}

th, td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

tbody tr:hover {
    background-color: var(--bg-color);
}

.hidden {
    display: none !important;
}

.poach-status-clickable {
    cursor: pointer;
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.status-new {
    background-color: #dbeafe;
    color: #1e40af;
}

.status-active {
    background-color: #d1fae5;
    color: #065f46;
}

.status-pending {
    background-color: #fef3c7;
    color: #92400e;
}

.status-closed {
    background-color: #e5e7eb;
    color: #374151;
}

/* Poach status colors */
.status-new {
    background-color: #d1fae5;
    color: #065f46;
}
.status-dialed,
.status-contacted {
    background-color: #fef3c7;
    color: #92400e;
}
.status-converted {
    background-color: #dbeafe;
    color: #1e40af;
}
.status-not-interested {
    background-color: #fee2e2;
    color: #991b1b;
}
.status-sold-out {
    background-color: #e5e7eb;
    color: #374151;
}

/* Dashboard */
.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.dashboard-boxes {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.dashboard-box {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.dashboard-box-content {
    display: flex;
    align-items: center;
    gap: 2rem;
    min-height: 200px;
}

.dashboard-box-left {
    flex: 0 0 auto;
}

.dashboard-box-right {
    flex: 1 1 auto;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
    position: relative;
}

.dashboard-box-right canvas {
    max-width: 100%;
    max-height: 200px;
}

.stat-card {
    background-color: transparent;
    padding: 0;
    border-radius: 0;
    box-shadow: none;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

@media (max-width: 768px) {
    .dashboard-boxes {
        grid-template-columns: 1fr;
    }
    
    .dashboard-box-content {
        flex-direction: column;
        align-items: stretch;
    }
    
    .dashboard-box-left {
        text-align: center;
    }
    
    .dashboard-box-right {
        min-height: 250px;
    }
}

/* Contact Info */
.contact-info-section {
    margin-top: 2rem;
}

.contact-type {
    margin-bottom: 2rem;
}

.contact-type h4 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.contact-item {
    background-color: var(--bg-color);
    padding: 1rem;
    border-radius: 0.375rem;
    margin-bottom: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.contact-item-content {
    flex: 1;
}

.contact-item-value {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.contact-item-note {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.contact-item-actions {
    display: flex;
    gap: 0.5rem;
}

/* Notes */
.notes-section {
    margin-top: 2rem;
}

.note-item {
    background-color: var(--bg-color);
    padding: 1rem;
    border-radius: 0.375rem;
    margin-bottom: 1rem;
    border-left: 3px solid var(--primary-color);
}

.note-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.note-author {
    font-weight: 500;
    color: var(--text-primary);
}

.note-date {
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.note-content {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.note-attachments {
    margin-top: 0.5rem;
}

.attachment-item {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    background-color: var(--card-bg);
    border-radius: 0.25rem;
    font-size: 0.75rem;
    margin-right: 0.5rem;
    margin-top: 0.25rem;
}

/* Audit Log */
.audit-log {
    margin-top: 2rem;
}

.audit-item {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.875rem;
}

.audit-action {
    font-weight: 500;
    color: var(--primary-color);
}

.audit-user {
    color: var(--text-secondary);
}

.audit-time {
    color: var(--text-secondary);
    float: right;
}

/* Footer */
.footer {
    background-color: var(--card-bg);
    border-top: 1px solid var(--border-color);
    padding: 1.5rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    .nav-menu {
        flex-direction: column;
        gap: 1rem;
        width: 100%;
    }

    .nav-user {
        border-left: none;
        border-top: 1px solid var(--border-color);
        padding-top: 1rem;
        padding-left: 0;
        width: 100%;
        justify-content: space-between;
    }

    .main-content {
        padding: 1rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .dashboard-stats {
        grid-template-columns: 1fr;
    }

    .table-container {
        overflow-x: scroll;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .contact-item {
        flex-direction: column;
    }

    .contact-item-actions {
        margin-top: 0.5rem;
        width: 100%;
    }
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.d-flex {
    display: flex;
}

.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }
