/**
 * Absoluit Lead CRM - Modern SaaS Stylesheet
 * Conflict-safe scoping under .acrm-* classes.
 */

:root {
    --acrm-bg-page: #f8fafc;
    --acrm-bg-card: #ffffff;
    --acrm-bg-sidebar: #0f172a;
    --acrm-bg-sidebar-hover: #1e293b;
    --acrm-text-main: #0f172a;
    --acrm-text-muted: #64748b;
    --acrm-text-white: #f8fafc;
    --acrm-primary: #3b82f6;
    --acrm-primary-hover: #2563eb;
    --acrm-border: #e2e8f0;
    --acrm-radius: 8px;
    --acrm-radius-lg: 12px;
    --acrm-shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --acrm-shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --acrm-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

/* Reset / Box sizing */
.acrm-portal-container,
.acrm-login-wrapper {
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    color: var(--acrm-text-main);
    line-height: 1.5;
}

.acrm-portal-container *,
.acrm-login-wrapper * {
    box-sizing: border-box;
}

/* Icons */
.acrm-icon {
    width: 20px;
    height: 20px;
    display: inline-block;
    vertical-align: middle;
}

/* Login Card Styling */
.acrm-login-wrapper {
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #f0fdf4 0%, #f8fafc 50%, #eff6ff 100%);
}

.acrm-login-card {
    width: 100%;
    max-width: 440px;
    background: var(--acrm-bg-card);
    border-radius: var(--acrm-radius-lg);
    box-shadow: var(--acrm-shadow-lg);
    border: 1px solid var(--acrm-border);
    padding: 36px 32px;
}

.acrm-brand-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.acrm-logo-icon {
    font-size: 24px;
    background: #eff6ff;
    padding: 6px;
    border-radius: 8px;
}

.acrm-logo-text {
    font-size: 22px;
    font-weight: 800;
    color: var(--acrm-text-main);
}

.acrm-logo-text span {
    color: var(--acrm-primary);
}

.acrm-login-header h2 {
    font-size: 20px;
    margin: 0 0 6px 0;
    color: var(--acrm-text-main);
    font-weight: 700;
}

.acrm-login-header p {
    font-size: 14px;
    color: var(--acrm-text-muted);
    margin: 0 0 24px 0;
}

/* Forms & Inputs */
.acrm-form-group {
    margin-bottom: 18px;
}

.acrm-form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--acrm-text-main);
    margin-bottom: 6px;
}

.acrm-input, .acrm-select {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    border: 1px solid var(--acrm-border);
    border-radius: var(--acrm-radius);
    background: #ffffff;
    color: var(--acrm-text-main);
    outline: none;
    transition: all 0.2s;
}

.acrm-input:focus, .acrm-select:focus {
    border-color: var(--acrm-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Buttons */
.acrm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 16px;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--acrm-radius);
    border: none;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
    text-decoration: none;
}

.acrm-btn-primary {
    background: var(--acrm-primary);
    color: #ffffff;
}

.acrm-btn-primary:hover {
    background: var(--acrm-primary-hover);
}

.acrm-btn-secondary {
    background: #ffffff;
    border: 1px solid var(--acrm-border);
    color: var(--acrm-text-main);
}

.acrm-btn-secondary:hover {
    background: #f1f5f9;
}

.acrm-btn-block {
    width: 100%;
}

.acrm-btn-logout {
    color: #94a3b8;
    padding: 8px;
    border-radius: var(--acrm-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
}

.acrm-btn-logout:hover {
    background: var(--acrm-bg-sidebar-hover);
    color: #f87171;
}

/* Alerts */
.acrm-alert {
    padding: 12px 14px;
    border-radius: var(--acrm-radius);
    font-size: 13px;
    margin-bottom: 16px;
}

.acrm-alert-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.acrm-alert-warning { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.acrm-alert-danger { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.acrm-alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }

/* Dashboard Portal Layout */
.acrm-portal-container {
    display: flex;
    min-height: 85vh;
    background: var(--acrm-bg-page);
    border-radius: var(--acrm-radius-lg);
    box-shadow: var(--acrm-shadow-md);
    overflow: hidden;
    margin: 20px 0;
    border: 1px solid var(--acrm-border);
}

/* Sidebar */
.acrm-sidebar {
    width: 260px;
    background: var(--acrm-bg-sidebar);
    color: var(--acrm-text-white);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.acrm-sidebar-brand {
    padding: 24px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--acrm-bg-sidebar-hover);
}

.acrm-brand-title {
    font-size: 18px;
    font-weight: 700;
}

.acrm-brand-tag {
    font-size: 11px;
    background: var(--acrm-primary);
    color: #fff;
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 4px;
}

.acrm-nav {
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-grow: 1;
}

.acrm-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    color: #94a3b8;
    text-decoration: none;
    border-radius: var(--acrm-radius);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s;
}

.acrm-nav-item:hover {
    background: var(--acrm-bg-sidebar-hover);
    color: #ffffff;
}

.acrm-nav-item.active {
    background: var(--acrm-primary);
    color: #ffffff;
}

.acrm-sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--acrm-bg-sidebar-hover);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.acrm-user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    overflow: hidden;
}

.acrm-user-avatar {
    width: 34px;
    height: 34px;
    background: #334155;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: #ffffff;
    flex-shrink: 0;
}

.acrm-user-meta {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.acrm-user-name {
    font-size: 13px;
    font-weight: 600;
    color: #f8fafc;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.acrm-user-role {
    font-size: 11px;
    color: #94a3b8;
    text-transform: capitalize;
}

/* Main Area */
.acrm-main {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    background: var(--acrm-bg-page);
    overflow-x: hidden;
}

.acrm-topbar {
    padding: 16px 24px;
    background: var(--acrm-bg-card);
    border-bottom: 1px solid var(--acrm-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.acrm-page-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--acrm-text-main);
}

.acrm-view {
    display: none;
    padding: 24px;
}

.acrm-view.active {
    display: block;
}

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

.acrm-view-header h2 {
    margin: 0;
    font-size: 20px;
}

.acrm-view-header p {
    margin: 4px 0 0;
    font-size: 13px;
    color: var(--acrm-text-muted);
}

/* Metrics Grid */
.acrm-metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.acrm-metric-card {
    background: var(--acrm-bg-card);
    padding: 18px;
    border-radius: var(--acrm-radius);
    border: 1px solid var(--acrm-border);
    box-shadow: var(--acrm-shadow-sm);
    border-left: 4px solid #94a3b8;
}

.acrm-metric-card.border-blue { border-left-color: #3b82f6; }
.acrm-metric-card.border-orange { border-left-color: #f59e0b; }
.acrm-metric-card.border-purple { border-left-color: #8b5cf6; }
.acrm-metric-card.border-green { border-left-color: #10b981; }
.acrm-metric-card.border-gray { border-left-color: #64748b; }

.acrm-metric-label {
    font-size: 13px;
    color: var(--acrm-text-muted);
    font-weight: 500;
    margin-bottom: 6px;
}

.acrm-metric-value {
    font-size: 28px;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 6px;
}

.acrm-metric-sub {
    font-size: 11px;
    color: var(--acrm-text-muted);
}

.text-blue { color: #3b82f6; }
.text-orange { color: #f59e0b; }
.text-purple { color: #8b5cf6; }
.text-green { color: #10b981; }
.text-gray { color: #64748b; }

/* Panels & Charts */
.acrm-stats-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.acrm-panel {
    background: var(--acrm-bg-card);
    border: 1px solid var(--acrm-border);
    border-radius: var(--acrm-radius);
    box-shadow: var(--acrm-shadow-sm);
    overflow: hidden;
}

.acrm-panel-header {
    padding: 14px 18px;
    border-bottom: 1px solid var(--acrm-border);
}

.acrm-panel-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
}

.acrm-panel-body {
    padding: 18px;
}

.acrm-velocity-stats {
    display: flex;
    justify-content: space-around;
    text-align: center;
}

.acrm-velocity-item .label {
    display: block;
    font-size: 12px;
    color: var(--acrm-text-muted);
    margin-bottom: 4px;
}

.acrm-velocity-item .val {
    font-size: 22px;
    font-weight: 700;
    color: var(--acrm-primary);
}

.acrm-pipeline-bar-wrapper {
    height: 14px;
    background: #e2e8f0;
    border-radius: 7px;
    overflow: hidden;
    margin-bottom: 14px;
}

.acrm-pipeline-bar {
    display: flex;
    height: 100%;
}

.acrm-pipeline-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 12px;
}

.acrm-pipeline-legend .dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 4px;
}

.bg-blue { background-color: #3b82f6; }
.bg-orange { background-color: #f59e0b; }
.bg-purple { background-color: #8b5cf6; }
.bg-green { background-color: #10b981; }
.bg-gray { background-color: #64748b; }

/* Filters Bar */
.acrm-filters-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    margin-bottom: 16px;
}

.acrm-filter-input {
    min-width: 260px;
}

.acrm-filter-select {
    min-width: 170px;
}

.acrm-filter-actions {
    margin-left: auto;
}

/* Tables */
.acrm-card-table {
    background: var(--acrm-bg-card);
    border-radius: var(--acrm-radius);
    border: 1px solid var(--acrm-border);
    box-shadow: var(--acrm-shadow-sm);
    overflow-x: auto;
}

.acrm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}

.acrm-table th {
    background: #f8fafc;
    padding: 12px 16px;
    font-weight: 600;
    color: var(--acrm-text-muted);
    border-bottom: 1px solid var(--acrm-border);
}

.acrm-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--acrm-border);
    color: var(--acrm-text-main);
    vertical-align: middle;
}

.acrm-table tr:hover td {
    background: #f8fafc;
}

.acrm-empty-state {
    text-align: center;
    padding: 30px !important;
    color: var(--acrm-text-muted);
}

/* Badges */
.acrm-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: capitalize;
}

.acrm-badge-new { background: #eff6ff; color: #1d4ed8; }
.acrm-badge-contacted { background: #fffbeb; color: #b45309; }
.acrm-badge-qualified { background: #f5f3ff; color: #6d28d9; }
.acrm-badge-converted { background: #ecfdf5; color: #047857; }
.acrm-badge-closed, .acrm-badge-lost { background: #f1f5f9; color: #475569; }

/* Pagination */
.acrm-pagination-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 4px;
}

.acrm-pagination-info {
    font-size: 13px;
    color: var(--acrm-text-muted);
}

.acrm-pagination-btns {
    display: flex;
    gap: 6px;
}

.acrm-pagination-btns button {
    padding: 4px 10px;
    border: 1px solid var(--acrm-border);
    background: #fff;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
}

.acrm-pagination-btns button.active {
    background: var(--acrm-primary);
    color: #fff;
    border-color: var(--acrm-primary);
}

/* Modals */
.acrm-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.acrm-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(2px);
}

.acrm-modal-dialog {
    position: relative;
    width: 90%;
    max-width: 850px;
    max-height: 90vh;
    background: #ffffff;
    border-radius: var(--acrm-radius-lg);
    box-shadow: var(--acrm-shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.acrm-modal-sm {
    max-width: 500px;
}

.acrm-modal-header {
    padding: 16px 24px;
    border-bottom: 1px solid var(--acrm-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.acrm-modal-header h3 {
    margin: 0;
    font-size: 18px;
}

.acrm-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--acrm-text-muted);
}

.acrm-modal-body {
    padding: 24px;
    overflow-y: auto;
}

.acrm-modal-grid {
    display: grid;
    grid-template-columns: 1.6fr 1fr;
    gap: 24px;
}

.acrm-detail-section {
    margin-bottom: 20px;
}

.acrm-detail-section h4 {
    margin: 0 0 10px 0;
    font-size: 13px;
    text-transform: uppercase;
    color: var(--acrm-text-muted);
    letter-spacing: 0.5px;
}

.acrm-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    font-size: 13px;
}

.acrm-info-grid label {
    font-weight: 600;
    color: var(--acrm-text-muted);
}

.acrm-message-box {
    background: #f8fafc;
    border: 1px solid var(--acrm-border);
    border-radius: var(--acrm-radius);
    padding: 12px;
    font-size: 13px;
    white-space: pre-wrap;
}

.acrm-notes-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 180px;
    overflow-y: auto;
    margin-bottom: 10px;
}

.acrm-note-card {
    background: #f8fafc;
    border-left: 3px solid var(--acrm-primary);
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
}

.acrm-note-meta {
    font-size: 11px;
    color: var(--acrm-text-muted);
    margin-bottom: 2px;
}

.acrm-note-input-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.acrm-timeline {
    position: relative;
    padding-left: 16px;
    border-left: 2px solid var(--acrm-border);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.acrm-timeline-item {
    font-size: 12px;
    position: relative;
}

.acrm-timeline-item::before {
    content: '';
    position: absolute;
    left: -21px;
    top: 4px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--acrm-primary);
}

.acrm-timeline-time {
    font-size: 10px;
    color: var(--acrm-text-muted);
}

/* Credentials Reveal Box */
.acrm-credentials-reveal {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--acrm-border);
}

.acrm-cred-item {
    margin-bottom: 10px;
}

.acrm-cred-item label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--acrm-text-muted);
    margin-bottom: 3px;
}

/* Responsive */
@media (max-width: 900px) {
    .acrm-portal-container {
        flex-direction: column;
    }
    .acrm-sidebar {
        width: 100%;
    }
    .acrm-stats-row {
        grid-template-columns: 1fr;
    }
    .acrm-modal-grid {
        grid-template-columns: 1fr;
    }
}
