/* Contact List Manager – front.css v1.2 */

.clm-wrap {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    max-width: 860px;
    margin: 0 auto;
    color: #1a1a1a;
}

.clm-hidden { display: none !important; }

/* ---- HEADER ---- */
.clm-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 16px;
}

.clm-title { font-size: 18px; font-weight: 700; color: #111; }

.clm-count {
    display: inline-block;
    font-size: 12px;
    background: #eff6ff;
    color: #1d4ed8;
    border-radius: 20px;
    padding: 2px 10px;
    margin-left: 8px;
    font-weight: 500;
}

.clm-header-actions { display: flex; gap: 8px; align-items: center; }

.clm-btn-add {
    padding: 8px 16px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s;
}
.clm-btn-add:hover { background: #1d4ed8; }

.clm-btn-logout {
    padding: 7px 14px;
    background: transparent;
    color: #6b7280;
    border: 1px solid #d1d5db;
    border-radius: 7px;
    font-size: 12px;
    cursor: pointer;
    transition: background .12s;
}
.clm-btn-logout:hover { background: #f3f4f6; }

/* ---- SEARCH ---- */
.clm-search-wrap { position: relative; margin-bottom: 20px; }

.clm-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    pointer-events: none;
    opacity: .45;
}

.clm-search-wrap input[type="text"] {
    width: 100%;
    padding: 10px 14px 10px 36px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
    transition: border-color .15s;
}
.clm-search-wrap input[type="text"]:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

/* ---- GRID ---- */
.clm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 14px;
}

/* ---- CARD ---- */
.clm-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 14px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    transition: box-shadow .15s, border-color .15s;
}
.clm-card:hover {
    box-shadow: 0 4px 14px rgba(0,0,0,.08);
    border-color: #bfdbfe;
}

/* Avatar: inisial */
.clm-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 700;
    flex-shrink: 0;
}

/* Avatar: foto */
.clm-avatar-img {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid #e5e7eb;
    display: block;
}

.clm-card-body { flex: 1; min-width: 0; }

.clm-name {
    font-size: 14px;
    font-weight: 600;
    color: #111;
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.clm-detail {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    font-size: 12px;
    color: #374151;
    margin-bottom: 3px;
    line-height: 1.5;
}

.clm-detail a { color: #2563eb; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clm-detail a:hover { text-decoration: underline; }
.clm-icon { flex-shrink: 0; }

.clm-card-actions { display: flex; flex-direction: column; gap: 4px; flex-shrink: 0; }

.clm-card-btn {
    width: 30px;
    height: 30px;
    border: 1px solid #e5e7eb;
    background: transparent;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .12s, border-color .12s;
    padding: 0;
}
.clm-card-btn:hover { background: #f3f4f6; border-color: #d1d5db; }
.clm-card-btn-del:hover { background: #fef2f2; border-color: #fecaca; }

/* ---- EMPTY ---- */
.clm-empty {
    text-align: center;
    padding: 40px 20px;
    color: #9ca3af;
    font-size: 14px;
    background: #f9fafb;
    border-radius: 10px;
    border: 1px dashed #e5e7eb;
}

/* ---- OVERLAY ---- */
.clm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    padding: 16px;
    box-sizing: border-box;
}

/* ---- MODAL ---- */
.clm-modal {
    background: #fff;
    border-radius: 14px;
    padding: 28px 24px 22px;
    width: 100%;
    max-width: 460px;
    box-shadow: 0 8px 40px rgba(0,0,0,.18);
    max-height: 90vh;
    overflow-y: auto;
}

.clm-modal-wide { max-width: 520px; }
.clm-modal-sm   { max-width: 340px; text-align: center; }

.clm-modal-title { font-size: 16px; font-weight: 700; color: #111; margin: 0 0 4px; }
.clm-modal-sub   { font-size: 13px; color: #6b7280; margin: 0 0 16px; }
.clm-lock-icon   { font-size: 34px; margin-bottom: 10px; }

/* ---- FOTO SECTION ---- */
.clm-foto-section {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    margin-bottom: 16px;
}

.clm-foto-preview {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    flex-shrink: 0;
    overflow: visible;
}

.clm-foto-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: #f3f4f6;
    font-size: 32px;
    border: 2px dashed #d1d5db;
}

.clm-foto-preview img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #e5e7eb;
    display: block;
}

.clm-foto-remove {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #ef4444;
    color: #fff;
    border: 2px solid #fff;
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}
.clm-foto-remove:hover { background: #dc2626; }

.clm-foto-btns { flex: 1; display: flex; flex-direction: column; gap: 6px; }

.clm-foto-label { font-size: 11px; font-weight: 600; color: #374151; text-transform: uppercase; letter-spacing: .04em; margin: 0 0 2px; }

.clm-foto-hint  { font-size: 11px; color: #9ca3af; margin: 0; }

.clm-upload-label { cursor: pointer; }

.clm-upload-progress { display: flex; flex-direction: column; gap: 4px; }

.clm-progress-bar {
    height: 5px;
    background: #e5e7eb;
    border-radius: 10px;
    overflow: hidden;
}

.clm-progress-fill {
    height: 100%;
    background: #2563eb;
    border-radius: 10px;
    transition: width .2s;
    width: 0%;
}

#clm-progress-text { font-size: 11px; color: #6b7280; }

.clm-form-divider {
    height: 1px;
    background: #f3f4f6;
    margin: 4px 0 16px;
}

/* ---- FORM ---- */
.clm-form-group { margin-bottom: 12px; }

.clm-form-group label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.clm-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.clm-input {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #d1d5db;
    border-radius: 7px;
    font-size: 13px;
    outline: none;
    transition: border-color .15s;
    box-sizing: border-box;
    font-family: inherit;
    color: #111;
}
.clm-input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}

.clm-textarea { resize: vertical; min-height: 60px; }

/* ---- BUTTONS ---- */
.clm-btn-row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

.clm-btn {
    padding: 9px 20px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background .12s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.clm-btn-sm  { padding: 6px 12px; font-size: 12px; }

.clm-btn-primary { background: #2563eb; color: #fff; border-color: #2563eb; }
.clm-btn-primary:hover { background: #1d4ed8; }

.clm-btn-ghost   { background: transparent; color: #374151; border-color: #d1d5db; }
.clm-btn-ghost:hover { background: #f3f4f6; }

.clm-btn-danger  { background: #dc2626; color: #fff; border-color: #dc2626; }
.clm-btn-danger:hover { background: #b91c1c; }

/* ---- ERROR ---- */
.clm-error-msg {
    font-size: 12px;
    color: #b91c1c;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    padding: 7px 10px;
    margin-bottom: 10px;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 520px) {
    .clm-grid { grid-template-columns: 1fr; }
    .clm-form-row { grid-template-columns: 1fr; }
    .clm-modal { padding: 20px 14px 16px; }
    .clm-modal-wide { max-width: 100%; }
    .clm-foto-section { flex-direction: column; align-items: center; text-align: center; }
    .clm-foto-btns { align-items: center; }
}
