/* =============================================
   PHH Certificates - New Lead Modal
   Bottom-sheet style with backdrop blur
   Matches certificates.atlas-by-beek.com design
   ============================================= */

.new-lead-modal {
    position: fixed;
    inset: 0;
    z-index: 9000;
    background: rgba(0, 20, 40, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.new-lead-modal.show {
    opacity: 1;
    pointer-events: auto;
}

.nl-card {
    background: #fff;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    border-radius: 24px 24px 0 0;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.32, 0.72, 0, 1);
    overflow: hidden;
}

.new-lead-modal.show .nl-card {
    transform: translateY(0);
}

/* Header */
.nl-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 12px;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
}

    .nl-header h3 {
        font-size: 18px;
        font-weight: 700;
        color: hsl(177 56% 28%);
        margin: 0;
        letter-spacing: -0.3px;
    }

.nl-close {
    background: none;
    border: none;
    font-size: 24px;
    color: #aaa;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
}

.nl-close:hover { color: #e74c3c; }

/* Body */
.nl-body {
    overflow-y: auto;
    padding: 8px 24px 16px;
    -webkit-overflow-scrolling: touch;
    flex: 1;
}

/* Sections with stagger animation */
.nl-section {
    margin-bottom: 8px;
    opacity: 0;
    transform: translateY(16px);
}

.new-lead-modal.show .nl-section {
    animation: nlStagger 0.4s ease forwards;
}

.new-lead-modal.show .nl-section:nth-child(1) { animation-delay: 0.1s; }
.new-lead-modal.show .nl-section:nth-child(2) { animation-delay: 0.2s; }
.new-lead-modal.show .nl-section:nth-child(3) { animation-delay: 0.3s; }
.new-lead-modal.show .nl-section:nth-child(4) { animation-delay: 0.4s; }

@keyframes nlStagger {
    to { opacity: 1; transform: translateY(0); }
}

.nl-section-title {
    font-size: 12px;
    font-weight: 700;
    color: hsl(177 56% 28%);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 2px solid hsl(177 56% 28%);
    display: flex;
    align-items: center;
    gap: 8px;
}

.nl-section-title i {
    font-size: 13px;
    opacity: 0.7;
}

/* Rows and Fields */
.nl-row {
    display: flex;
    gap: 12px;
    margin-bottom: 10px;
}

.nl-field {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.nl-field.nl-full {
    flex: 1 1 100%;
}

.nl-field label {
    font-size: 11px;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.nl-req {
    color: #e74c3c;
}

.nl-field input,
.nl-field select {
    border: 1.5px solid #e0e0e0;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 14px;
    font-family: inherit;
    color: #1a1a1a;
    background: #fafafa;
    transition: border-color 0.2s, background 0.2s;
    -webkit-appearance: none;
    appearance: none;
}

.nl-field input:focus,
.nl-field select:focus {
    outline: none;
    border-color: hsl(177 56% 28%);
    background: #fff;
}

.nl-field input::placeholder {
    color: #bbb;
}

.nl-field select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

/* Toggle switch */
.nl-toggle-wrap {
    align-items: flex-start;
}

.nl-toggle {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    margin-top: 2px;
}

.nl-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.nl-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #ccc;
    border-radius: 26px;
    transition: 0.3s;
}

.nl-slider::before {
    content: '';
    position: absolute;
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.3s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.nl-toggle input:checked + .nl-slider {
    background: hsl(177 56% 28%);
}

.nl-toggle input:checked + .nl-slider::before {
    transform: translateX(22px);
}

/* Actions */
.nl-error {
    color: #c0392b;
    font-size: 13px;
    padding: 0 24px;
    min-height: 18px;
    flex-shrink: 0;
}

.nl-error:empty { display: none; }

.nl-actions {
    display: flex;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid #f0f0f0;
    flex-shrink: 0;
}

.nl-btn-cancel,
.nl-btn-save {
    flex: 1;
    padding: 14px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: transform 0.15s, opacity 0.15s;
}

.nl-btn-cancel {
    background: #f0f0f0;
    color: #666;
}

.nl-btn-save {
    background: hsl(177 56% 28%);
    color: white;
    position: relative;
    overflow: hidden;
}

.nl-btn-save:active {
    transform: scale(0.97);
}

.nl-btn-cancel:hover { background: #e5e5e5; }
.nl-btn-save:hover { opacity: 0.9; }
.nl-btn-save:disabled { opacity: 0.5; cursor: not-allowed; }

/* Ripple on save */
.nl-btn-save::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(255,255,255,0.3) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s;
}

.nl-btn-save:active::after {
    opacity: 1;
}

/* Success check animation (reused from app) */
@keyframes drawCircle {
    to { stroke-dashoffset: 0; }
}
@keyframes drawCheck {
    to { stroke-dashoffset: 0; }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Multi-contact block (emails + phones) */
.el-c-block {
    margin-bottom: 4px;
}

.el-c-title {
    font-size: 11px;
    font-weight: 700;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 8px 0 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.el-c-title i {
    font-size: 11px;
    color: #999;
}

.el-c-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 6px;
}

.el-c-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.el-c-row input,
.el-c-row select {
    border: 1.5px solid #e0e0e0;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13px;
    font-family: inherit;
    color: #1a1a1a;
    background: #fafafa;
    min-width: 0;
}

.el-c-row input:focus,
.el-c-row select:focus {
    outline: none;
    border-color: hsl(177 56% 28%);
    background: #fff;
}

.el-c-email-row .el-c-email { flex: 1; }

.el-c-phone-row .el-c-country { flex: 1.4; }
.el-c-phone-row .el-c-cc      { width: 56px; }
.el-c-phone-row .el-c-area    { width: 64px; }
.el-c-phone-row .el-c-tel     { flex: 1; }
.el-c-phone-row .el-c-type    { flex: 1.1; }

.el-c-primary {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: #666;
    white-space: nowrap;
}

.el-c-primary input[type="radio"] {
    margin: 0;
    accent-color: hsl(177 56% 28%);
    width: 14px;
    height: 14px;
}

.el-c-remove {
    border: none;
    background: transparent;
    color: #c0392b;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 6px;
    font-size: 12px;
}

.el-c-remove:hover { background: rgba(192, 57, 43, 0.1); }

.el-c-add {
    border: 1.5px dashed hsl(177 56% 28%);
    background: #fff;
    color: hsl(177 56% 28%);
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.15s;
}

.el-c-add:hover { background: rgba(0, 40, 85, 0.06); }
.el-c-add i { font-size: 10px; }

/* New Lead button in toolbar */
.btn-new-lead {
    padding: 7px 16px;
    border: 1.5px solid hsl(177 56% 28%);
    border-radius: 8px;
    background: hsl(177 56% 28%);
    color: white;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    margin-left: auto;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s, transform 0.15s;
}

.btn-new-lead:active { transform: scale(0.96); }
.btn-new-lead:hover { background: hsl(177 56% 28%); }
.btn-new-lead i { font-size: 11px; }
